Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > eebc325dc36bd6e3b09b9b45133e42f8 > files > 553

HippoDraw-devel-docs-1.21.1-10.fc13.i686.rpm

<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&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;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&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_d71d549033b3d00bbeb107001643b90a.html">xml</a>
  </div>
</div>
<div class="contents">
<h1>BinsBaseXML.cxx</h1><a href="BinsBaseXML_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 &quot;msdevstudio/MSconfig.h&quot;</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 &quot;<a class="code" href="BinsBaseXML_8h.html" title="BinsBaseXML class interface.">BinsBaseXML.h</a>&quot;</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="preprocessor">#include &quot;<a class="code" href="BinnerAxisXML_8h.html" title="BinnerAxisXML class interface.">BinnerAxisXML.h</a>&quot;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &quot;<a class="code" href="XmlElement_8h.html" title="XmlElement class interface.">XmlElement.h</a>&quot;</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="preprocessor">#include &quot;<a class="code" href="BinsBase_8h.html" title="hippodraw::BinsBase class interface">binners/BinsBase.h</a>&quot;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;<a class="code" href="BinsFactory_8h.html">binners/BinsFactory.h</a>&quot;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;cassert&gt;</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="keyword">using</span> std::list;
<a name="l00028"></a>00028 <span class="keyword">using</span> std::string;
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="keyword">namespace </span>hippodraw {
<a name="l00031"></a>00031 
<a name="l00032"></a><a class="code" href="classhippodraw_1_1BinsBaseXML.html#af2a95071cbca0a05e244b3c9f89659d8">00032</a> <a class="code" href="classhippodraw_1_1BinsBaseXML.html#af2a95071cbca0a05e244b3c9f89659d8" title="A default constructor for avoiding creation except by itself or with derived classes...">BinsBaseXML::BinsBaseXML</a> ( <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="l00033"></a>00033   : <a class="code" href="classhippodraw_1_1BaseXML.html" title="A base class of XML element controllers.">BaseXML</a> ( <span class="stringliteral">&quot;BinsBase&quot;</span>, controller ),
<a name="l00034"></a>00034     m_axis ( <span class="stringliteral">&quot;axis&quot;</span> )
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036   <a class="code" href="classhippodraw_1_1BinsBaseXML.html#ab0cda1499623ba6a7016fe7742545bcf" title="The BinsBaseXML object used by this object.">m_binnerXML</a> = <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1BinnerAxisXML.html" title="A class XML creation and parsing of XmlElement for BinnerAxis classes.">BinnerAxisXML</a> ( controller );
<a name="l00037"></a>00037 }
<a name="l00038"></a>00038 
<a name="l00039"></a>00039 <a class="code" href="classhippodraw_1_1BinsBaseXML.html#a1a3ab11af61f211d63bb5323dfbebf65" title="The destructor.">BinsBaseXML::</a>
<a name="l00040"></a><a class="code" href="classhippodraw_1_1BinsBaseXML.html#a1a3ab11af61f211d63bb5323dfbebf65">00040</a> <a class="code" href="classhippodraw_1_1BinsBaseXML.html#a1a3ab11af61f211d63bb5323dfbebf65" title="The destructor.">~BinsBaseXML</a> ()
<a name="l00041"></a>00041 {
<a name="l00042"></a>00042   <span class="keyword">delete</span> <a class="code" href="classhippodraw_1_1BinsBaseXML.html#ab0cda1499623ba6a7016fe7742545bcf" title="The BinsBaseXML object used by this object.">m_binnerXML</a>;
<a name="l00043"></a>00043 }
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> * 
<a name="l00046"></a>00046 <a class="code" href="classhippodraw_1_1BaseXML.html#afa1d42a894a8739e0d120ed9c4383d38" title="Creates a new element node.">BinsBaseXML::</a>
<a name="l00047"></a><a class="code" href="classhippodraw_1_1BinsBaseXML.html#ad0dd4d8305e8d40c97c68be4e40129ac">00047</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_1BinsBase.html" title="The base class for the binner hierarchy.">BinsBase</a> &amp; bins )
<a name="l00048"></a>00048 {
<a name="l00049"></a>00049   <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> ();
<a name="l00050"></a>00050   <span class="keyword">const</span> <span class="keywordtype">string</span> &amp; <a class="code" href="namespacenum__util.html#af7e893a8c6a5f6a426480fc85cda4fa1">type</a> = bins.<a class="code" href="classhippodraw_1_1BinsBase.html#a11c23a386abb9eb8a42f0c2c2835d640" title="Returns the name of the Bins container object.">name</a>();
<a name="l00051"></a>00051   tag-&gt;<a class="code" href="classhippodraw_1_1XmlElement.html#abf6f7e218f61b094107a9e93ab267fd8" title="Sets attribute named name to the int value value.">setAttribute</a> ( <a class="code" href="classhippodraw_1_1BaseXML.html#af21e457cccd7226d53593e24988c6734" title="The attribute name for the type of object.">m_type</a>, type );
<a name="l00052"></a>00052 
<a name="l00053"></a>00053   <a class="code" href="classhippodraw_1_1BinsBaseXML.html#a2b29a218296e01b022ec27722bce030d" title="Creates the child XML elements of this element.">createChildren</a> ( *tag, bins );
<a name="l00054"></a>00054 
<a name="l00055"></a>00055   <span class="keywordflow">return</span> tag;
<a name="l00056"></a>00056 }
<a name="l00057"></a>00057 
<a name="l00058"></a>00058 
<a name="l00059"></a>00059 <span class="keywordtype">void</span>
<a name="l00060"></a>00060 <a class="code" href="classhippodraw_1_1BinsBaseXML.html#a2b29a218296e01b022ec27722bce030d" title="Creates the child XML elements of this element.">BinsBaseXML::</a>
<a name="l00061"></a><a class="code" href="classhippodraw_1_1BinsBaseXML.html#a2b29a218296e01b022ec27722bce030d">00061</a> <a class="code" href="classhippodraw_1_1BinsBaseXML.html#a2b29a218296e01b022ec27722bce030d" title="Creates the child XML elements of this element.">createChildren</a> ( <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> &amp; tag, <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1BinsBase.html" title="The base class for the binner hierarchy.">BinsBase</a> &amp; bins )
<a name="l00062"></a>00062 {
<a name="l00063"></a>00063   <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1BinnerAxis.html" title="The base class for the BinnerAxis hierarchy.">BinnerAxis</a> * binner = bins.<a class="code" href="classhippodraw_1_1BinsBase.html#a9b5ceca1c351b4d1366273f3f2684f41" title="Returns the BinnerAxis object used by this object.">getBinnerOn</a> ( <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a58833a3110c570fb05130d40c365d1e4" title="X axis.">Axes::X</a> );
<a name="l00064"></a>00064   <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_1BinsBaseXML.html#ab0cda1499623ba6a7016fe7742545bcf" title="The BinsBaseXML object used by this object.">m_binnerXML</a>-&gt;<a class="code" href="classhippodraw_1_1BinnerAxisXML.html#ad78ae16c231db9caef02c88f14807fa2" title="Returns a newly created XmlElement with attributes set for binner.">createElement</a> ( *binner );
<a name="l00065"></a>00065   <span class="keywordtype">string</span> axis ( <span class="stringliteral">&quot;X&quot;</span> );
<a name="l00066"></a>00066   element-&gt;<a class="code" href="classhippodraw_1_1XmlElement.html#abf6f7e218f61b094107a9e93ab267fd8" title="Sets attribute named name to the int value value.">setAttribute</a> ( <a class="code" href="classhippodraw_1_1BinsBaseXML.html#a3d53f427a722775ec41ae83421fe5fa2" title="The attribute name for the axis of the BinnerAxisXML element.">m_axis</a>, axis );
<a name="l00067"></a>00067   tag.<a class="code" href="classhippodraw_1_1XmlNode.html#ae8f46895ca8b33a11cbff29b56ba48e4" title="Appends a child element to the element.">appendChild</a> ( *element );
<a name="l00068"></a>00068   <span class="keyword">delete</span> element;
<a name="l00069"></a>00069 
<a name="l00070"></a>00070   <span class="keywordtype">int</span> number = bins.<a class="code" href="classhippodraw_1_1BinsBase.html#aab8537c85440cb3cd857f8ffe765de91" title="Returns the number of axes handled by the BinsBase derived class.">getNumberOfAxes</a> ();
<a name="l00071"></a>00071   <span class="keywordflow">if</span> ( number &lt; 2 ) <span class="keywordflow">return</span>;
<a name="l00072"></a>00072 
<a name="l00073"></a>00073   binner = bins.<a class="code" href="classhippodraw_1_1BinsBase.html#a9b5ceca1c351b4d1366273f3f2684f41" title="Returns the BinnerAxis object used by this object.">getBinnerOn</a> ( <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a5596231eabd6cf29050967d5ac83ad84" title="Y axis.">Axes::Y</a> );
<a name="l00074"></a>00074   element = <a class="code" href="classhippodraw_1_1BinsBaseXML.html#ab0cda1499623ba6a7016fe7742545bcf" title="The BinsBaseXML object used by this object.">m_binnerXML</a>-&gt;<a class="code" href="classhippodraw_1_1BinnerAxisXML.html#ad78ae16c231db9caef02c88f14807fa2" title="Returns a newly created XmlElement with attributes set for binner.">createElement</a> ( *binner );
<a name="l00075"></a>00075   axis = <span class="stringliteral">&quot;Y&quot;</span>;
<a name="l00076"></a>00076   element-&gt;<a class="code" href="classhippodraw_1_1XmlElement.html#abf6f7e218f61b094107a9e93ab267fd8" title="Sets attribute named name to the int value value.">setAttribute</a> ( <a class="code" href="classhippodraw_1_1BinsBaseXML.html#a3d53f427a722775ec41ae83421fe5fa2" title="The attribute name for the axis of the BinnerAxisXML element.">m_axis</a>, axis );
<a name="l00077"></a>00077   tag.<a class="code" href="classhippodraw_1_1XmlNode.html#ae8f46895ca8b33a11cbff29b56ba48e4" title="Appends a child element to the element.">appendChild</a> ( *element );
<a name="l00078"></a>00078   <span class="keyword">delete</span> element;
<a name="l00079"></a>00079 }
<a name="l00080"></a>00080 
<a name="l00081"></a>00081 <a class="code" href="classhippodraw_1_1BinsBase.html" title="The base class for the binner hierarchy.">BinsBase</a> * 
<a name="l00082"></a>00082 <a class="code" href="classhippodraw_1_1BinsBaseXML.html#a9eaacbcc56d75efd67fee07ed03c422f" title="Creates an object derived from BinsBaseBase.">BinsBaseXML::</a>
<a name="l00083"></a><a class="code" href="classhippodraw_1_1BinsBaseXML.html#a9eaacbcc56d75efd67fee07ed03c422f">00083</a> <a class="code" href="classhippodraw_1_1BinsBaseXML.html#a9eaacbcc56d75efd67fee07ed03c422f" title="Creates an object derived from BinsBaseBase.">createObject</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> * binsbase )
<a name="l00084"></a>00084 {
<a name="l00085"></a>00085   <span class="keywordtype">string</span> <a class="code" href="namespacenum__util.html#af7e893a8c6a5f6a426480fc85cda4fa1">type</a>;
<a name="l00086"></a>00086   <span class="keywordtype">bool</span> ok = binsbase-&gt;<a class="code" href="classhippodraw_1_1XmlElement.html#afa83a3518bac3d6ae2bc519084071fad" title="Sets value to the attribute name&amp;#39;s value.">attribute</a> ( <a class="code" href="classhippodraw_1_1BaseXML.html#af21e457cccd7226d53593e24988c6734" title="The attribute name for the type of object.">m_type</a>, type );
<a name="l00087"></a>00087   assert ( ok );
<a name="l00088"></a>00088 
<a name="l00089"></a>00089   <a class="code" href="classhippodraw_1_1BinsFactory.html" title="A Factory singleton class for creating objects whose class derives from BinsBase...">BinsFactory</a> * factory = <a class="code" href="classhippodraw_1_1BinsFactory.html#a3dc39ad0ac5ece92aa734eb4d979ddb1" title="Returns a pointer to the singleton instance.">BinsFactory::instance</a> ();
<a name="l00090"></a>00090   <a class="code" href="classhippodraw_1_1BinsBase.html" title="The base class for the binner hierarchy.">BinsBase</a> * bins = factory-&gt;<a class="code" href="classhippodraw_1_1Factory.html#a1c53a3eab4f96ad0638fab10da2d6e03" title="Creates a new object from a prototype named name.">create</a> ( type );
<a name="l00091"></a>00091 
<a name="l00092"></a>00092   list &lt; XmlElement * &gt; nodelist;
<a name="l00093"></a>00093   <a class="code" href="classhippodraw_1_1BinsBaseXML.html#ab0cda1499623ba6a7016fe7742545bcf" title="The BinsBaseXML object used by this object.">m_binnerXML</a>-&gt;<a class="code" href="classhippodraw_1_1BaseXML.html#a5341ca7744d304c2746a8f5564ce237b" title="Fills the nodelist with immediate child nodes of element with nodes that can be handled...">fillNodeList</a> ( binsbase, nodelist );
<a name="l00094"></a>00094 
<a name="l00095"></a>00095   list &lt; XmlElement * &gt; :: const_iterator first = nodelist.begin();
<a name="l00096"></a>00096   <span class="keywordflow">while</span> ( first != nodelist.end() ) {
<a name="l00097"></a>00097     <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> * element = *first++;
<a name="l00098"></a>00098     <a class="code" href="classhippodraw_1_1BinnerAxis.html" title="The base class for the BinnerAxis hierarchy.">BinnerAxis</a> * binner = <a class="code" href="classhippodraw_1_1BinsBaseXML.html#ab0cda1499623ba6a7016fe7742545bcf" title="The BinsBaseXML object used by this object.">m_binnerXML</a>-&gt;<a class="code" href="classhippodraw_1_1BinnerAxisXML.html#a681e2d3cad85fbd48c091ecf56954943" title="Creates an object derived from BinnerAxis.">createObject</a> ( element );
<a name="l00099"></a>00099     <span class="keywordtype">string</span> axis;
<a name="l00100"></a>00100     <span class="keywordtype">bool</span> ok = element-&gt;<a class="code" href="classhippodraw_1_1XmlElement.html#afa83a3518bac3d6ae2bc519084071fad" title="Sets value to the attribute name&amp;#39;s value.">attribute</a> ( <a class="code" href="classhippodraw_1_1BinsBaseXML.html#a3d53f427a722775ec41ae83421fe5fa2" title="The attribute name for the axis of the BinnerAxisXML element.">m_axis</a>, axis );
<a name="l00101"></a>00101     assert ( ok );
<a name="l00102"></a>00102 
<a name="l00103"></a>00103     <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7" title="Axes constants.">Axes::Type</a> type = axis == <span class="stringliteral">&quot;X&quot;</span> ? <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a58833a3110c570fb05130d40c365d1e4" title="X axis.">Axes::X</a> : <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a5596231eabd6cf29050967d5ac83ad84" title="Y axis.">Axes::Y</a>;
<a name="l00104"></a>00104     bins-&gt;<a class="code" href="classhippodraw_1_1BinsBase.html#a466a7bc0c04407cf195866f202de23a8" title="Sets the bin calculator on specified axis.">setBinnerOn</a> ( binner, type );
<a name="l00105"></a>00105   }
<a name="l00106"></a>00106 
<a name="l00107"></a>00107   <span class="keywordflow">return</span> bins;
<a name="l00108"></a>00108 }
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 } <span class="comment">// namespace hippodraw</span>
<a name="l00111"></a>00111 
</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>