#include <logic_variable.h>
Inheritance diagram for NLLOGIC::CLogicVariable:

Nevrax France
Definition at line 44 of file logic_variable.h.
Public Member Functions | |
| void | applyModification (std::string op, sint64 value) |
| CLogicVariable () | |
| std::string | getName () const |
| sint64 | getValue () const |
| virtual void | processLogic () |
| virtual void | read (xmlNodePtr node) |
| void | setName (std::string name) |
| void | setValue (sint64 value) |
| void | setVerbose (bool b) |
| virtual void | write (xmlNodePtr node) const |
Protected Attributes | |
| std::string | _Name |
| variable name | |
| sint64 | _Value |
| variable value | |
| bool | _Verbose |
| true if verbose mode is active | |
|
|
Default constructor Definition at line 42 of file logic_variable.cpp. References _Verbose.
|
|
||||||||||||
|
Apply modifications on a variable
Definition at line 73 of file logic_variable.cpp. References _Verbose, nlinfo, nlwarning, sint64, and value.
00074 {
00075 if( op == "SET" || op == "set" )
00076 {
00077 _Value = value;
00078 }
00079 else
00080 if( op == "ADD" || op == "add" )
00081 {
00082 _Value += value;
00083 }
00084 else
00085 if( op == "SUB" || op == "sub" )
00086 {
00087 _Value -= value;
00088 }
00089 else
00090 if( op == "MUL" || op == "mul")
00091 {
00092 _Value *= value;
00093 }
00094 else
00095 if( op == "DIV" || op == "div")
00096 {
00097 if( value != 0 ) _Value /= value;
00098 }
00099 else
00100 {
00101 nlwarning("(LGCS)<CLogicVariable::applyModification> The operator \"%s\" is unknown",op.c_str());
00102 return;
00103 }
00104
00105 if( _Verbose )
00106 {
00107 nlinfo("variable \"%s\" value is now %f",_Name.c_str(),(double)_Value);
00108 }
00109
00110 } // applyModification //
|
|
|
Get the variable name
Definition at line 76 of file logic_variable.h. Referenced by NLLOGIC::CLogicStateMachine::addCounter(), and NLLOGIC::CLogicStateMachine::addVariable().
00076 { return _Name; }
|
|
|
Get the variable value
Definition at line 90 of file logic_variable.h. References sint64. Referenced by NLLOGIC::CLogicCounter::manageRunningMode(), NLLOGIC::CLogicComparisonBlock::testLogic(), NLLOGIC::CLogicCounter::update(), and NLLOGIC::CLogicCounter::write().
00090 { return _Value; }
|
|
|
update the variable Definition at line 117 of file logic_variable.cpp.
00118 {
00119
00120
00121 } // processLogic //
|
|
|
Reimplemented in NLLOGIC::CLogicCounter. Definition at line 147 of file logic_variable.cpp. References _Verbose, NLLOGIC::getXMLProp(), and NLLOGIC::xmlCheckNodeName().
00148 {
00149 xmlCheckNodeName (node, "VARIABLE");
00150
00151 _Name = getXMLProp (node, "Name");
00152 _Value = atoiInt64 (getXMLProp (node, "Value").c_str());
00153 _Verbose = atoi(getXMLProp (node, "Verbose").c_str()) == 1;
00154 }
|
|
|
Set the variable name
Definition at line 69 of file logic_variable.h. Referenced by NLLOGIC::CLogicCounter::CLogicCounter().
00069 { _Name = name; }
|
|
|
Set the variable value
Definition at line 56 of file logic_variable.cpp. References _Verbose, nlinfo, sint64, and value. Referenced by NLLOGIC::CLogicCounter::CLogicCounter(), NLLOGIC::CLogicCounter::manageRunningMode(), NLLOGIC::CLogicCounter::read(), and NLLOGIC::CLogicCounter::update().
|
|
|
Set the verbose mode active or inactive
Definition at line 98 of file logic_variable.h. References _Verbose.
00098 { _Verbose = b; }
|
|
|
serial Reimplemented in NLLOGIC::CLogicCounter. Definition at line 139 of file logic_variable.cpp. References _Verbose.
00140 {
00141 xmlNodePtr elmPtr = xmlNewChild ( node, NULL, (const xmlChar*)"VARIABLE", NULL);
00142 xmlSetProp (elmPtr, (const xmlChar*)"Name", (const xmlChar*)_Name.c_str());
00143 xmlSetProp (elmPtr, (const xmlChar*)"Value", (const xmlChar*)toString(_Value).c_str());
00144 xmlSetProp (elmPtr, (const xmlChar*)"Verbose", (const xmlChar*)toString(_Verbose).c_str());
00145 }
|
|
|
variable name
Definition at line 52 of file logic_variable.h. |
|
|
variable value
Definition at line 49 of file logic_variable.h. |
|
|
true if verbose mode is active
Definition at line 55 of file logic_variable.h. Referenced by applyModification(), CLogicVariable(), read(), setValue(), setVerbose(), and write(). |
1.3.6