diff options
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/logic__variable_8cpp-source.html | 473 |
1 files changed, 473 insertions, 0 deletions
diff --git a/docs/doxygen/nel/logic__variable_8cpp-source.html b/docs/doxygen/nel/logic__variable_8cpp-source.html new file mode 100644 index 00000000..291a7aa2 --- /dev/null +++ b/docs/doxygen/nel/logic__variable_8cpp-source.html @@ -0,0 +1,473 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + <TITLE>nevrax.org : docs</TITLE> + <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css"> + <link href="doxygen.css" rel="stylesheet" type="text/css"> +</HEAD> +<BODY MARGINHEIGHT="0" MARGINWIDTH="0"> + +<!-- uplinks --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD> + </TR> +</TABLE> + +<!-- banner Nevrax --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%> + <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR> +</TABLE> + +<!-- main table --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + + <!------ Begin Box ------> + <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black> + <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF> + <TABLE cellspacing=0 cellpadding=1 border=0> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""> +</td></tr></table> + + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Documentation</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.14 --> +<center> +<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> </center> +<hr><h1>logic_variable.cpp</h1><a href="logic__variable_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00007 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font> +00008 <font class="comment"> *</font> +00009 <font class="comment"> * This file is part of NEVRAX NEL.</font> +00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font> +00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font> +00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font> +00013 <font class="comment"> * any later version.</font> +00014 <font class="comment"></font> +00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font> +00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font> +00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font> +00018 <font class="comment"> * General Public License for more details.</font> +00019 <font class="comment"></font> +00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font> +00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font> +00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font> +00023 <font class="comment"> * MA 02111-1307, USA.</font> +00024 <font class="comment"> */</font> +00025 +00026 +00027 <font class="preprocessor">#include "<a class="code" href="logic__state__machine_8h.html">nel/logic/logic_state_machine.h</a>"</font> +00028 <font class="preprocessor">#include "<a class="code" href="logic__variable_8h.html">nel/logic/logic_variable.h</a>"</font> +00029 +00030 <font class="keyword">using</font> <font class="keyword">namespace </font>std; +00031 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC; +00032 +00033 +00034 <font class="keyword">namespace </font>NLLOGIC +00035 { +00036 +00037 +00038 <font class="comment">//---------------------------------------------------</font> +00039 <font class="comment">// CLogicVariable :</font> +00040 <font class="comment">// </font> +00041 <font class="comment">//---------------------------------------------------</font> +<a name="l00042"></a><a class="code" href="classNLLOGIC_1_1CLogicVariable.html#a0">00042</a> CLogicVariable::CLogicVariable() +00043 { +00044 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = 0; +00045 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n1">_Name</a> = <font class="stringliteral">"unamed_var"</font>; +00046 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n2">_Verbose</a> = <font class="keyword">false</font>; +00047 +00048 } <font class="comment">// CLogicVariable //</font> +00049 +00050 +00051 +00052 <font class="comment">//---------------------------------------------------</font> +00053 <font class="comment">// setValue :</font> +00054 <font class="comment">// </font> +00055 <font class="comment">//---------------------------------------------------</font> +<a name="l00056"></a><a class="code" href="classNLLOGIC_1_1CLogicVariable.html#a3">00056</a> <font class="keywordtype">void</font> CLogicVariable::setValue( <a class="code" href="types__nl_8h.html#a11">sint64</a> value ) +00057 { +00058 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = value; +00059 +00060 <font class="keywordflow">if</font>( _Verbose ) +00061 { +00062 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"variable \"%s\" value is now %f"</font>,<a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n1">_Name</a>.c_str(),(double)<a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a>); +00063 } +00064 +00065 } <font class="comment">// setValue //</font> +00066 +00067 +00068 +00069 <font class="comment">//---------------------------------------------------</font> +00070 <font class="comment">// applyModification :</font> +00071 <font class="comment">// </font> +00072 <font class="comment">//---------------------------------------------------</font> +<a name="l00073"></a><a class="code" href="classNLLOGIC_1_1CLogicVariable.html#a6">00073</a> <font class="keywordtype">void</font> CLogicVariable::applyModification( string op, <a class="code" href="types__nl_8h.html#a11">sint64</a> value ) +00074 { +00075 <font class="keywordflow">if</font>( op == <font class="stringliteral">"SET"</font> || op == <font class="stringliteral">"set"</font> ) +00076 { +00077 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = value; +00078 } +00079 <font class="keywordflow">else</font> +00080 <font class="keywordflow">if</font>( op == <font class="stringliteral">"ADD"</font> || op == <font class="stringliteral">"add"</font> ) +00081 { +00082 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> += value; +00083 } +00084 <font class="keywordflow">else</font> +00085 <font class="keywordflow">if</font>( op == <font class="stringliteral">"SUB"</font> || op == <font class="stringliteral">"sub"</font> ) +00086 { +00087 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> -= value; +00088 } +00089 <font class="keywordflow">else</font> +00090 <font class="keywordflow">if</font>( op == <font class="stringliteral">"MUL"</font> || op == <font class="stringliteral">"mul"</font>) +00091 { +00092 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> *= value; +00093 } +00094 <font class="keywordflow">else</font> +00095 <font class="keywordflow">if</font>( op == <font class="stringliteral">"DIV"</font> || op == <font class="stringliteral">"div"</font>) +00096 { +00097 <font class="keywordflow">if</font>( value != 0 ) <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> /= value; +00098 } +00099 <font class="keywordflow">else</font> +00100 { +00101 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"(LGCS)<CLogicVariable::applyModification> The operator \"%s\" is unknown"</font>,op.c_str()); +00102 <font class="keywordflow">return</font>; +00103 } +00104 +00105 <font class="keywordflow">if</font>( _Verbose ) +00106 { +00107 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"variable \"%s\" value is now %f"</font>,<a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n1">_Name</a>.c_str(),(double)<a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a>); +00108 } +00109 +00110 } <font class="comment">// applyModification //</font> +00111 +00112 +00113 <font class="comment">//---------------------------------------------------</font> +00114 <font class="comment">// processLogic :</font> +00115 <font class="comment">// </font> +00116 <font class="comment">//---------------------------------------------------</font> +<a name="l00117"></a><a class="code" href="classNLLOGIC_1_1CLogicVariable.html#a7">00117</a> <font class="keywordtype">void</font> CLogicVariable::processLogic() +00118 { +00119 +00120 +00121 } <font class="comment">// processLogic //</font> +00122 +00123 +00124 <font class="comment">//---------------------------------------------------</font> +00125 <font class="comment">// serial :</font> +00126 <font class="comment">// </font> +00127 <font class="comment">//---------------------------------------------------</font> +00128 <font class="comment">/*void CLogicVariable::serial( IStream &f )</font> +00129 <font class="comment">{</font> +00130 <font class="comment"> f.xmlPush( "VARIABLE");</font> +00131 <font class="comment"></font> +00132 <font class="comment"> f.serial( _Value );</font> +00133 <font class="comment"> f.serial( _Name );</font> +00134 <font class="comment"></font> +00135 <font class="comment"> f.xmlPop();</font> +00136 <font class="comment"></font> +00137 <font class="comment">} // serial //*/</font> +00138 +<a name="l00139"></a><a class="code" href="classNLLOGIC_1_1CLogicVariable.html#a8">00139</a> <font class="keywordtype">void</font> CLogicVariable::write (xmlNodePtr node)<font class="keyword"> const</font> +00140 <font class="keyword"></font>{ +00141 xmlNodePtr elmPtr = xmlNewChild ( node, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"VARIABLE"</font>, NULL); +00142 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Name"</font>, (<font class="keyword">const</font> xmlChar*)<a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n1">_Name</a>.c_str()); +00143 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Value"</font>, (<font class="keyword">const</font> xmlChar*)toString(_Value).c_str()); +00144 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Verbose"</font>, (<font class="keyword">const</font> xmlChar*)toString(_Verbose).c_str()); +00145 } +00146 +<a name="l00147"></a><a class="code" href="classNLLOGIC_1_1CLogicVariable.html#a9">00147</a> <font class="keywordtype">void</font> CLogicVariable::read (xmlNodePtr node) +00148 { +00149 <a class="code" href="namespaceNLLOGIC.html#a1">xmlCheckNodeName</a> (node, <font class="stringliteral">"VARIABLE"</font>); +00150 +00151 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n1">_Name</a> = <a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Name"</font>); +00152 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = atoiInt64 (<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Value"</font>).c_str()); +00153 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n2">_Verbose</a> = atoi(<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Verbose"</font>).c_str()) == 1; +00154 } +00155 +00156 <font class="comment">//---------------------------------------------------</font> +00157 <font class="comment">// CLogicCounter :</font> +00158 <font class="comment">// </font> +00159 <font class="comment">//---------------------------------------------------</font> +<a name="l00160"></a><a class="code" href="classNLLOGIC_1_1CLogicCounter.html#a0">00160</a> CLogicCounter::CLogicCounter() +00161 { +00162 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#o0">_TickCount</a> = 0; +00163 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = 0; +00164 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n1">_Name</a> = <font class="stringliteral">"unamed_counter"</font>; +00165 +00166 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m0">Period</a>.setValue( 10 ); +00167 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m0">Period</a>.setName(<font class="stringliteral">"Period"</font>); +00168 +00169 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m1">Phase</a>.setValue( 0 ); +00170 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m1">Phase</a>.setName(<font class="stringliteral">"Phase"</font>); +00171 +00172 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m2">Step</a>.setValue( 1 ); +00173 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m2">Step</a>.setName(<font class="stringliteral">"Step"</font>); +00174 +00175 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.setValue( 0 ); +00176 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.setName(<font class="stringliteral">"LowLimit"</font>); +00177 +00178 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.setValue( 100 ); +00179 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.setName(<font class="stringliteral">"HighLimit"</font>); +00180 +00181 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m5">Mode</a>.setValue( <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#s9s0">STOP_AT_LIMIT</a> ); +00182 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m5">Mode</a>.setName(<font class="stringliteral">"Mode"</font>); +00183 +00184 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m6">Control</a>.setValue( <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#s10s6">RUN</a> ); +00185 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m6">Control</a>.setName(<font class="stringliteral">"Control"</font>); +00186 +00187 } <font class="comment">// CLogicCounter //</font> +00188 +00189 +00190 <font class="comment">//---------------------------------------------------</font> +00191 <font class="comment">// update :</font> +00192 <font class="comment">// </font> +00193 <font class="comment">//---------------------------------------------------</font> +<a name="l00194"></a><a class="code" href="classNLLOGIC_1_1CLogicCounter.html#a1">00194</a> <font class="keywordtype">void</font> CLogicCounter::update() +00195 { +00196 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m6">Control</a>.getValue() == <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#s10s5">STOPPED</a> ) +00197 { +00198 <font class="keywordflow">return</font>; +00199 } +00200 +00201 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#o0">_TickCount</a>++; +00202 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#o0">_TickCount</a> < <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m0">Period</a>.getValue() ) +00203 { +00204 <font class="keywordflow">return</font>; +00205 } +00206 <font class="keywordflow">else</font> +00207 { +00208 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#o0">_TickCount</a> = 0; +00209 } +00210 +00211 <font class="keywordflow">switch</font>( <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m6">Control</a>.getValue() ) +00212 { +00213 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#s10s6">RUN</a> : +00214 { +00215 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> += <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m2">Step</a>.getValue(); +00216 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#a2">manageRunningMode</a>(); +00217 } +00218 <font class="keywordflow">break</font>; +00219 +00220 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#s10s7">REWIND</a> : +00221 { +00222 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue(); +00223 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m6">Control</a>.setValue( <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#s10s6">RUN</a> ); +00224 } +00225 <font class="keywordflow">break</font>; +00226 +00227 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#s10s8">FAST_FORWARD</a> : +00228 { +00229 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue(); +00230 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m6">Control</a>.setValue( <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#s10s6">RUN</a> ); +00231 } +00232 <font class="keywordflow">break</font>; +00233 +00234 } +00235 +00236 <font class="keywordflow">if</font>( _Verbose ) +00237 { +00238 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"variable \"%s\" value is now %f"</font>,<a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n1">_Name</a>.c_str(),(double)<a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a>); +00239 } +00240 +00241 } <font class="comment">// update //</font> +00242 +00243 +00244 <font class="comment">//---------------------------------------------------</font> +00245 <font class="comment">// manageRunningMode :</font> +00246 <font class="comment">// </font> +00247 <font class="comment">//---------------------------------------------------</font> +<a name="l00248"></a><a class="code" href="classNLLOGIC_1_1CLogicCounter.html#a2">00248</a> <font class="keywordtype">void</font> CLogicCounter::manageRunningMode() +00249 { +00250 <font class="comment">// loop on one value</font> +00251 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue() == <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue() ) +00252 { +00253 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue(); +00254 <font class="keywordflow">return</font>; +00255 } +00256 +00257 <font class="keywordflow">switch</font>( <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m5">Mode</a>.getValue() ) +00258 { +00259 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#s9s0">STOP_AT_LIMIT</a> : +00260 { +00261 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> > <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue() ) +00262 { +00263 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue(); +00264 } +00265 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> < <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue() ) +00266 { +00267 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue(); +00268 } +00269 } +00270 <font class="keywordflow">break</font>; +00271 +00272 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#s9s1">LOOP</a> : +00273 { +00274 <font class="comment">// value is higher than high limit</font> +00275 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> > <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue() ) +00276 { +00277 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue() + <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> - <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue() - 1; +00278 } +00279 <font class="comment">// value is lower than low limit</font> +00280 <font class="keywordflow">else</font> +00281 { +00282 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> < <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue() ) +00283 { +00284 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue() - (<a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue() -<a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a>) + 1; +00285 } +00286 } +00287 } +00288 <font class="keywordflow">break</font>; +00289 +00290 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#s9s2">SHUTTLE</a> : +00291 { +00292 <font class="comment">// value is higher than high limit</font> +00293 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> > <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue() ) +00294 { +00295 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue() - (<a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> - <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue()); +00296 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m2">Step</a>.setValue( -<a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m2">Step</a>.getValue() ); +00297 } +00298 <font class="comment">// value is lower than low limit</font> +00299 <font class="keywordflow">else</font> +00300 { +00301 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> < <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue() ) +00302 { +00303 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue() + <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue() - <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a>; +00304 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m2">Step</a>.setValue( -<a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m2">Step</a>.getValue() ); +00305 } +00306 } +00307 } +00308 <font class="keywordflow">break</font>; +00309 +00310 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#s9s3">DOWN_UP</a> : +00311 { +00312 <font class="comment">// low limit reached, we go up</font> +00313 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> < <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue() ) +00314 { +00315 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue() + <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue() - <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a>; +00316 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m2">Step</a>.setValue( -<a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m2">Step</a>.getValue() ); +00317 } +00318 <font class="keywordflow">else</font> +00319 { +00320 <font class="comment">// high limit reached we stop</font> +00321 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> > <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue() ) +00322 { +00323 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue(); +00324 } +00325 } +00326 } +00327 <font class="keywordflow">break</font>; +00328 +00329 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#s9s4">UP_DOWN</a> : +00330 { +00331 <font class="comment">// high limit reached, we go down</font> +00332 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> > <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue() ) +00333 { +00334 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue() - (<a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> - <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue()); +00335 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m2">Step</a>.setValue( -<a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m2">Step</a>.getValue() ); +00336 } +00337 <font class="keywordflow">else</font> +00338 { +00339 <font class="comment">// low limit reached, we stop</font> +00340 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> < <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue() ) +00341 { +00342 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue(); +00343 } +00344 } +00345 } +00346 } +00347 +00348 } <font class="comment">// manageRunningMode //</font> +00349 +00350 +00351 <font class="comment">//---------------------------------------------------</font> +00352 <font class="comment">// serial :</font> +00353 <font class="comment">// </font> +00354 <font class="comment">//---------------------------------------------------</font> +00355 <font class="comment">/*void CLogicCounter::serial( IStream &f )</font> +00356 <font class="comment">{</font> +00357 <font class="comment"> f.xmlPush( "COUNTER");</font> +00358 <font class="comment"></font> +00359 <font class="comment"> f.serial( _Value );</font> +00360 <font class="comment"> f.serial( _Name );</font> +00361 <font class="comment"> f.serial( Period );</font> +00362 <font class="comment"> f.serial( Phase );</font> +00363 <font class="comment"> f.serial( Step );</font> +00364 <font class="comment"> f.serial( LowLimit );</font> +00365 <font class="comment"> f.serial( HighLimit );</font> +00366 <font class="comment"> f.serial( Mode );</font> +00367 <font class="comment"></font> +00368 <font class="comment"> f.xmlPop();</font> +00369 <font class="comment"></font> +00370 <font class="comment">} // serial //*/</font> +00371 +<a name="l00372"></a><a class="code" href="classNLLOGIC_1_1CLogicCounter.html#a3">00372</a> <font class="keywordtype">void</font> CLogicCounter::write (xmlNodePtr node)<font class="keyword"> const</font> +00373 <font class="keyword"></font>{ +00374 xmlNodePtr elmPtr = xmlNewChild ( node, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"COUNTER"</font>, NULL); +00375 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Name"</font>, (<font class="keyword">const</font> xmlChar*)<a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n1">_Name</a>.c_str()); +00376 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Value"</font>, (<font class="keyword">const</font> xmlChar*)toString(_Value).c_str()); +00377 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Verbose"</font>, (<font class="keyword">const</font> xmlChar*)toString(_Verbose).c_str()); +00378 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Period"</font>, (<font class="keyword">const</font> xmlChar*)toString(<a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m0">Period</a>.getValue()).c_str()); +00379 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Phase"</font>, (<font class="keyword">const</font> xmlChar*)toString(<a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m1">Phase</a>.getValue()).c_str()); +00380 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Step"</font>, (<font class="keyword">const</font> xmlChar*)toString(<a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m2">Step</a>.getValue()).c_str()); +00381 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"LowLimit"</font>, (<font class="keyword">const</font> xmlChar*)toString(<a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.getValue()).c_str()); +00382 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"HighLimit"</font>, (<font class="keyword">const</font> xmlChar*)toString(<a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.getValue()).c_str()); +00383 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Mode"</font>, (<font class="keyword">const</font> xmlChar*)toString(<a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m5">Mode</a>.getValue()).c_str()); +00384 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Control"</font>, (<font class="keyword">const</font> xmlChar*)toString(<a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m6">Control</a>.getValue()).c_str()); +00385 } +00386 +<a name="l00387"></a><a class="code" href="classNLLOGIC_1_1CLogicCounter.html#a4">00387</a> <font class="keywordtype">void</font> CLogicCounter::read (xmlNodePtr node) +00388 { +00389 <a class="code" href="namespaceNLLOGIC.html#a1">xmlCheckNodeName</a> (node, <font class="stringliteral">"COUNTER"</font>); +00390 +00391 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n1">_Name</a> = <a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Name"</font>); +00392 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n0">_Value</a> = atoiInt64 (<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Value"</font>).c_str()); +00393 <a class="code" href="classNLLOGIC_1_1CLogicVariable.html#n2">_Verbose</a> = atoi(<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Verbose"</font>).c_str()) == 1; +00394 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m0">Period</a>.setValue(atoiInt64(<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Period"</font>).c_str())); +00395 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m1">Phase</a>.setValue(atoiInt64(<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Phase"</font>).c_str())); +00396 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m2">Step</a>.setValue(atoiInt64(<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Step"</font>).c_str())); +00397 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m3">LowLimit</a>.setValue(atoiInt64(<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"LowLimit"</font>).c_str())); +00398 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m4">HighLimit</a>.setValue(atoiInt64(<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"HighLimit"</font>).c_str())); +00399 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m5">Mode</a>.setValue(atoiInt64(<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Mode"</font>).c_str())); +00400 <a class="code" href="classNLLOGIC_1_1CLogicCounter.html#m6">Control</a>.setValue(atoiInt64(<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Control"</font>).c_str())); +00401 } +00402 +00403 +00404 } +</pre></div> + +<!-- footer --> +<BR><FONT Size=+5> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML> |