#include <logic_condition.h>
Nevrax France
Definition at line 47 of file logic_condition.h.
Public Member Functions | |
CLogicComparisonBlock () | |
void | read (xmlNodePtr node) |
void | setLogicStateMachine (CLogicStateMachine *logicStateMachine) |
bool | testLogic () |
void | write (xmlNodePtr node) const |
Data Fields | |
sint64 | Comparand |
comparand | |
std::string | Operator |
comparison operator | |
std::string | VariableName |
variable name | |
Private Attributes | |
CLogicStateMachine * | _LogicStateMachine |
state machine managing this comparison block |
|
Default constructor Definition at line 66 of file logic_condition.h. References _LogicStateMachine, Comparand, Operator, and VariableName.
00067 { 00068 _LogicStateMachine = 0; 00069 VariableName = "no_name"; 00070 Operator = ">"; 00071 Comparand = 0; 00072 } |
|
Definition at line 107 of file logic_condition.cpp. References Comparand, NLLOGIC::getXMLProp(), Operator, VariableName, and NLLOGIC::xmlCheckNodeName(). Referenced by NLLOGIC::CLogicConditionLogicBlock::read().
00108 { 00109 xmlCheckNodeName (node, "COMPARISON_BLOCK"); 00110 00111 VariableName = getXMLProp (node, "VariableName"); 00112 Operator = getXMLProp (node, "Operator"); 00113 Comparand = atoiInt64(getXMLProp (node, "Comparand").c_str()); 00114 } |
|
Set the logic state machine
Definition at line 43 of file logic_condition.cpp. References _LogicStateMachine, and nlwarning. Referenced by NLLOGIC::CLogicConditionLogicBlock::setLogicStateMachine().
00044 { 00045 if( logicStateMachine == 0 ) 00046 { 00047 nlwarning("(LOGIC)<CLogicComparisonBlock::setLogicStateMachine> The state machine is null"); 00048 } 00049 else 00050 { 00051 _LogicStateMachine = logicStateMachine; 00052 } 00053 00054 } // setLogicStateMachine // |
|
Test the condition
Definition at line 61 of file logic_condition.cpp. References _LogicStateMachine, Comparand, NLLOGIC::CLogicVariable::getValue(), NLLOGIC::CLogicStateMachine::getVariable(), nlwarning, Operator, and VariableName. Referenced by NLLOGIC::CLogicConditionLogicBlock::testLogic().
00062 { 00063 CLogicVariable var; 00064 if( _LogicStateMachine->getVariable( VariableName, var ) == false ) 00065 { 00066 nlwarning("(LOGIC)<CLogicComparisonBlock::testLogic> The variable %s is unknown in the state machine",VariableName.c_str()); 00067 return false; 00068 } 00069 00070 if( Operator == "<" ) return ( var.getValue() < Comparand ); 00071 if( Operator == "<=" ) return ( var.getValue() <= Comparand ); 00072 if( Operator == ">" ) return ( var.getValue() > Comparand ); 00073 if( Operator == ">=" ) return ( var.getValue() >= Comparand ); 00074 if( Operator == "==" ) return ( var.getValue() == Comparand ); 00075 if( Operator == "!=" ) return ( var.getValue() != Comparand ); 00076 00077 nlwarning("(LOGIC)<CLogicComparisonBlock::testLogic> The comparison block operator %s is unknown",Operator.c_str()); 00078 return false; 00079 00080 } // testLogic // |
|
serial Definition at line 99 of file logic_condition.cpp. References Comparand, Operator, and VariableName. Referenced by NLLOGIC::CLogicConditionLogicBlock::write().
00100 { 00101 xmlNodePtr elmPtr = xmlNewChild ( node, NULL, (const xmlChar*)"COMPARISON_BLOCK", NULL); 00102 xmlSetProp (elmPtr, (const xmlChar*)"VariableName", (const xmlChar*)VariableName.c_str()); 00103 xmlSetProp (elmPtr, (const xmlChar*)"Operator", (const xmlChar*)Operator.c_str()); 00104 xmlSetProp (elmPtr, (const xmlChar*)"Comparand", (const xmlChar*)toString(Comparand).c_str()); 00105 } |
|
state machine managing this comparison block
Definition at line 50 of file logic_condition.h. Referenced by CLogicComparisonBlock(), setLogicStateMachine(), and testLogic(). |
|
comparand
Definition at line 61 of file logic_condition.h. Referenced by CLogicComparisonBlock(), read(), testLogic(), and write(). |
|
comparison operator
Definition at line 58 of file logic_condition.h. Referenced by CLogicComparisonBlock(), read(), testLogic(), and write(). |
|
variable name
Definition at line 55 of file logic_condition.h. Referenced by CLogicComparisonBlock(), NLLOGIC::CLogicConditionLogicBlock::fillVarSet(), read(), testLogic(), and write(). |