Version: 9.15.0
YACS::ENGINE::OutputDataStreamPort Class Reference

#include <OutputDataStreamPort.hxx>

Inheritance diagram for YACS::ENGINE::OutputDataStreamPort:
Collaboration diagram for YACS::ENGINE::OutputDataStreamPort:

Public Member Functions

 OutputDataStreamPort (const OutputDataStreamPort &other, Node *newHelder)
 
 OutputDataStreamPort (const std::string &name, Node *node, TypeCode *type)
 
virtual ~OutputDataStreamPort ()
 
virtual OutputDataStreamPortclone (Node *newHelder) const
 
std::set< InPort * > edSetInPort () const
 
bool isAlreadyLinkedWith (InPort *withp) const
 
virtual std::string getNameOfTypeOfCurrentInstance () const
 
virtual bool addInPort (InPort *inPort)
 
virtual bool edAddInputDataStreamPort (InputDataStreamPort *port)
 
int edRemoveInputDataStreamPort (InputDataStreamPort *inPort, bool forward)
 
void edRemoveAllLinksLinkedWithMe ()
 
int removeInPort (InPort *inPort, bool forward)
 
virtual std::string typeName ()
 
- Public Member Functions inherited from YACS::ENGINE::DataStreamPort
TypeOfChannel getTypeOfChannel () const
 returns type of channel the port will use for data exchange on runtime : DATAFLOW or DATASTREAM. More...
 
virtual void setProperty (const std::string &name, const std::string &value)
 Set a new value for a property of the port. More...
 
virtual void setProperties (std::map< std::string, std::string > properties)
 Set the values of all properties of the port. More...
 
virtual std::string getProperty (const std::string &name)
 Get the value of a property of the port. More...
 
std::map< std::string, std::string > getProperties () const
 
virtual void initPortProperties ()
 Initialize port properties at the start of calculation phase. More...
 
virtual ~DataStreamPort ()
 
- 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 [] ="OutputDataStreamPort"
 
- Static Public Attributes inherited from YACS::ENGINE::DataStreamPort
static const char NAME [] ="DataStreamPort"
 
- Static Public Attributes inherited from YACS::ENGINE::DataPort
static const char NAME [] ="DataPort"
 

Protected Attributes

std::set< InputDataStreamPort * > _setOfInputDataStreamPort
 
- Protected Attributes inherited from YACS::ENGINE::DataStreamPort
std::map< std::string, std::string > _propertyMap
 
- Protected Attributes inherited from YACS::ENGINE::DataPort
TypeCode_type
 
std::string _name
 
- Protected Attributes inherited from YACS::ENGINE::Port
Node_node
 
int _id
 

Private Member Functions

bool isAlreadyInSet (InputDataStreamPort *inPort) const
 

Friends

class ElementaryNode
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::DataPort
static DataPortisCrossingType (const std::vector< DataPort * > &historyOfLink)
 
- Protected Member Functions inherited from YACS::ENGINE::DataStreamPort
 DataStreamPort (const DataStreamPort &other, Node *newHelder)
 
 DataStreamPort (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)
 
- Static Protected Attributes inherited from YACS::ENGINE::Port
static int _total = 0
 
static const char NAME [] ="Port"
 

Detailed Description

Definition at line 37 of file OutputDataStreamPort.hxx.

Constructor & Destructor Documentation

◆ OutputDataStreamPort() [1/2]

OutputDataStreamPort::OutputDataStreamPort ( const OutputDataStreamPort other,
Node newHelder 
)

Definition at line 35 of file OutputDataStreamPort.cxx.

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

Referenced by clone().

◆ OutputDataStreamPort() [2/2]

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

Definition at line 42 of file OutputDataStreamPort.cxx.

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

◆ ~OutputDataStreamPort()

OutputDataStreamPort::~OutputDataStreamPort ( )
virtual

Definition at line 49 of file OutputDataStreamPort.cxx.

50 {
51 }

Member Function Documentation

◆ addInPort()

bool OutputDataStreamPort::addInPort ( InPort inPort)
virtual

Implements YACS::ENGINE::OutPort.

Reimplemented in YACS::ENGINE::OutputCalStreamPort.

Definition at line 132 of file OutputDataStreamPort.cxx.

