NLLOGIC::CLogicEvent Class Reference

#include <logic_event.h>


Detailed Description

CLogicEvent

Author:
Stephane Coutelas

Nevrax France

Date:
2001

Definition at line 149 of file logic_event.h.

Public Member Functions

 CLogicEvent ()
void read (xmlNodePtr node)
void reset ()
void setLogicStateMachine (CLogicStateMachine *logicStateMachine)
bool testCondition ()
void write (xmlNodePtr node) const

Data Fields

std::string ConditionName
 condition name

CLogicEventAction EventAction
 event action


Private Attributes

CLogicStateMachine_LogicStateMachine
 state machine managing this event


Constructor & Destructor Documentation

NLLOGIC::CLogicEvent::CLogicEvent  )  [inline]
 

Default constructor

Definition at line 165 of file logic_event.h.

References ConditionName.

00166         {
00167                 _LogicStateMachine = 0;
00168                 ConditionName = "no_condition";
00169         }


Member Function Documentation

void NLLOGIC::CLogicEvent::read xmlNodePtr  node  ) 
 

Definition at line 250 of file logic_event.cpp.

References ConditionName, EventAction, NLLOGIC::getXMLProp(), NLLOGIC::CLogicEventAction::read(), and NLLOGIC::xmlCheckNodeName().

00251 {
00252         xmlCheckNodeName (node, "EVENT");
00253 
00254         ConditionName = getXMLProp (node, "ConditionName");
00255         EventAction.read(node);
00256 }

void NLLOGIC::CLogicEvent::reset  ) 
 

Reset this event

Definition at line 162 of file logic_event.cpp.

References EventAction, NLLOGIC::CLogicEventAction::EventMessage, NLLOGIC::CLogicEventMessage::Sent, and NLLOGIC::CLogicEventMessage::ToSend.

00163 { 
00164         EventAction.EventMessage.Sent = false;
00165         EventAction.EventMessage.ToSend = false;
00166 
00167 } // reset //

void NLLOGIC::CLogicEvent::setLogicStateMachine CLogicStateMachine logicStateMachine  ) 
 

Set the logic state machine

Parameters:
logicStateMachine is the state machine containing this block

Definition at line 175 of file logic_event.cpp.

References nlwarning.

Referenced by NLLOGIC::CLogicState::addEvent().

00176 { 
00177         if( logicStateMachine == 0 )
00178         {
00179                 nlwarning("(LOGIC)<CLogicEvent::setLogicStateMachine> The state machine is null");
00180         }
00181         else
00182         {
00183                 // init the logic state machine for this event
00184                 _LogicStateMachine = logicStateMachine;
00185         }
00186 
00187 } // setLogicStateMachine //

bool NLLOGIC::CLogicEvent::testCondition  ) 
 

Test the condition

Returns:
true if condition is fulfiled

Definition at line 195 of file logic_event.cpp.

References ConditionName, NLLOGIC::CLogicStateMachine::getCondition(), nlwarning, and NLLOGIC::CLogicCondition::testLogic().

00196 {
00197         if( _LogicStateMachine )
00198         {
00199                 if( ConditionName != "no_condition" )
00200                 {
00201                         CLogicCondition cond;
00202                         if( _LogicStateMachine->getCondition( ConditionName, cond ) )
00203                         {
00204                                 return cond.testLogic();
00205                         }
00206                         else
00207                         {
00208                                 nlwarning("(LOGIC)<CLogicEvent::testCondition> Condition %s not found in the state machine",ConditionName.c_str());     
00209                                 return false;
00210                         }
00211                 }
00212                 else
00213                 {
00214                         nlwarning("(LOGIC)<CLogicEvent::testCondition> Condition undefined");   
00215                         return false;
00216                 }
00217         }
00218         else
00219         {
00220                 nlwarning("(LOGIC)<CLogicEvent::testCondition> The state machine managing this event is Null");
00221         }
00222         
00223         return false;   
00224 
00225 } // testCondition //

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

serial

Definition at line 243 of file logic_event.cpp.

References ConditionName, EventAction, and NLLOGIC::CLogicEventAction::write().

00244 {
00245         xmlNodePtr elmPtr = xmlNewChild ( node, NULL, (const xmlChar*)"EVENT", NULL);
00246         xmlSetProp (elmPtr, (const xmlChar*)"ConditionName", (const xmlChar*)ConditionName.c_str());
00247         EventAction.write(elmPtr);
00248 }


Field Documentation

CLogicStateMachine* NLLOGIC::CLogicEvent::_LogicStateMachine [private]
 

state machine managing this event

Definition at line 152 of file logic_event.h.

std::string NLLOGIC::CLogicEvent::ConditionName
 

condition name

Definition at line 157 of file logic_event.h.

Referenced by CLogicEvent(), read(), testCondition(), and write().

CLogicEventAction NLLOGIC::CLogicEvent::EventAction
 

event action

Definition at line 160 of file logic_event.h.

Referenced by read(), reset(), and write().


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