Version: 9.15.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)
 
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::OutGate ( Node node)

Definition at line 33 of file OutGate.cxx.

33  :Port(node)
34 {
35 }
Port(Node *node)
Definition: Port.cxx:34

Member Function Documentation

◆ edAddInGate()

bool OutGate::edAddInGate ( InGate inGate)

Definition at line 98 of file OutGate.cxx.

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 edAppendPrecursor(OutGate *fromgate)
Definition: InGate.cxx:99
bool isAlreadyInSet(InGate *inGate) const
Definition: OutGate.cxx:150
std::list< std::pair< InGate *, bool > > _setOfInGate
Definition: OutGate.hxx:40
void modified()
Definition: Port.cxx:53

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

Referenced by YACS::ENGINE::ComposedNode::edAddLink(), and YACS::ENGINE::AbstractPoint::Rewire().

◆ edDisconnectAllLinksFromMe()

void OutGate::edDisconnectAllLinksFromMe ( )

Definition at line 82 of file OutGate.cxx.

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

References _setOfInGate.

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

◆ edMapInGate()

std::list< std::pair< InGate *, bool> >& YACS::ENGINE::OutGate::edMapInGate ( )
inline

Definition at line 52 of file OutGate.hxx.

52 { return _setOfInGate; }

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

◆ edRemoveInGate()

void OutGate::edRemoveInGate ( InGate inGate,
bool  coherenceWithInGate = true 
)

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 edRemovePrecursor(OutGate *fromgate)
Definition: InGate.cxx:108

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

Referenced by YACS::ENGINE::ComposedNode::edRemoveLink().

◆ edRemoveInGateOneWay()

void OutGate::edRemoveInGateOneWay ( InGate inGate)
protected

Definition at line 136 of file OutGate.cxx.

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 }

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

◆ edSetInGate()

◆ exNotifyDisabled()

void OutGate::exNotifyDisabled ( )

Notify this port that its node has been disabled.

Definition at line 76 of file OutGate.cxx.

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

References _setOfInGate.

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

◆ exNotifyDone()

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.

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 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31

References _setOfInGate, and DEBTRACE.

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

◆ exNotifyFailed()

void OutGate::exNotifyFailed ( )

Notify this port that its node has failed.

Definition at line 66 of file OutGate.cxx.

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

References _setOfInGate.

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

◆ exReset()

void OutGate::exReset ( )

Definition at line 42 of file OutGate.cxx.

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

References _setOfInGate.

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

◆ getNameOfTypeOfCurrentInstance()

string OutGate::getNameOfTypeOfCurrentInstance ( ) const
virtual

Reimplemented from YACS::ENGINE::Port.

Definition at line 37 of file OutGate.cxx.

38 {
39  return NAME;
40 }
static const char NAME[]
Definition: OutGate.hxx:42

References NAME.

◆ getNbOfInGatesConnected()

int OutGate::getNbOfInGatesConnected ( ) const

Definition at line 155 of file OutGate.cxx.

156 {
157  return _setOfInGate.size();
158 }

References _setOfInGate.

◆ isAlreadyInSet()

bool OutGate::isAlreadyInSet ( InGate inGate) const

Definition at line 150 of file OutGate.cxx.

151 {
152  return find_if(_setOfInGate.begin(),_setOfInGate.end(),ItemCmp(inGate))!=_setOfInGate.end();
153 }

References _setOfInGate.

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

◆ typeName()

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

◆ ElementaryNode

friend class ElementaryNode
friend

Definition at line 38 of file OutGate.hxx.

Member Data Documentation

◆ _setOfInGate

std::list< std::pair< InGate *, bool > > YACS::ENGINE::OutGate::_setOfInGate
protected

◆ NAME

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: