Version: 9.15.0
YACS::ENGINE::OutputPort Class Referenceabstract

#include <OutputPort.hxx>

Inheritance diagram for YACS::ENGINE::OutputPort:
Collaboration diagram for YACS::ENGINE::OutputPort:

Public Member Functions

virtual ~OutputPort ()
 
std::set< InPort * > edSetInPort () const
 
bool isAlreadyLinkedWith (InPort *withp) const
 
bool isAlreadyInSet (InputPort *inputPort) const
 
bool isConnected () const
 
std::string getNameOfTypeOfCurrentInstance () const
 
int removeInPort (InPort *inPort, bool forward)
 
virtual bool edAddInputPort (InputPort *phyPort)
 
virtual bool edAddInPropertyPort (InPropertyPort *phyPort)
 
virtual int edRemoveInputPort (InputPort *inputPort, bool forward)
 
bool addInPort (InPort *inPort)
 
void edRemoveAllLinksLinkedWithMe ()
 
virtual void exInit ()
 
virtual void checkBasicConsistency () const
 Check validity of output port. Nothing on base class. More...
 
virtual OutputPortclone (Node *newHelder) const =0
 
virtual std::string dump ()
 
virtual void put (const void *data)
 
virtual std::string typeName ()
 
- Public Member Functions inherited from YACS::ENGINE::DataFlowPort
TypeOfChannel getTypeOfChannel () const
 returns type of channel the port will use for data exchange on runtime : DATAFLOW or DATASTREAM. More...
 
virtual ~DataFlowPort ()
 
virtual std::string valToStr ()
 Gives a string representation of the data, for user interfaces. More...
 
virtual void valFromStr (std::string valstr)
 Allows to set data from a string representation used in user interface. More...
 
- Public Member Functions inherited from YACS::ENGINE::DataPort
TypeCodeedGetType () const
 
void edSetType (TypeCode *type)
 
std::string getName () const
 
void setName (std::string theName)
 
bool isDifferentTypeOf (const DataPort *other) const
 
virtual std::string getAsString ()
 returns port value as a string that can be used in a GUI for example More...
 
- Public Member Functions inherited from YACS::ENGINE::Port
virtual ~Port ()
 
NodegetNode () const
 
int getNumId () const
 
void modified ()
 
- Public Member Functions inherited from YACS::ENGINE::OutPort
virtual void checkConsistency (LinkInfo &info) const
 
virtual int edGetNumberOfOutLinks () const
 
virtual void getAllRepresented (std::set< OutPort * > &represented) const
 
virtual ~OutPort ()
 
std::vector< DataPort * > calculateHistoryOfLinkWith (InPort *end)
 

Static Public Attributes

static const char NAME [] ="OutputPort"
 
- Static Public Attributes inherited from YACS::ENGINE::DataFlowPort
static const char NAME [] ="DataFlowPort"
 
- Static Public Attributes inherited from YACS::ENGINE::DataPort
static const char NAME [] ="DataPort"
 

Protected Member Functions

 OutputPort (const OutputPort &other, Node *newHelder)
 
 OutputPort (const std::string &name, Node *node, TypeCode *type)
 
const std::set< InputPort * > & getSetOfPhyLinks () const
 Returns physical links linked to this. Contrary to edSetInPort that returns semantic links. More...
 
- Protected Member Functions inherited from YACS::ENGINE::DataFlowPort
 DataFlowPort (const DataFlowPort &other, Node *newHelder)
 
 DataFlowPort (const std::string &name, Node *node, TypeCode *type)
 
- Protected Member Functions inherited from YACS::ENGINE::DataPort
virtual ~DataPort ()
 
 DataPort (const DataPort &other, Node *newHelder)
 
 DataPort (const std::string &name, Node *node, TypeCode *type)
 
- Protected Member Functions inherited from YACS::ENGINE::Port
 Port (Node *node)
 
 Port (const Port &other, Node *newHelder)
 
- Protected Member Functions inherited from YACS::ENGINE::OutPort
 OutPort (const OutPort &other, Node *newHelder)
 
 OutPort (const std::string &name, Node *node, TypeCode *type)
 

Protected Attributes

