NLLOGIC::CLogicCondition Class Reference

#include <logic_condition.h>


Detailed Description

CLogicCondition

Author:
Stephane Coutelas

Nevrax France

Date:
2001

Definition at line 272 of file logic_condition.h.

Public Member Functions

void addNode (CLogicConditionNode node)
 CLogicCondition ()
void fillVarSet (std::set< std::string > &condVars)
std::string getName () const
void read (xmlNodePtr node)
void setLogicStateMachine (CLogicStateMachine *logicStateMachine)
void setName (std::string name)
bool testLogic ()
void write (xmlNodePtr node) const

Data Fields

std::vector< CLogicConditionNodeNodes
 condition tree


Private Attributes

std::string _ConditionName
 condition name


Constructor & Destructor Documentation

NLLOGIC::CLogicCondition::CLogicCondition  )  [inline]
 

CLogicCondition

Definition at line 285 of file logic_condition.h.

References _ConditionName.

00286         {
00287                 _ConditionName = "no_condition";
00288         }


Member Function Documentation

void NLLOGIC::CLogicCondition::addNode CLogicConditionNode  node  )  [inline]
 

Add a condition node

Parameters:
node is the new node to add

Definition at line 316 of file logic_condition.h.

00316 { Nodes.push_back( node ); }

void NLLOGIC::CLogicCondition::fillVarSet std::set< std::string > &  condVars  ) 
 

Fill a set with all the variables name referenced by this condition

Parameters:
condVars is a set to store the variable names

Definition at line 571 of file logic_condition.cpp.

00572 {
00573         vector<CLogicConditionNode>::iterator itNode;
00574         for( itNode = Nodes.begin(); itNode != Nodes.end(); ++itNode )
00575         {
00576                 (*itNode).fillVarSet( condVars );
00577         }
00578 
00579 } // fillVarSet //

std::string NLLOGIC::CLogicCondition::getName void   )  const [inline]
 

Get the condition's name

Returns:
the condition's name

Definition at line 309 of file logic_condition.h.

References _ConditionName.

00309 {       return _ConditionName; }

void NLLOGIC::CLogicCondition::read xmlNodePtr  node  ) 
 

Definition at line 610 of file logic_condition.cpp.

References _ConditionName, NLLOGIC::getXMLProp(), uint, v, and NLLOGIC::xmlCheckNodeName().

00611 {
00612         xmlCheckNodeName (node, "CONDITION");
00613 
00614         _ConditionName = getXMLProp (node, "Name");
00615 
00616         {
00617                 // Count the parent
00618                 uint nb = CIXml::countChildren (node, "CONDITION_NODE");
00619                 uint i = 0;
00620                 xmlNodePtr parent = CIXml::getFirstChildNode (node, "CONDITION_NODE");
00621                 while (i<nb)
00622                 {
00623                         CLogicConditionNode v;
00624                         v.read(parent);
00625                         Nodes.push_back (v);
00626 
00627                         // Next parent
00628                         parent = CIXml::getNextChildNode (parent, "CONDITION_NODE");
00629                         i++;
00630                 }
00631         }
00632 }

void NLLOGIC::CLogicCondition::setLogicStateMachine CLogicStateMachine logicStateMachine  ) 
 

Set the logic state machine

Parameters:
logicStateMachine is the state machine containing this block

Definition at line 527 of file logic_condition.cpp.

References nlwarning.

00528 { 
00529         if( logicStateMachine == 0 )
00530         {
00531                 nlwarning("(LOGIC)<CLogicCondition::setLogicStateMachine> The state machine is null");
00532         }
00533         else
00534         {
00535                 // init the logic state machine for each node
00536                 vector<CLogicConditionNode>::iterator itNodes;
00537                 for( itNodes = Nodes.begin(); itNodes != Nodes.end(); ++itNodes )
00538                 {
00539                         (*itNodes).setLogicStateMachine( logicStateMachine );
00540                 }
00541         }
00542 
00543 } // setLogicStateMachine //

void NLLOGIC::CLogicCondition::setName std::string  name  )  [inline]
 

Set the condition's name

Parameters:
name is the condition's name

Definition at line 302 of file logic_condition.h.

References _ConditionName.

00302 { _ConditionName = name; }

bool NLLOGIC::CLogicCondition::testLogic  ) 
 

Test the condition

Returns:
true if this condition is fulfiled, false else

Definition at line 550 of file logic_condition.cpp.

Referenced by NLLOGIC::CLogicEvent::testCondition().

00551 {
00552         vector<CLogicConditionNode>::iterator itNodes;
00553         for( itNodes = Nodes.begin(); itNodes != Nodes.end(); ++itNodes )
00554         {
00555                 if( (*itNodes).testLogic() == false )
00556                 {
00557                         return false;
00558                 }
00559         }
00560 
00561         return true;
00562 
00563 } // testLogic //

void NLLOGIC::CLogicCondition::write xmlNodePtr  node  )  const
 

serial

Definition at line 598 of file logic_condition.cpp.

References _ConditionName, and uint.

00599 {
00600         xmlNodePtr elmPtr = xmlNewChild ( node, NULL, (const xmlChar*)"CONDITION", NULL);
00601         xmlSetProp (elmPtr, (const xmlChar*)"Name", (const xmlChar*)_ConditionName.c_str());
00602 
00603         uint i;
00604         for (i = 0; i < Nodes.size(); i++)
00605         {
00606                 Nodes[i].write(elmPtr);
00607         }
00608 }


Field Documentation

std::string NLLOGIC::CLogicCondition::_ConditionName [private]
 

condition name

Definition at line 275 of file logic_condition.h.

Referenced by CLogicCondition(), getName(), read(), setName(), and write().

std::vector<CLogicConditionNode> NLLOGIC::CLogicCondition::Nodes
 

condition tree

Definition at line 280 of file logic_condition.h.


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 12:53:01 2004 for NeL by doxygen 1.3.6