<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>HippoDraw Class Library</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> <link rel="shortcut icon" href="hippoApp.ico"> </head><body> <!-- Generated by Doxygen 1.6.2 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="dir_d71d549033b3d00bbeb107001643b90a.html">xml</a> </div> </div> <div class="contents"> <h1>BinningProjectorXML.cxx</h1><a href="BinningProjectorXML_8cxx.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <a name="l00012"></a>00012 <span class="comment">// for truncation warning</span> <a name="l00013"></a>00013 <span class="preprocessor">#ifdef _MSC_VER</span> <a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#include "msdevstudio/MSconfig.h"</span> <a name="l00015"></a>00015 <span class="preprocessor">#endif</span> <a name="l00016"></a>00016 <span class="preprocessor"></span> <a name="l00017"></a>00017 <span class="preprocessor">#include "<a class="code" href="BinningProjectorXML_8h.html" title="BinningProjectorXML class interface.">BinningProjectorXML.h</a>"</span> <a name="l00018"></a>00018 <a name="l00019"></a>00019 <span class="preprocessor">#include "<a class="code" href="BinsBaseXML_8h.html" title="BinsBaseXML class interface.">BinsBaseXML.h</a>"</span> <a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="NTupleXML_8h.html" title="NTupleXML class interface.">NTupleXML.h</a>"</span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="XmlController_8h.html" title="XmlController class interface.">XmlController.h</a>"</span> <a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="XmlDocument_8h.html" title="XmlDocument class interface.">XmlDocument.h</a>"</span> <a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="XmlElement_8h.html" title="XmlElement class interface.">XmlElement.h</a>"</span> <a name="l00025"></a>00025 <a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="Range_8h.html" title="hippodraw::Range class interface">axes/Range.h</a>"</span> <a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="BinsBase_8h.html" title="hippodraw::BinsBase class interface">binners/BinsBase.h</a>"</span> <a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="DataSource_8h.html" title="hippodraw::DataSource class interface.">datasrcs/DataSource.h</a>"</span> <a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="BinningProjector_8h.html" title="hippodraw::BinningProjector class interface">projectors/BinningProjector.h</a>"</span> <a name="l00030"></a>00030 <a name="l00031"></a>00031 <span class="preprocessor">#include <cassert></span> <a name="l00032"></a>00032 <a name="l00033"></a>00033 <span class="keyword">using</span> std::list; <a name="l00034"></a>00034 <span class="keyword">using</span> std::string; <a name="l00035"></a>00035 <span class="keyword">using</span> std::vector; <a name="l00036"></a>00036 <a name="l00037"></a>00037 <span class="keyword">using namespace </span>hippodraw; <a name="l00038"></a>00038 <a name="l00039"></a><a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a1fd129c577b96f047bbdddb08f72659d">00039</a> BinningProjectorXML::BinningProjectorXML ( <a class="code" href="classhippodraw_1_1XmlController.html" title="A base class that is the interface between GUI and the XML serialization and deserialization...">XmlController</a> * controller ) <a name="l00040"></a>00040 : <a class="code" href="classhippodraw_1_1BaseXML.html" title="A base class of XML element controllers.">BaseXML</a> ( <span class="stringliteral">"BinningProjector"</span>, controller ) <a name="l00041"></a>00041 { <a name="l00042"></a>00042 <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a860ec77212bcfab43d5e3432aef98728" title="The BinsBaseXML object used by this object.">m_binsbaseXML</a> = <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1BinsBaseXML.html" title="A class XML creation and parsing of XmlElement for BinsBase class.">BinsBaseXML</a> ( controller ); <a name="l00043"></a>00043 <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a2b5632a56e9b157a62775edff55e0bf7" title="The creator of the NTuple element node.">m_ntupleXML</a> = <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1NTupleXML.html" title="A singleton class that is does XML serialization and deserialization of derived classes...">NTupleXML</a> ( controller ); <a name="l00044"></a>00044 } <a name="l00045"></a>00045 <a name="l00046"></a>00046 <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a175027bdeccbbc03417862eb66d70e40" title="The destructor.">BinningProjectorXML::</a> <a name="l00047"></a><a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a175027bdeccbbc03417862eb66d70e40">00047</a> <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a175027bdeccbbc03417862eb66d70e40" title="The destructor.">~BinningProjectorXML</a> () <a name="l00048"></a>00048 { <a name="l00049"></a>00049 <span class="keyword">delete</span> <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a860ec77212bcfab43d5e3432aef98728" title="The BinsBaseXML object used by this object.">m_binsbaseXML</a>; <a name="l00050"></a>00050 <span class="keyword">delete</span> <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a2b5632a56e9b157a62775edff55e0bf7" title="The creator of the NTuple element node.">m_ntupleXML</a>; <a name="l00051"></a>00051 } <a name="l00052"></a>00052 <a name="l00053"></a>00053 <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> * <a name="l00054"></a>00054 <a class="code" href="classhippodraw_1_1BaseXML.html#afa1d42a894a8739e0d120ed9c4383d38" title="Creates a new element node.">BinningProjectorXML::</a> <a name="l00055"></a><a class="code" href="classhippodraw_1_1BinningProjectorXML.html#ac18b7b5a0878c23e3d2e0b49d4da6084">00055</a> <a class="code" href="classhippodraw_1_1BaseXML.html#afa1d42a894a8739e0d120ed9c4383d38" title="Creates a new element node.">createElement</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1BinningProjector.html" title="The BinningProjector is an abstract class provides most of the functionality for...">BinningProjector</a> & projector ) <a name="l00056"></a>00056 { <a name="l00057"></a>00057 <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> * tag = <a class="code" href="classhippodraw_1_1BaseXML.html#afa1d42a894a8739e0d120ed9c4383d38" title="Creates a new element node.">BaseXML::createElement</a> (); <span class="comment">// in base class</span> <a name="l00058"></a>00058 <span class="keyword">const</span> <span class="keywordtype">void</span> * addr = reinterpret_cast < <span class="keyword">const</span> <span class="keywordtype">void</span> * > ( & projector ); <a name="l00059"></a>00059 <span class="keywordtype">int</span> <span class="keywordtype">id</span> = <a class="code" href="classhippodraw_1_1BaseXML.html#ae50d78be58d5938b4434515f4f037ece" title="The singleton XML controller object.">m_controller</a> -> getId ( addr ); <a name="l00060"></a>00060 <a class="code" href="classhippodraw_1_1BaseXML.html#aba09fa4e77f2c85cc12df1116cb5f31e" title="Sets the unique identification of the object.">setId</a> ( *tag, <span class="keywordtype">id</span> ); <a name="l00061"></a>00061 <a name="l00062"></a>00062 <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a41ded2e3da1b9844577208f41671988b" title="Create the child element nodes.">createChildren</a> ( tag, projector ); <a name="l00063"></a>00063 <a name="l00064"></a>00064 <span class="keywordflow">return</span> tag; <a name="l00065"></a>00065 } <a name="l00066"></a>00066 <span class="keywordtype">void</span> <a name="l00067"></a>00067 <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a41ded2e3da1b9844577208f41671988b" title="Create the child element nodes.">BinningProjectorXML::</a> <a name="l00068"></a><a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a41ded2e3da1b9844577208f41671988b">00068</a> <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a41ded2e3da1b9844577208f41671988b" title="Create the child element nodes.">createChildren</a> ( <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> * tag, <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1BinningProjector.html" title="The BinningProjector is an abstract class provides most of the functionality for...">BinningProjector</a> & projector ) <a name="l00069"></a>00069 { <a name="l00070"></a>00070 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1BinsBase.html" title="The base class for the binner hierarchy.">BinsBase</a> * bins = projector.<a class="code" href="classhippodraw_1_1BinningProjector.html#a446e9a755c5bf8358f02facc7e26e6b7" title="Returns reference to BinsBase object used by this projector.">getBinner</a> (); <a name="l00071"></a>00071 <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> * element = <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a860ec77212bcfab43d5e3432aef98728" title="The BinsBaseXML object used by this object.">m_binsbaseXML</a>-><a class="code" href="classhippodraw_1_1BinsBaseXML.html#ad0dd4d8305e8d40c97c68be4e40129ac" title="Returns a newly created XmlElement with attributes set for view.">createElement</a> ( *bins ); <a name="l00072"></a>00072 <a name="l00073"></a>00073 tag-><a class="code" href="classhippodraw_1_1XmlNode.html#ae8f46895ca8b33a11cbff29b56ba48e4" title="Appends a child element to the element.">appendChild</a> ( *element ); <a name="l00074"></a>00074 <span class="keyword">delete</span> element; <a name="l00075"></a>00075 <a name="l00076"></a>00076 <a class="code" href="classhippodraw_1_1BinningProjector.html" title="The BinningProjector is an abstract class provides most of the functionality for...">BinningProjector</a> & proj = const_cast < <a class="code" href="classhippodraw_1_1BinningProjector.html" title="The BinningProjector is an abstract class provides most of the functionality for...">BinningProjector</a> & > ( projector ); <a name="l00077"></a>00077 <span class="keywordflow">if</span> ( projector.<a class="code" href="classhippodraw_1_1ProjectorBase.html#ae1a7e71f5c8144c060f3207f216fbc05" title="Returns true if projector has binding to a DataSource.">hasDataSourceBindings</a> () == false ) { <a name="l00078"></a>00078 proj.<a class="code" href="classhippodraw_1_1BinningProjector.html#accd9823e3e5563003ba43e03b860b02e" title="Prepares the projector for plotting by executing, if needed, the binning procedure...">prepareValues</a> (); <a name="l00079"></a>00079 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1DataSource.html" title="Base class for DataSource.">DataSource</a> * ntuple = projector.<a class="code" href="classhippodraw_1_1ProjectorBase.html#a3a6872d803f79eabb52babd8ae39d605" title="Returns DataSource representation of projected values.">getProjectedValues</a> (); <a name="l00080"></a>00080 element = <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a2b5632a56e9b157a62775edff55e0bf7" title="The creator of the NTuple element node.">m_ntupleXML</a> -> <a class="code" href="classhippodraw_1_1BaseXML.html#afa1d42a894a8739e0d120ed9c4383d38" title="Creates a new element node.">createElement</a> ( *ntuple ); <a name="l00081"></a>00081 <a name="l00082"></a>00082 tag -> appendChild ( *element ); <a name="l00083"></a>00083 <span class="keyword">delete</span> element; <a name="l00084"></a>00084 } <a name="l00085"></a>00085 } <a name="l00086"></a>00086 <a name="l00087"></a>00087 <span class="keywordtype">void</span> <a name="l00088"></a>00088 <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a4ba5e6a487ed03f0608761c0a987c8e6" title="Sets the binning attributes of the projector from child nodes of the parent XML element...">BinningProjectorXML::</a> <a name="l00089"></a><a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a4ba5e6a487ed03f0608761c0a987c8e6">00089</a> <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a4ba5e6a487ed03f0608761c0a987c8e6" title="Sets the binning attributes of the projector from child nodes of the parent XML element...">getObject</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> * parent, <a class="code" href="classhippodraw_1_1ProjectorBase.html" title="The base class for the Projector hierarchy.">ProjectorBase</a> * pbase ) <a name="l00090"></a>00090 { <a name="l00091"></a>00091 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> * bp_element = <a class="code" href="classhippodraw_1_1BaseXML.html#af145db70f519c8883e84023299d30356" title="Returns the single child node of element of the type that can be handled by this...">getNode</a> ( parent ); <a name="l00092"></a>00092 <span class="keywordflow">if</span> ( bp_element == 0 ) <span class="keywordflow">return</span>; <a name="l00093"></a>00093 <a name="l00094"></a>00094 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> * element = <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a860ec77212bcfab43d5e3432aef98728" title="The BinsBaseXML object used by this object.">m_binsbaseXML</a>-><a class="code" href="classhippodraw_1_1BaseXML.html#af145db70f519c8883e84023299d30356" title="Returns the single child node of element of the type that can be handled by this...">getNode</a> ( bp_element ); <a name="l00095"></a>00095 <a class="code" href="classhippodraw_1_1BinsBase.html" title="The base class for the binner hierarchy.">BinsBase</a> * bins = <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a860ec77212bcfab43d5e3432aef98728" title="The BinsBaseXML object used by this object.">m_binsbaseXML</a>-><a class="code" href="classhippodraw_1_1BinsBaseXML.html#a9eaacbcc56d75efd67fee07ed03c422f" title="Creates an object derived from BinsBaseBase.">createObject</a> ( element ); <a name="l00096"></a>00096 <a name="l00097"></a>00097 <a class="code" href="classhippodraw_1_1BinningProjector.html" title="The BinningProjector is an abstract class provides most of the functionality for...">BinningProjector</a> * projector = dynamic_cast < <a class="code" href="classhippodraw_1_1BinningProjector.html" title="The BinningProjector is an abstract class provides most of the functionality for...">BinningProjector</a> * > ( pbase ); <a name="l00098"></a>00098 projector-><a class="code" href="classhippodraw_1_1BinningProjector.html#a93da285edc5ffee3944e28259c207c3b" title="Sets the BinsBase object to be used by this projector.">setBinner</a> ( bins ); <a name="l00099"></a>00099 } <a name="l00100"></a>00100 <a name="l00101"></a>00101 <span class="keywordtype">void</span> <a name="l00102"></a>00102 <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a62f1d3ec038b4487f90bc2142882a803" title="Sets the contents of the bins.">BinningProjectorXML::</a> <a name="l00103"></a><a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a62f1d3ec038b4487f90bc2142882a803">00103</a> <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a62f1d3ec038b4487f90bc2142882a803" title="Sets the contents of the bins.">setBins</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> * parent, <a class="code" href="classhippodraw_1_1ProjectorBase.html" title="The base class for the Projector hierarchy.">ProjectorBase</a> * pbase ) <a name="l00104"></a>00104 { <a name="l00105"></a>00105 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> * bp_element = <a class="code" href="classhippodraw_1_1BaseXML.html#af145db70f519c8883e84023299d30356" title="Returns the single child node of element of the type that can be handled by this...">getNode</a> ( parent ); <a name="l00106"></a>00106 <span class="keywordflow">if</span> ( bp_element == 0 ) <span class="keywordflow">return</span>; <a name="l00107"></a>00107 <a name="l00108"></a>00108 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> * nt_element = <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a2b5632a56e9b157a62775edff55e0bf7" title="The creator of the NTuple element node.">m_ntupleXML</a> -> <a class="code" href="classhippodraw_1_1BaseXML.html#af145db70f519c8883e84023299d30356" title="Returns the single child node of element of the type that can be handled by this...">getNode</a> ( bp_element ); <a name="l00109"></a>00109 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1DataSource.html" title="Base class for DataSource.">DataSource</a> * ntuple = <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a2b5632a56e9b157a62775edff55e0bf7" title="The creator of the NTuple element node.">m_ntupleXML</a> -> <a class="code" href="classhippodraw_1_1BinningProjectorXML.html#a4ba5e6a487ed03f0608761c0a987c8e6" title="Sets the binning attributes of the projector from child nodes of the parent XML element...">getObject</a> ( *nt_element ); <a name="l00110"></a>00110 <a name="l00111"></a>00111 <a class="code" href="classhippodraw_1_1BinningProjector.html" title="The BinningProjector is an abstract class provides most of the functionality for...">BinningProjector</a> * projector = dynamic_cast < <a class="code" href="classhippodraw_1_1BinningProjector.html" title="The BinningProjector is an abstract class provides most of the functionality for...">BinningProjector</a> * > ( pbase ); <a name="l00112"></a>00112 projector -> setBinContents ( ntuple ); <a name="l00113"></a>00113 } </pre></div></div> <hr size="1"><address style="align: right;"><small> Generated for HippoDraw Class Library by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0> </a> </small></address> </body> </html>