Version: 8.3.0
YACS::ENGINE::OutGate Class Reference

#include <OutGate.hxx>

Inheritance diagram for YACS::ENGINE::OutGate:
Collaboration diagram for YACS::ENGINE::OutGate:

Public Member Functions

 OutGate (Node *node)
 
std::string getNameOfTypeOfCurrentInstance () const
 
void exReset ()
 
void exNotifyDone ()
 Notify this port that its node is finished. More...
 
void exNotifyFailed ()
 Notify this port that its node has failed. More...
 
void exNotifyDisabled ()
 Notify this port that its node has been disabled. More...
 
void edDisconnectAllLinksFromMe ()
 
bool edAddInGate (InGate *inGate)
 
std::list< std::pair< InGate
*, bool > > & 
edMapInGate ()
 
std::list< InGate * > edSetInGate () const
 
void edRemoveInGate (InGate *inGate, bool coherenceWithInGate=true) throw (Exception)
 
int getNbOfInGatesConnected () const
 
bool isAlreadyInSet (InGate *inGate) const
 
virtual std::string typeName ()
 
- Public Member Functions inherited from YACS::ENGINE::Port
virtual ~Port ()
 
NodegetNode () const
 
int getNumId () const
 
void modified ()
 

Static Public Attributes

static const char NAME [] ="OutGate"
 

Protected Member Functions

void edRemoveInGateOneWay (InGate *inGate)
 
- Protected Member Functions inherited from YACS::ENGINE::Port
 Port (Node *node)
 
 Port (const Port &other, Node *newHelder)
 

Protected Attributes

std::list< std::pair< InGate
*, bool > > 
_setOfInGate
 
- Protected Attributes inherited from YACS::ENGINE::Port
Node_node
 
int _id
 

Friends

class ElementaryNode
 

Additional Inherited Members

- Static Protected Attributes inherited from YACS::ENGINE::Port
static int _total = 0
 
static const char NAME [] ="Port"
 

Detailed Description

Definition at line 36 of file OutGate.hxx.

Constructor & Destructor Documentation

OutGate::OutGate ( Node node)

Definition at line 33 of file OutGate.cxx.

33  :Port(node)
34 {
35 }

Member Function Documentation

bool OutGate::edAddInGate ( InGate inGate)

Definition at line 98 of file OutGate.cxx.

References _setOfInGate, YACS::ENGINE::InGate::edAppendPrecursor(), isAlreadyInSet(), and YACS::ENGINE::Port::modified().

99 {
100  if(!isAlreadyInSet(inGate))
101  {
102  inGate->edAppendPrecursor(this);
103  _setOfInGate.push_back(std::pair<InGate *,bool>(inGate,false));
104  modified();
105  inGate->modified();
106  return true;
107  }
108  else
109  return false;
110 }
void OutGate::edDisconnectAllLinksFromMe ( )

Definition at line 82 of file OutGate.cxx.

References _setOfInGate.

Referenced by YACS::ENGINE::Node::edDisconnectAllLinksWithMe().

83 {
84  for(list< pair<InGate *, bool> >::iterator iter=_setOfInGate.begin();iter!=_setOfInGate.end();iter++)
85  (*iter).first->edRemovePrecursor(this);
86  _setOfInGate.clear();
87 }
std::list< std::pair< InGate *, bool> >& YACS::ENGINE::OutGate::edMapInGate ( )
inline

Definition at line 52 of file OutGate.hxx.

Referenced by YACS::ENGINE::CFDirectionVisTraits< true >::getNexts().

52 { return _setOfInGate; }
void OutGate::edRemoveInGate ( InGate inGate,
bool  coherenceWithInGate = true 
) throw (Exception)

Definition at line 120 of file OutGate.cxx.

121 {
122  std::list< pair<InGate* , bool> >::iterator iter(std::find_if(_setOfInGate.begin(),_setOfInGate.end(),ItemCmp(inGate)));
123  if(iter==_setOfInGate.end())
124  throw Exception("InGate not already connected to OutGate");
125  else
126  {
127  if(coherenceWithInGate)
128  inGate->edRemovePrecursor(this);
129  _setOfInGate.erase(iter);
130  inGate->modified();
131  modified();
132  }
133 }
void OutGate::edRemoveInGateOneWay ( InGate inGate)
protected