std::set< InputPort * > _setOfInputPort
 
- Protected Attributes inherited from YACS::ENGINE::DataPort
TypeCode_type
 
std::string _name
 
- Protected Attributes inherited from YACS::ENGINE::Port
Node_node
 
int _id
 

Friends

class CollectorSwOutputPort
 
class ElementaryNode
 
class OptimizerLoop
 
class InputPort
 
class Runtime
 
class ForLoop
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::DataPort
static DataPortisCrossingType (const std::vector< DataPort * > &historyOfLink)
 
- Static Protected Attributes inherited from YACS::ENGINE::Port
static int _total = 0
 
static const char NAME [] ="Port"
 

Detailed Description

Definition at line 42 of file OutputPort.hxx.

Constructor & Destructor Documentation

◆ ~OutputPort()

OutputPort::~OutputPort ( )
virtual

Definition at line 153 of file OutputPort.cxx.

154 {
155  set<InputPort *>::iterator iter;
156  for(iter=_setOfInputPort.begin();iter!=_setOfInputPort.end();iter++)
157  {
158  delete (*iter);
159  }
160 }
std::set< InputPort * > _setOfInputPort
Definition: OutputPort.hxx:77

References _setOfInputPort.

◆ OutputPort() [1/2]

OutputPort::OutputPort ( const OutputPort other,
Node newHelder 
)
protected

Definition at line 38 of file OutputPort.cxx.

38  :DataFlowPort(other,newHelder),OutPort(other,newHelder),
39  DataPort(other,newHelder),Port(other,newHelder)
40 {
41 }
DataFlowPort(const DataFlowPort &other, Node *newHelder)
DataPort(const DataPort &other, Node *newHelder)
Definition: DataPort.cxx:41
OutPort(const OutPort &other, Node *newHelder)
Definition: OutPort.cxx:29
Port(Node *node)
Definition: Port.cxx:34

◆ OutputPort() [2/2]

OutputPort::OutputPort ( const std::string &  name,
Node node,
TypeCode type 
)
protected

Definition at line 43 of file OutputPort.cxx.

43  :DataFlowPort(name,node,type),OutPort(name,node,type),
44  DataPort(name,node,type),Port(node)
45 {
46 }

Member Function Documentation

◆ addInPort()

bool OutputPort::addInPort ( InPort inPort)
virtual

check compatibility of port class ( an inputPort ) before trying to create the link.

Implements YACS::ENGINE::OutPort.

Definition at line 205 of file OutputPort.cxx.