133 {
134  DEBTRACE("OutputDataStreamPort::addInPort");
136  {
137  string what="not compatible type of port requested during building of link FROM ";
138  what+=NAME; what+=" TO "; what+=inPort->getNameOfTypeOfCurrentInstance();
139  throw Exception(what);
140  }
141  return edAddInputDataStreamPort(static_cast<InputDataStreamPort*>(inPort));
142 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
std::string getNameOfTypeOfCurrentInstance() const
Definition: DataPort.cxx:56
virtual bool edAddInputDataStreamPort(InputDataStreamPort *port)

References DEBTRACE, edAddInputDataStreamPort(), YACS::ENGINE::DataPort::getNameOfTypeOfCurrentInstance(), YACS::ENGINE::InputDataStreamPort::NAME, and NAME.

◆ clone()

OutputDataStreamPort * OutputDataStreamPort::clone ( Node newHelder) const
virtual

Reimplemented in YACS::ENGINE::OutputCalStreamPort.

Definition at line 53 of file OutputDataStreamPort.cxx.

54 {
55  return new OutputDataStreamPort(*this,newHelder);
56 }
OutputDataStreamPort(const OutputDataStreamPort &other, Node *newHelder)

References OutputDataStreamPort().

Referenced by YACS::ENGINE::ElementaryNode::createMultiDatastreamPorts().

◆ edAddInputDataStreamPort()

bool OutputDataStreamPort::edAddInputDataStreamPort ( InputDataStreamPort port)
virtual

Definition at line 86 of file OutputDataStreamPort.cxx.

87 {
88  DEBTRACE("OutputDataStreamPort::edAddInputDataStreamPort");
89  if(!isAlreadyInSet(port))
90  {
91  if(!port->edGetType()->isAdaptable(edGetType()))
92  {
93  string what="Can not connect 2 ports with incompatible types : ";
94  what=what+ port->edGetType()->id();
95  what=what+" is not a ";
96  what=what+ edGetType()->id();
97  throw ConversionException(what);
98  }
99  _setOfInputDataStreamPort.insert(port);
100  port->edAddOutputDataStreamPort(this);
101  return true;
102  }
103  else
104  return false;
105 }
TypeCode * edGetType() const
Definition: DataPort.hxx:53
virtual void edAddOutputDataStreamPort(OutputDataStreamPort *port)
std::set< InputDataStreamPort * > _setOfInputDataStreamPort
bool isAlreadyInSet(InputDataStreamPort *inPort) const
virtual const char * id() const
Definition: TypeCode.cxx:82
virtual int isAdaptable(const TypeCode *tc) const
Check if this TypeCode is adaptable to a given TypeCode (tc)
Definition: TypeCode.cxx:116

References _setOfInputDataStreamPort, DEBTRACE, YACS::ENGINE::InputDataStreamPort::edAddOutputDataStreamPort(), YACS::ENGINE::DataPort::edGetType(), YACS::ENGINE::TypeCode::id(), YACS::ENGINE::TypeCode::isAdaptable(), and isAlreadyInSet().

Referenced by addInPort(), and YACS::ENGINE::OutputCalStreamPort::addInPort().

◆ edRemoveAllLinksLinkedWithMe()

void OutputDataStreamPort::edRemoveAllLinksLinkedWithMe ( )
virtual

Implements YACS::ENGINE::DataPort.

Definition at line 144 of file OutputDataStreamPort.cxx.

145 {
146  set<InputDataStreamPort *>::iterator iter;
147  set<InputDataStreamPort *> vec(_setOfInputDataStreamPort);
148  for( set<InputDataStreamPort *>::iterator iter2=vec.begin();iter2!=vec.end();iter2++)
149  edRemoveInputDataStreamPort(*iter2,true);
151 }
int edRemoveInputDataStreamPort(InputDataStreamPort *inPort, bool forward)

References _setOfInputDataStreamPort, and edRemoveInputDataStreamPort().

◆ edRemoveInputDataStreamPort()

int OutputDataStreamPort::edRemoveInputDataStreamPort ( InputDataStreamPort inPort,
bool  forward 
)

Definition at line 107 of file OutputDataStreamPort.cxx.

108 {
109  if(forward)
110  {
111  set<InPort *> s;
112  inPort->getAllRepresentants(s);
113  for(set<InPort *>::iterator iter=s.begin();iter!=s.end();iter++)
114  _node->getRootNode()->edRemoveLink(this,*iter);
115  return -1;
116  }
117  else
118  {
119  set<InputDataStreamPort *>::iterator iter=_setOfInputDataStreamPort.find(inPort);
120  if(iter!=_setOfInputDataStreamPort.end())
121  {
122  (*iter)->modified();
123  _setOfInputDataStreamPort.erase(iter);
124  modified();
125  return edGetNumberOfOutLinks();
126  }
127  else
128  throw Exception("OutputDataStreamPort::edRemoveInputPort : link does not exist, unable to remove it");
129  }
130 }
void edRemoveLink(OutPort *start, InPort *end)
Remove a dataflow link.
virtual void getAllRepresentants(std::set< InPort * > &repr) const
Definition: InPort.cxx:110
virtual ComposedNode * getRootNode() const
Definition: Node.cxx:431
virtual int edGetNumberOfOutLinks() const
Definition: OutPort.cxx:50
void modified()
Definition: Port.cxx:53
Node * _node
Definition: Port.hxx:55

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

Referenced by edRemoveAllLinksLinkedWithMe(), removeInPort(), and YACS::ENGINE::OutputCalStreamPort::removeInPort().

◆ edSetInPort()

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

Implements YACS::ENGINE::OutPort.

Definition at line 58 of file OutputDataStreamPort.cxx.

59 {
60  set<InPort *> s;
61  for(set<InputDataStreamPort *>::const_iterator iter=_setOfInputDataStreamPort.begin();iter!=_setOfInputDataStreamPort.end();iter++)
62  (*iter)->getAllRepresentants(s);
63  return s;
64 }

References _setOfInputDataStreamPort.

Referenced by YACS::ENGINE::ElementaryNode::ensureLoading(), YACS::ENGINE::InputPort4DF2DS::getAllRepresentants(), YACS::ENGINE::ElementaryNode::getCoupledNodes(), and YACS::ENGINE::VisitorSaveSchema::writeSimpleStreamLinks().

◆ getNameOfTypeOfCurrentInstance()

string OutputDataStreamPort::getNameOfTypeOfCurrentInstance ( ) const
virtual

Reimplemented from YACS::ENGINE::DataStreamPort.

Reimplemented in YACS::ENGINE::OutputCalStreamPort.

Definition at line 81 of file OutputDataStreamPort.cxx.

82 {
83  return NAME;
84 }

References NAME.

◆ isAlreadyInSet()

bool OutputDataStreamPort::isAlreadyInSet ( InputDataStreamPort inPort) const
private

Definition at line 165 of file OutputDataStreamPort.cxx.

166 {
167  return _setOfInputDataStreamPort.find(inPort)!=_setOfInputDataStreamPort.end();
168 }

References _setOfInputDataStreamPort.

Referenced by edAddInputDataStreamPort().

◆ isAlreadyLinkedWith()

bool OutputDataStreamPort::isAlreadyLinkedWith ( InPort withp) const
virtual

Implements YACS::ENGINE::OutPort.

Definition at line 66 of file OutputDataStreamPort.cxx.

67 {
68  set<InPort *> s;
69  set<InputDataStreamPort *>::const_iterator iter;
70  for(iter=_setOfInputDataStreamPort.begin();iter!=_setOfInputDataStreamPort.end();iter++)
71  if(*iter==with)
72  return true;
73  for(iter=_setOfInputDataStreamPort.begin();iter!=_setOfInputDataStreamPort.end();iter++)
74  (*iter)->getAllRepresentants(s);
75  for(set<InPort *>::iterator iter2=s.begin();iter2!=s.end();iter2++)
76  if((*iter2)==with)
77  return true;
78  return false;
79 }

References _setOfInputDataStreamPort.

◆ removeInPort()

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

Implements YACS::ENGINE::OutPort.

Reimplemented in YACS::ENGINE::OutputCalStreamPort.

Definition at line 153 of file OutputDataStreamPort.cxx.

154 {
155  DEBTRACE("OutputDataStreamPort::removeInPort");
157  {
158  string what="not compatible type of port requested during destruction of for link FROM ";
159  what+=NAME; what+=" TO "; what+=inPort->getNameOfTypeOfCurrentInstance();
160  throw Exception(what);
161  }
162  return edRemoveInputDataStreamPort(static_cast<InputDataStreamPort *>(inPort),forward);
163 }

References DEBTRACE, edRemoveInputDataStreamPort(), YACS::ENGINE::DataPort::getNameOfTypeOfCurrentInstance(), YACS::ENGINE::InputDataStreamPort::NAME, and NAME.

◆ typeName()

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

Reimplemented from YACS::ENGINE::DataStreamPort.

Definition at line 57 of file OutputDataStreamPort.hxx.

57 {return "YACS__ENGINE__OutputDataStreamPort";}

Friends And Related Function Documentation

◆ ElementaryNode

friend class ElementaryNode
friend

Definition at line 39 of file OutputDataStreamPort.hxx.

Member Data Documentation

◆ _setOfInputDataStreamPort

◆ NAME

const char OutputDataStreamPort::NAME ="OutputDataStreamPort"
static

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