Version: 8.3.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) throw (Exception)
 
virtual bool edAddInputPort (InputPort *phyPort) throw (Exception)
 
virtual bool edAddInPropertyPort (InPropertyPort *phyPort) throw (Exception)
 
virtual int edRemoveInputPort (InputPort *inputPort, bool forward) throw (Exception)
 
bool addInPort (InPort *inPort) throw (Exception)
 
void edRemoveAllLinksLinkedWithMe () throw (Exception)
 
virtual void exInit ()
 
virtual void checkBasicConsistency () const throw (Exception)
 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) throw (ConversionException)
 
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
 

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 ( )
virtual

Definition at line 153 of file OutputPort.cxx.

References _setOfInputPort.

154 {
155  set<InputPort *>::iterator iter;
156  for(iter=_setOfInputPort.begin();iter!=_setOfInputPort.end();iter++)
157  {
158  delete (*iter);
159  }
160 }
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 }
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

bool OutputPort::addInPort ( InPort inPort) throw (Exception)
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.

References DEBTRACE, YACS::ENGINE::InPropertyPort::NAME, and YACS::ENGINE::InputPort::NAME.

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

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 }
void OutputPort::checkBasicConsistency ( ) const throw (Exception)
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 }
std::string OutputPort::dump ( )
virtual

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

Definition at line 247 of file OutputPort.cxx.

248 {
249  string xmldump = "<value><error> NO_SERIALISATION_AVAILABLE </error></value>";
250  return xmldump;
251 }
bool OutputPort::edAddInPropertyPort ( InPropertyPort phyPort) throw (Exception)
virtual

Definition at line 92 of file OutputPort.cxx.

References YACS::ENGINE::Runtime::adapt(), DEBTRACE, and YACS::ENGINE::getRuntime().

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 }
bool OutputPort::edAddInputPort ( InputPort phyPort) throw (Exception)
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.

References YACS::ENGINE::Runtime::adapt(), DEBTRACE, and YACS::ENGINE::getRuntime().

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

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 }
void OutputPort::edRemoveAllLinksLinkedWithMe ( ) throw (Exception)
virtual

Implements YACS::ENGINE::DataPort.

Definition at line 53 of file OutputPort.cxx.

References _setOfInputPort, and edRemoveInputPort().

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 }
int OutputPort::edRemoveInputPort ( InputPort inputPort,
bool  forward 
) throw (Exception)
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.

References DEBTRACE, YACS::ENGINE::InPort::getPublicRepresentant(), and YACS::ENGINE::Port::modified().

Referenced by edRemoveAllLinksLinkedWithMe().

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 }
std::set< InPort * > OutputPort::edSetInPort ( ) const
virtual

Implements YACS::ENGINE::OutPort.

Definition at line 239 of file OutputPort.cxx.

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().

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 }
void OutputPort::exInit ( )
virtual
string OutputPort::getNameOfTypeOfCurrentInstance ( ) const
virtual

Reimplemented from YACS::ENGINE::DataFlowPort.

Definition at line 48 of file OutputPort.cxx.

References NAME.

49 {
50  return NAME;
51 }
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.

References _setOfInputPort.

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

256 {
257  return _setOfInputPort;
258 }
bool OutputPort::isAlreadyInSet ( InputPort inputPort) const

Definition at line 182 of file OutputPort.cxx.

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

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 }
bool OutputPort::isAlreadyLinkedWith ( InPort withp) const
virtual

Implements YACS::ENGINE::OutPort.

Definition at line 162 of file OutputPort.cxx.

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

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 }
bool OutputPort::isConnected ( ) const

Definition at line 196 of file OutputPort.cxx.

References _setOfInputPort.

197 {
198  return !_setOfInputPort.empty();
199 }
int OutputPort::removeInPort ( InPort inPort,
bool  forward 
) throw (Exception)
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.

References YACS::ENGINE::InputPort::NAME.

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

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 }
virtual std::string YACS::ENGINE::OutputPort::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::DataFlowPort.

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

Definition at line 69 of file OutputPort.hxx.

69 {return "YACS__ENGINE__OutputPort";}

Friends And Related Function Documentation

friend class CollectorSwOutputPort
friend

Definition at line 44 of file OutputPort.hxx.

friend class ElementaryNode
friend

Definition at line 45 of file OutputPort.hxx.

friend class ForLoop
friend

Definition at line 49 of file OutputPort.hxx.

friend class InputPort
friend

Definition at line 47 of file OutputPort.hxx.

friend class OptimizerLoop
friend

Definition at line 46 of file OutputPort.hxx.

friend class Runtime
friend

Definition at line 48 of file OutputPort.hxx.

Member Data Documentation

std::set<InputPort *> YACS::ENGINE::OutputPort::_setOfInputPort
protected

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