206 {
207  DEBTRACE("OutputPort::addInPort");
210  {
211  string what="not compatible type of port requested during building of link FROM ";
212  what+=NAME; what+=" TO "; what+=inPort->getNameOfTypeOfCurrentInstance();
213  throw Exception(what);
214  }
216  {
217  return edAddInputPort(static_cast<InputPort*>(inPort));
218  }
219  else
220  {
221  return edAddInPropertyPort(static_cast<InPropertyPort*>(inPort));
222  }
223 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
std::string getNameOfTypeOfCurrentInstance() const
Definition: DataPort.cxx:56
class for Input Property Ports
Base class for Input Ports.
Definition: InputPort.hxx:44
static const char NAME[]
Definition: InputPort.hxx:48
virtual bool edAddInPropertyPort(InPropertyPort *phyPort)
Definition: OutputPort.cxx:92
virtual bool edAddInputPort(InputPort *phyPort)
Definition: OutputPort.cxx:75
static const char NAME[]
Definition: OutputPort.hxx:79

References DEBTRACE, edAddInPropertyPort(), edAddInputPort(), YACS::ENGINE::DataPort::getNameOfTypeOfCurrentInstance(), YACS::ENGINE::InPropertyPort::NAME, YACS::ENGINE::InputPort::NAME, and NAME.

Referenced by YACS::ENGINE::AnySplitOutputPort::addInPort().

◆ checkBasicConsistency()

void OutputPort::checkBasicConsistency ( ) const
virtual

Check validity of output port. Nothing on base class.

Reimplemented in YACS::ENGINE::OutputPresetPort.

Definition at line 261 of file OutputPort.cxx.

262 {
263 }

◆ clone()

◆ dump()

std::string OutputPort::dump ( )
virtual

Reimplemented in YACS::ENGINE::OutputXmlPort, YACS::ENGINE::OutputStudyPort, YACS::ENGINE::OutputPyPort, YACS::ENGINE::OutputPresetPort, YACS::ENGINE::OutputCppPort, and YACS::ENGINE::OutputCorbaPort.

Definition at line 247 of file OutputPort.cxx.

248 {
249  string xmldump = "<value><error> NO_SERIALISATION_AVAILABLE </error></value>";
250  return xmldump;
251 }

◆ edAddInPropertyPort()

bool OutputPort::edAddInPropertyPort ( InPropertyPort phyPort)
virtual

Definition at line 92 of file OutputPort.cxx.

93 {
94  DEBTRACE("OutputPort::edAddInPropertyPort");
95  if(!isAlreadyInSet(phyPort))
96  {
97  InputPort *pwrap = getRuntime()->adapt(phyPort,
99  this->edGetType());
100  _setOfInputPort.insert(pwrap);
101  modified();
102  phyPort->modified();
103  return true;
104  }
105  else
106  return false;
107 }
std::string getImplementation() const
Definition: Node.cxx:350
bool isAlreadyInSet(InputPort *inputPort) const
Definition: OutputPort.cxx:182
void modified()
Definition: Port.cxx:53
Node * _node
Definition: Port.hxx:55
virtual InputPort * adapt(InputPort *source, const std::string &impl, TypeCode *type, bool init=false)=0
YACSLIBENGINE_EXPORT Runtime * getRuntime()
Definition: Runtime.cxx:61

References YACS::ENGINE::Port::_node, _setOfInputPort, YACS::ENGINE::Runtime::adapt(), DEBTRACE, YACS::ENGINE::Node::getImplementation(), YACS::ENGINE::getRuntime(), isAlreadyInSet(), and YACS::ENGINE::Port::modified().

Referenced by addInPort().

◆ edAddInputPort()

bool OutputPort::edAddInputPort ( InputPort phyPort)
virtual

check if output type is an input type and if a data converter exists before link

Definition at line 75 of file OutputPort.cxx.

76 {
77  DEBTRACE("OutputPort::edAddInputPort");
78  if(!isAlreadyInSet(phyPort))
79  {
80  InputPort *pwrap = getRuntime()->adapt(phyPort,
82  this->edGetType());
83  _setOfInputPort.insert(pwrap);
84  modified();
85  phyPort->modified();
86  return true;
87  }
88  else
89  return false;
90 }

References YACS::ENGINE::Port::_node, _setOfInputPort, YACS::ENGINE::Runtime::adapt(), DEBTRACE, YACS::ENGINE::Node::getImplementation(), YACS::ENGINE::getRuntime(), isAlreadyInSet(), and YACS::ENGINE::Port::modified().

Referenced by addInPort(), and YACS::ENGINE::OptimizerLoop::initInterceptors().

◆ edRemoveAllLinksLinkedWithMe()

void OutputPort::edRemoveAllLinksLinkedWithMe ( )
virtual

Implements YACS::ENGINE::DataPort.

Definition at line 53 of file OutputPort.cxx.

54 {
55  set<InputPort *>::iterator iter;
56  set<InputPort *> vec(_setOfInputPort);
57  for( set<InputPort *>::iterator iter2=vec.begin();iter2!=vec.end();iter2++)
58  edRemoveInputPort(*iter2,true);
59  _setOfInputPort.clear();
60 }
virtual int edRemoveInputPort(InputPort *inputPort, bool forward)
Definition: OutputPort.cxx:114

References _setOfInputPort, and edRemoveInputPort().

◆ edRemoveInputPort()

int OutputPort::edRemoveInputPort ( InputPort inputPort,
bool  forward 
)
virtual

Remove a link by performing not only the deletion in _setOfInputPort but also dereference to the target inputPort. If 'forward' == true the forward deletion If 'forward' == false no forward deletion performed, oneway deletion without update 'inputPort' side.

Definition at line 114 of file OutputPort.cxx.

115 {
116  if(forward)
117  {
118  set<InPort *> s;
119  inputPort->getAllRepresentants(s);
120  DEBTRACE("+++");
121  for(set<InPort *>::iterator iter=s.begin();iter!=s.end();iter++)
122  {
123  DEBTRACE("---");
124  _node->getRootNode()->edRemoveLink(this,*iter);
125  }
126  return -1;
127  }
128  else
129  {
130 #ifdef NOCOVARIANT
131  InPort *publicRepr=inputPort->getPublicRepresentant();
132 #else
133  InputPort *publicRepr=inputPort->getPublicRepresentant();
134 #endif
135  set<InputPort *>::iterator iter;
136  for(iter=_setOfInputPort.begin();iter!=_setOfInputPort.end();iter++)
137  if((*iter)->getPublicRepresentant()==publicRepr)
138  break;
139  if(iter!=_setOfInputPort.end())
140  {
141  (*iter)->modified();
142  if((*iter)->isIntermediate())
143  delete (*iter);
144  _setOfInputPort.erase(iter);
145  modified();
146  return edGetNumberOfOutLinks();
147  }
148  else
149  throw Exception("OutputPort::edRemoveInputPort : link does not exist, unable to remove it");
150  }
151 }
void edRemoveLink(OutPort *start, InPort *end)
Remove a dataflow link.
virtual void getAllRepresentants(std::set< InPort * > &repr) const
Definition: InPort.cxx:110
virtual InputPort * getPublicRepresentant()
returns the final physical port behind 'this'.
Definition: InputPort.hxx:57
virtual ComposedNode * getRootNode() const
Definition: Node.cxx:431
virtual int edGetNumberOfOutLinks() const
Definition: OutPort.cxx:50

References YACS::ENGINE::Port::_node, _setOfInputPort, DEBTRACE, YACS::ENGINE::OutPort::edGetNumberOfOutLinks(), YACS::ENGINE::ComposedNode::edRemoveLink(), YACS::ENGINE::InPort::getAllRepresentants(), YACS::ENGINE::InputPort::getPublicRepresentant(), YACS::ENGINE::Node::getRootNode(), and YACS::ENGINE::Port::modified().

Referenced by edRemoveAllLinksLinkedWithMe(), and removeInPort().

◆ edSetInPort()

std::set< InPort * > OutputPort::edSetInPort ( ) const
virtual

Implements YACS::ENGINE::OutPort.

Definition at line 239 of file OutputPort.cxx.

240 {
241  set<InPort *> s;
242  for(set<InputPort *>::const_iterator iter=_setOfInputPort.begin();iter!=_setOfInputPort.end();iter++)
243  (*iter)->getAllRepresentants(s);
244  return s;
245 }

References _setOfInputPort.

Referenced by YACS::ENGINE::DynParaLoop::DynParaLoop(), YACS::ENGINE::InterceptorInputPort::getAllRepresentants(), YACS::ENGINE::InputDataStreamPort4DS2DF::getAllRepresentants(), YACS::ENGINE::DynParaLoop::putValueOnBranch(), and YACS::ENGINE::VisitorSaveSchema::writeSimpleDataLinks().

◆ exInit()

void OutputPort::exInit ( )
virtual

◆ getNameOfTypeOfCurrentInstance()

string OutputPort::getNameOfTypeOfCurrentInstance ( ) const
virtual

Reimplemented from YACS::ENGINE::DataFlowPort.

Definition at line 48 of file OutputPort.cxx.

49 {
50  return NAME;
51 }

References NAME.

◆ getSetOfPhyLinks()

const std::set< InputPort * > & OutputPort::getSetOfPhyLinks ( ) const
protected

Returns physical links linked to this. Contrary to edSetInPort that returns semantic links.

Definition at line 255 of file OutputPort.cxx.

256 {
257  return _setOfInputPort;
258 }

References _setOfInputPort.

Referenced by YACS::ENGINE::OptimizerLoop::initInterceptors().

◆ isAlreadyInSet()

bool OutputPort::isAlreadyInSet ( InputPort inputPort) const

Definition at line 182 of file OutputPort.cxx.

183 {
184 #ifdef NOCOVARIANT
185  InPort *publicRepr=inputPort->getPublicRepresentant();
186 #else
187  InputPort *publicRepr=inputPort->getPublicRepresentant();
188 #endif
189  for(set<InputPort *>::const_iterator iter=_setOfInputPort.begin();iter!=_setOfInputPort.end();iter++)
190  if((*iter)->getPublicRepresentant()==publicRepr)
191  return true;
192  return false;
193 }

References _setOfInputPort, and YACS::ENGINE::InputPort::getPublicRepresentant().

Referenced by edAddInPropertyPort(), and edAddInputPort().

◆ isAlreadyLinkedWith()

bool OutputPort::isAlreadyLinkedWith ( InPort withp) const
virtual

Implements YACS::ENGINE::OutPort.

Definition at line 162 of file OutputPort.cxx.

163 {
164  InPort *publicRepr=with->getPublicRepresentant();
165  set<InPort *> s;
166  set<InputPort *>::const_iterator iter;
167  for(iter=_setOfInputPort.begin();iter!=_setOfInputPort.end();iter++)
168  {
169  if((*iter)->getPublicRepresentant() == publicRepr)
170  return true;
171  }
172  for(iter=_setOfInputPort.begin();iter!=_setOfInputPort.end();iter++)
173  (*iter)->getAllRepresentants(s);
174  for(set<InPort *>::iterator iter2=s.begin();iter2!=s.end();iter2++)
175  {
176  if((*iter2)->getPublicRepresentant() == publicRepr)
177  return true;
178  }
179  return false;
180 }
virtual InPort * getPublicRepresentant()
Definition: InPort.hxx:63

References _setOfInputPort, YACS::ENGINE::InPort::getAllRepresentants(), and YACS::ENGINE::InPort::getPublicRepresentant().

◆ isConnected()

bool OutputPort::isConnected ( ) const

Definition at line 196 of file OutputPort.cxx.

197 {
198  return !_setOfInputPort.empty();
199 }

References _setOfInputPort.

◆ put()

◆ removeInPort()

int OutputPort::removeInPort ( InPort inPort,
bool  forward 
)
virtual

check compatibility of port class ( an inputPort ) before trying to remove link WITHOUT forward.

Implements YACS::ENGINE::OutPort.

Definition at line 228 of file OutputPort.cxx.

229 {
230  if(inPort->getNameOfTypeOfCurrentInstance()!=InputPort::NAME && !forward)
231  {
232  string what="not compatible type of port requested during destruction of for link FROM ";
233  what+=NAME; what+=" TO "; what+=inPort->getNameOfTypeOfCurrentInstance();
234  throw Exception(what);
235  }
236  return edRemoveInputPort(static_cast<InputPort*>(inPort),forward);
237 }

References edRemoveInputPort(), YACS::ENGINE::DataPort::getNameOfTypeOfCurrentInstance(), YACS::ENGINE::InputPort::NAME, and NAME.

Referenced by YACS::ENGINE::AnySplitOutputPort::removeInPort().

◆ typeName()

virtual std::string YACS::ENGINE::OutputPort::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::DataFlowPort.

Reimplemented in YACS::ENGINE::OutputStudyPort, YACS::ENGINE::OutputPyPort, YACS::ENGINE::OutputPresetPort, YACS::ENGINE::OutputCorbaPort, and YACS::ENGINE::AnyOutputPort.

Definition at line 69 of file OutputPort.hxx.

69 {return "YACS__ENGINE__OutputPort";}

Friends And Related Function Documentation

◆ CollectorSwOutputPort

friend class CollectorSwOutputPort
friend

Definition at line 44 of file OutputPort.hxx.

◆ ElementaryNode

friend class ElementaryNode
friend

Definition at line 45 of file OutputPort.hxx.

◆ ForLoop

friend class ForLoop
friend

Definition at line 49 of file OutputPort.hxx.

◆ InputPort

friend class InputPort
friend

Definition at line 47 of file OutputPort.hxx.

◆ OptimizerLoop

friend class OptimizerLoop
friend

Definition at line 46 of file OutputPort.hxx.

◆ Runtime

friend class Runtime
friend

Definition at line 48 of file OutputPort.hxx.

Member Data Documentation

◆ _setOfInputPort

◆ NAME


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