Version: 8.3.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) throw (Exception)
 
virtual bool edAddInputDataStreamPort (InputDataStreamPort *port) throw (ConversionException)
 
int edRemoveInputDataStreamPort (InputDataStreamPort *inPort, bool forward) throw (Exception)
 
void edRemoveAllLinksLinkedWithMe () throw (Exception)
 
int removeInPort (InPort *inPort, bool forward) throw (Exception)
 
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::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::OutputDataStreamPort ( const OutputDataStreamPort other,
Node newHelder 
)

Definition at line 35 of file OutputDataStreamPort.cxx.

Referenced by clone().

35  :DataStreamPort(other,newHelder),
36  OutPort(other,newHelder),
37  DataPort(other,newHelder),
38  Port(other,newHelder)
39 {
40 }
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 ( )
virtual

Definition at line 49 of file OutputDataStreamPort.cxx.

50 {
51 }

Member Function Documentation

bool OutputDataStreamPort::addInPort ( InPort inPort) throw (Exception)
virtual

Implements YACS::ENGINE::OutPort.

Reimplemented in YACS::ENGINE::OutputCalStreamPort.

Definition at line 133 of file OutputDataStreamPort.cxx.

References DEBTRACE, and YACS::ENGINE::InputDataStreamPort::NAME.

134 {
135  DEBTRACE("OutputDataStreamPort::addInPort");
137  {
138  string what="not compatible type of port requested during building of link FROM ";
139  what+=NAME; what+=" TO "; what+=inPort->getNameOfTypeOfCurrentInstance();
140  throw Exception(what);
141  }
142  return edAddInputDataStreamPort(static_cast<InputDataStreamPort*>(inPort));
143 }
OutputDataStreamPort * OutputDataStreamPort::clone ( Node newHelder) const
virtual

Reimplemented in YACS::ENGINE::OutputCalStreamPort.

Definition at line 53 of file OutputDataStreamPort.cxx.

References OutputDataStreamPort().

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

54 {
55  return new OutputDataStreamPort(*this,newHelder);
56 }
bool OutputDataStreamPort::edAddInputDataStreamPort ( InputDataStreamPort port) throw (ConversionException)
virtual

Definition at line 86 of file OutputDataStreamPort.cxx.

References DEBTRACE.

88 {
89  DEBTRACE("OutputDataStreamPort::edAddInputDataStreamPort");
90  if(!isAlreadyInSet(port))
91  {
92  if(!port->edGetType()->isAdaptable(edGetType()))
93  {
94  string what="Can not connect 2 ports with incompatible types : ";
95  what=what+ port->edGetType()->id();
96  what=what+" is not a ";
97  what=what+ edGetType()->id();
98  throw ConversionException(what);
99  }
100  _setOfInputDataStreamPort.insert(port);
101  port->edAddOutputDataStreamPort(this);
102  return true;
103  }
104  else
105  return false;
106 }
void OutputDataStreamPort::edRemoveAllLinksLinkedWithMe ( ) throw (Exception)
virtual

Implements YACS::ENGINE::DataPort.

Definition at line 145 of file OutputDataStreamPort.cxx.

References _setOfInputDataStreamPort, and edRemoveInputDataStreamPort().

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

Definition at line 108 of file OutputDataStreamPort.cxx.

Referenced by edRemoveAllLinksLinkedWithMe().

109 {
110  if(forward)
111  {
112  set<InPort *> s;
113  inPort->getAllRepresentants(s);
114  for(set<InPort *>::iterator iter=s.begin();iter!=s.end();iter++)
115  _node->getRootNode()->edRemoveLink(this,*iter);
116  return -1;
117  }
118  else
119  {
120  set<InputDataStreamPort *>::iterator iter=_setOfInputDataStreamPort.find(inPort);
121  if(iter!=_setOfInputDataStreamPort.end())
122  {
123  (*iter)->modified();
124  _setOfInputDataStreamPort.erase(iter);
125  modified();
126  return edGetNumberOfOutLinks();
127  }
128  else
129  throw Exception("OutputDataStreamPort::edRemoveInputPort : link does not exist, unable to remove it");
130  }
131 }
std::set< InPort * > OutputDataStreamPort::edSetInPort ( ) const
virtual

Implements YACS::ENGINE::OutPort.

Definition at line 58 of file OutputDataStreamPort.cxx.

References _setOfInputDataStreamPort.

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

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

Reimplemented from YACS::ENGINE::DataStreamPort.

Reimplemented in YACS::ENGINE::OutputCalStreamPort.

Definition at line 81 of file OutputDataStreamPort.cxx.

References NAME.

82 {
83  return NAME;
84 }
bool OutputDataStreamPort::isAlreadyInSet ( InputDataStreamPort inPort) const
private

Definition at line 166 of file OutputDataStreamPort.cxx.

References _setOfInputDataStreamPort.

167 {
168  return _setOfInputDataStreamPort.find(inPort)!=_setOfInputDataStreamPort.end();
169 }
bool OutputDataStreamPort::isAlreadyLinkedWith ( InPort withp) const
virtual

Implements YACS::ENGINE::OutPort.

Definition at line 66 of file OutputDataStreamPort.cxx.

References _setOfInputDataStreamPort.

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 }
int OutputDataStreamPort::removeInPort ( InPort inPort,
bool  forward 
) throw (Exception)
virtual

Implements YACS::ENGINE::OutPort.

Reimplemented in YACS::ENGINE::OutputCalStreamPort.

Definition at line 154 of file OutputDataStreamPort.cxx.

References DEBTRACE, and YACS::ENGINE::InputDataStreamPort::NAME.

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

friend class ElementaryNode
friend

Definition at line 39 of file OutputDataStreamPort.hxx.

Member Data Documentation

std::set<InputDataStreamPort *> YACS::ENGINE::OutputDataStreamPort::_setOfInputDataStreamPort
protected
const char OutputDataStreamPort::NAME ="OutputDataStreamPort"
static

Definition at line 43 of file OutputDataStreamPort.hxx.

Referenced by getNameOfTypeOfCurrentInstance().


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