Sophie

Sophie

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

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_81660c05fb6bfb5c6c7ef0fee605ba15.html">datasrcs</a>
  </div>
</div>
<div class="contents">
<h1>TupleCut.cxx</h1><a href="TupleCut_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 in debug mode</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="TupleCut_8h.html" title="hippodraw::TupleCut class interface">TupleCut.h</a>&quot;</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="preprocessor">#include &quot;<a class="code" href="DataSource_8h.html" title="hippodraw::DataSource class interface.">datasrcs/DataSource.h</a>&quot;</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;algorithm&gt;</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="keyword">using namespace </span>hippodraw;
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 TupleCut::
<a name="l00026"></a><a class="code" href="classhippodraw_1_1TupleCut.html#ababeace9e5aad9f1f6a4f6dc03193528">00026</a> TupleCut ()
<a name="l00027"></a>00027   : m_column ( 0 ),
<a name="l00028"></a>00028     m_invert ( false ),
<a name="l00029"></a>00029     m_enabled ( true )
<a name="l00030"></a>00030 {
<a name="l00031"></a>00031 }
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 <span class="keywordtype">void</span>
<a name="l00034"></a>00034 <a class="code" href="classhippodraw_1_1TupleCut.html#a1aac6272411226109e7cb9d5c612282d" title="Sets the cut to be enabled, i.e.">TupleCut::</a>
<a name="l00035"></a><a class="code" href="classhippodraw_1_1TupleCut.html#a1aac6272411226109e7cb9d5c612282d">00035</a> <a class="code" href="classhippodraw_1_1TupleCut.html#a1aac6272411226109e7cb9d5c612282d" title="Sets the cut to be enabled, i.e.">setEnabled</a> ( <span class="keywordtype">bool</span> yes )
<a name="l00036"></a>00036 {
<a name="l00037"></a>00037   <a class="code" href="classhippodraw_1_1TupleCut.html#a34a97a069b6bae0160fc4d19394ee0b1" title="The enable flag.">m_enabled</a> = yes;
<a name="l00038"></a>00038 }
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 <span class="keywordtype">bool</span>
<a name="l00041"></a>00041 <a class="code" href="classhippodraw_1_1TupleCut.html#ae2931e09e0fd8eac15c83f0254b4e4ac" title="Returns the state of the cut&amp;#39;s enable status.">TupleCut::</a>
<a name="l00042"></a><a class="code" href="classhippodraw_1_1TupleCut.html#ae2931e09e0fd8eac15c83f0254b4e4ac">00042</a> <a class="code" href="classhippodraw_1_1TupleCut.html#ae2931e09e0fd8eac15c83f0254b4e4ac" title="Returns the state of the cut&amp;#39;s enable status.">isEnabled</a> ()<span class="keyword"> const</span>
<a name="l00043"></a>00043 <span class="keyword"></span>{
<a name="l00044"></a>00044   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1TupleCut.html#a34a97a069b6bae0160fc4d19394ee0b1" title="The enable flag.">m_enabled</a>;
<a name="l00045"></a>00045 }
<a name="l00046"></a>00046 
<a name="l00047"></a><a class="code" href="classhippodraw_1_1TupleCut.html#a1fb4f279a7401329284bbabd2676b5b0">00047</a> <span class="keywordtype">bool</span> <a class="code" href="classhippodraw_1_1TupleCut.html#a1fb4f279a7401329284bbabd2676b5b0" title="Returns true if the cut value at the index i is within the range.">TupleCut::acceptRow</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1DataSource.html" title="Base class for DataSource.">DataSource</a> * ntuple, 
<a name="l00048"></a>00048                            <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i )<span class="keyword"> const</span>
<a name="l00049"></a>00049 <span class="keyword"></span>{
<a name="l00050"></a>00050   <span class="keywordtype">bool</span> shouldBeAccepted = <span class="keyword">true</span>;
<a name="l00051"></a>00051 
<a name="l00052"></a>00052   <span class="keywordflow">if</span> ( <a class="code" href="classhippodraw_1_1TupleCut.html#a34a97a069b6bae0160fc4d19394ee0b1" title="The enable flag.">m_enabled</a> ) {
<a name="l00053"></a>00053     <span class="keywordtype">double</span> value = ntuple -&gt; valueAt ( i, <a class="code" href="classhippodraw_1_1TupleCut.html#af27a091f84e50b8c3481c6a73c69c7ea" title="The column index used by the cut.">m_column</a> );
<a name="l00054"></a>00054     <span class="keywordtype">bool</span> included = <a class="code" href="classhippodraw_1_1TupleCut.html#ae71dd536700e6f5636df8c8728c1383d" title="The Range object used by the cut.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#acd177035de6a486f16f65dd95e8e6c46" title="Returns true if the argument value is inside the range.">includes</a> ( value );
<a name="l00055"></a>00055     shouldBeAccepted  = 
<a name="l00056"></a>00056       ( included &amp;&amp; ! <a class="code" href="classhippodraw_1_1TupleCut.html#a394c8aef0bb77d86943d815b33a3a850" title="The inversion flag.">m_invert</a> ) ||
<a name="l00057"></a>00057       ( !included &amp;&amp; <a class="code" href="classhippodraw_1_1TupleCut.html#a394c8aef0bb77d86943d815b33a3a850" title="The inversion flag.">m_invert</a> );
<a name="l00058"></a>00058   }
<a name="l00059"></a>00059 
<a name="l00060"></a>00060   <span class="keywordflow">return</span> shouldBeAccepted;
<a name="l00061"></a>00061 }
<a name="l00062"></a>00062 
<a name="l00063"></a><a class="code" href="classhippodraw_1_1TupleCut.html#aa4204fa6fd749b0f3717e6f6feba816e">00063</a> <span class="keywordtype">void</span> <a class="code" href="classhippodraw_1_1TupleCut.html#aa4204fa6fd749b0f3717e6f6feba816e" title="Sets the column in the DataSource to be used.">TupleCut::setColumn</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15" title="The column indices for 2 dimension data point tuple.">column</a>  )
<a name="l00064"></a>00064 {
<a name="l00065"></a>00065   <a class="code" href="classhippodraw_1_1TupleCut.html#af27a091f84e50b8c3481c6a73c69c7ea" title="The column index used by the cut.">m_column</a> = column;
<a name="l00066"></a>00066 }
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>
<a name="l00069"></a>00069 <a class="code" href="classhippodraw_1_1TupleCut.html#a0035603802c53109ab0581ac39239932" title="Returns the column index used in the DataSource.">TupleCut::</a>
<a name="l00070"></a><a class="code" href="classhippodraw_1_1TupleCut.html#a0035603802c53109ab0581ac39239932">00070</a> <a class="code" href="classhippodraw_1_1TupleCut.html#a0035603802c53109ab0581ac39239932" title="Returns the column index used in the DataSource.">getColumn</a> ()<span class="keyword"> const</span>
<a name="l00071"></a>00071 <span class="keyword"></span>{
<a name="l00072"></a>00072   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1TupleCut.html#af27a091f84e50b8c3481c6a73c69c7ea" title="The column index used by the cut.">m_column</a>;
<a name="l00073"></a>00073 }
<a name="l00074"></a>00074 
<a name="l00075"></a>00075 <span class="keywordtype">void</span>
<a name="l00076"></a>00076 <a class="code" href="classhippodraw_1_1TupleCut.html#a1c320b45450e1172b1b079f03664d3ef" title="Sets the range of the cut.">TupleCut::</a>
<a name="l00077"></a><a class="code" href="classhippodraw_1_1TupleCut.html#a1c320b45450e1172b1b079f03664d3ef">00077</a> <a class="code" href="classhippodraw_1_1TupleCut.html#a1c320b45450e1172b1b079f03664d3ef" title="Sets the range of the cut.">setRange</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp; range )
<a name="l00078"></a>00078 {
<a name="l00079"></a>00079   <a class="code" href="classhippodraw_1_1TupleCut.html#ae71dd536700e6f5636df8c8728c1383d" title="The Range object used by the cut.">m_range</a> = range;
<a name="l00080"></a>00080 }
<a name="l00081"></a>00081 
<a name="l00082"></a>00082 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp;
<a name="l00083"></a>00083 <a class="code" href="classhippodraw_1_1TupleCut.html#a401b9ceaf58d9b40bb1a926067d1d74f" title="Returns a reference to the range for each dimension.">TupleCut::</a>
<a name="l00084"></a><a class="code" href="classhippodraw_1_1TupleCut.html#a401b9ceaf58d9b40bb1a926067d1d74f">00084</a> <a class="code" href="classhippodraw_1_1TupleCut.html#a401b9ceaf58d9b40bb1a926067d1d74f" title="Returns a reference to the range for each dimension.">getRange</a> ( )<span class="keyword"> const</span>
<a name="l00085"></a>00085 <span class="keyword"></span>{
<a name="l00086"></a>00086   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1TupleCut.html#ae71dd536700e6f5636df8c8728c1383d" title="The Range object used by the cut.">m_range</a>;
<a name="l00087"></a>00087 }
<a name="l00088"></a>00088 
<a name="l00089"></a>00089 <span class="keywordtype">void</span>
<a name="l00090"></a>00090 <a class="code" href="classhippodraw_1_1TupleCut.html#ae080840323307a99ba0b18c5eafc04cf" title="Sets the inversion state to state.">TupleCut::</a>
<a name="l00091"></a><a class="code" href="classhippodraw_1_1TupleCut.html#ae080840323307a99ba0b18c5eafc04cf">00091</a> <a class="code" href="classhippodraw_1_1TupleCut.html#ae080840323307a99ba0b18c5eafc04cf" title="Sets the inversion state to state.">setInversion</a> ( <span class="keywordtype">bool</span> state )
<a name="l00092"></a>00092 {
<a name="l00093"></a>00093   <a class="code" href="classhippodraw_1_1TupleCut.html#a394c8aef0bb77d86943d815b33a3a850" title="The inversion flag.">m_invert</a> = state;
<a name="l00094"></a>00094 }
<a name="l00095"></a>00095 
<a name="l00096"></a>00096 <span class="keywordtype">bool</span>
<a name="l00097"></a>00097 <a class="code" href="classhippodraw_1_1TupleCut.html#aea97b4984052ef147b95bb435d8c5a80" title="Returns the state of the inversion for the axis.">TupleCut::</a>
<a name="l00098"></a><a class="code" href="classhippodraw_1_1TupleCut.html#aea97b4984052ef147b95bb435d8c5a80">00098</a> <a class="code" href="classhippodraw_1_1TupleCut.html#aea97b4984052ef147b95bb435d8c5a80" title="Returns the state of the inversion for the axis.">getInversion</a> ( )<span class="keyword"> const</span>
<a name="l00099"></a>00099 <span class="keyword"></span>{
<a name="l00100"></a>00100   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1TupleCut.html#a394c8aef0bb77d86943d815b33a3a850" title="The inversion flag.">m_invert</a>;
<a name="l00101"></a>00101 }
<a name="l00102"></a>00102 
<a name="l00103"></a><a class="code" href="classhippodraw_1_1TupleCut.html#a987d667f01422e4a7e9070eb775e8ee9">00103</a> <span class="keywordtype">void</span> <a class="code" href="classhippodraw_1_1TupleCut.html#a987d667f01422e4a7e9070eb775e8ee9" title="Toggles the sense of the inversion flag.">TupleCut::toggleInverted</a>()
<a name="l00104"></a>00104 {
<a name="l00105"></a>00105   <a class="code" href="classhippodraw_1_1TupleCut.html#a394c8aef0bb77d86943d815b33a3a850" title="The inversion flag.">m_invert</a> = <a class="code" href="classhippodraw_1_1TupleCut.html#a394c8aef0bb77d86943d815b33a3a850" title="The inversion flag.">m_invert</a> ? <span class="keyword">false</span> : <span class="keyword">true</span>;
<a name="l00106"></a>00106 }
<a name="l00107"></a>00107 
<a name="l00108"></a>00108 <span class="keyword">const</span> std::string &amp;
<a name="l00109"></a>00109 <a class="code" href="classhippodraw_1_1TupleCut.html#ae1370f369a9c1b2b6e850ab544853d9c" title="Returns the label for the cut.">TupleCut::</a>
<a name="l00110"></a><a class="code" href="classhippodraw_1_1TupleCut.html#ae1370f369a9c1b2b6e850ab544853d9c">00110</a> <a class="code" href="classhippodraw_1_1TupleCut.html#ae1370f369a9c1b2b6e850ab544853d9c" title="Returns the label for the cut.">getLabel</a> ()<span class="keyword"> const</span>
<a name="l00111"></a>00111 <span class="keyword"></span>{
<a name="l00112"></a>00112   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1TupleCut.html#ab7e76ef9dc06dddfd04299b034b6e076" title="The label for the cut.">m_label</a>;
<a name="l00113"></a>00113 }
<a name="l00114"></a>00114 
<a name="l00115"></a>00115 <span class="keywordtype">void</span>
<a name="l00116"></a>00116 <a class="code" href="classhippodraw_1_1TupleCut.html#a81f16b68bb21c5d5cc48cb6524f61991" title="Sets the label for the cut.">TupleCut::</a>
<a name="l00117"></a><a class="code" href="classhippodraw_1_1TupleCut.html#a81f16b68bb21c5d5cc48cb6524f61991">00117</a> <a class="code" href="classhippodraw_1_1TupleCut.html#a81f16b68bb21c5d5cc48cb6524f61991" title="Sets the label for the cut.">setLabel</a> ( <span class="keyword">const</span> std::string &amp; label )
<a name="l00118"></a>00118 {
<a name="l00119"></a>00119   <a class="code" href="classhippodraw_1_1TupleCut.html#ab7e76ef9dc06dddfd04299b034b6e076" title="The label for the cut.">m_label</a> = label;
<a name="l00120"></a>00120 }
</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>