Definition at line 136 of file OutGate.cxx.

References _setOfInGate, YACS::ENGINE::InGate::edRemovePrecursor(), and YACS::ENGINE::Port::modified().

137 {
138  bool found=false;
139  for(list< pair<InGate *, bool> >::iterator iter=_setOfInGate.begin();iter!=_setOfInGate.end() && !found;iter++)
140  if((*iter).first==inGate)
141  {
142  _setOfInGate.erase(iter);
143  inGate->edRemovePrecursor(this);
144  found=true;
145  modified();
146  inGate->modified();
147  }
148 }
void OutGate::exNotifyDisabled ( )

Notify this port that its node has been disabled.

Definition at line 76 of file OutGate.cxx.

References _setOfInGate.

Referenced by YACS::ENGINE::Node::exDisabledState().

77 {
78  for(list< pair<InGate *, bool> >::iterator iter=_setOfInGate.begin();iter!=_setOfInGate.end();iter++)
79  (*iter).first->exNotifyDisabled();
80 }
void OutGate::exNotifyDone ( )

Notify this port that its node is finished.

Calls (notify) all the connected ingates : InGate::exNotifyFromPrecursor

Called by Bloc::updateStateOnFinishedEventFrom

Definition at line 55 of file OutGate.cxx.

References _setOfInGate, and DEBTRACE.

Referenced by YACS::ENGINE::Node::exForwardFinished().

56 {
57  DEBTRACE("OutGate::exNotifyDone");
58  for(list< pair<InGate *, bool> >::iterator iter=_setOfInGate.begin();iter!=_setOfInGate.end();iter++)
59  (*iter).first->exNotifyFromPrecursor(this);
60 }
void OutGate::exNotifyFailed ( )

Notify this port that its node has failed.

Definition at line 66 of file OutGate.cxx.

References _setOfInGate.

Referenced by YACS::ENGINE::Node::exFailedState(), and YACS::ENGINE::Node::exForwardFailed().

67 {
68  for(list< pair<InGate *, bool> >::iterator iter=_setOfInGate.begin();iter!=_setOfInGate.end();iter++)
69  (*iter).first->exNotifyFailed();
70 }
void OutGate::exReset ( )

Definition at line 42 of file OutGate.cxx.

References _setOfInGate.

Referenced by YACS::ENGINE::Node::init().

43 {
44  for(list< pair< InGate *, bool> >::iterator iter=_setOfInGate.begin();iter!=_setOfInGate.end();iter++)
45  (*iter).second=false;
46 }
string OutGate::getNameOfTypeOfCurrentInstance ( ) const
virtual

Reimplemented from YACS::ENGINE::Port.

Definition at line 37 of file OutGate.cxx.

References NAME.

38 {
39  return NAME;
40 }
int OutGate::getNbOfInGatesConnected ( ) const

Definition at line 155 of file OutGate.cxx.

References _setOfInGate.

156 {
157  return _setOfInGate.size();
158 }
bool OutGate::isAlreadyInSet ( InGate inGate) const

Definition at line 150 of file OutGate.cxx.

References _setOfInGate.

Referenced by edAddInGate(), YACS::HMI::CommandAddLink::localExecute(), YACS::HMI::SubjectNode::restoreLinks(), and YACS::HMI::SubjectNode::saveLinks().

151 {
152  return find_if(_setOfInGate.begin(),_setOfInGate.end(),ItemCmp(inGate))!=_setOfInGate.end();
153 }
virtual std::string YACS::ENGINE::OutGate::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::Port.

Definition at line 57 of file OutGate.hxx.

57 {return "YACS__ENGINE__OutGate";}

Friends And Related Function Documentation

friend class ElementaryNode
friend

Definition at line 38 of file OutGate.hxx.

Member Data Documentation

std::list< std::pair< InGate *, bool > > YACS::ENGINE::OutGate::_setOfInGate
protected
const char OutGate::NAME ="OutGate"
static

Definition at line 42 of file OutGate.hxx.

Referenced by getNameOfTypeOfCurrentInstance().


The documentation for this class was generated from the following files: