Version: 9.15.0
YACS::ENGINE::InputPort Class Referenceabstract

Base class for Input Ports. More...

#include <InputPort.hxx>

Inheritance diagram for YACS::ENGINE::InputPort:
Collaboration diagram for YACS::ENGINE::InputPort:

Public Member Functions

virtual ~InputPort ()
 
std::string getNameOfTypeOfCurrentInstance () const
 
virtual InputPortgetPublicRepresentant ()
 returns the final physical port behind 'this'. More...
 
virtual bool isIntermediate () const
 
virtual bool edIsManuallyInitialized () const
 Specifies if this port has been manually set by the call of InputPort::edInit. More...
 
bool edIsInitialized () const
 soon deprecated More...
 
template<class T >
void edInit (T value)
 
void edInit (Any *value)
 
void edInit (const std::string &impl, const void *value)
 Initialize the port with an object (value) coming from a world with implementation impl. More...
 
virtual void edRemoveManInit ()
 Removes eventually previous manual initialisation. More...
 
virtual void checkBasicConsistency () const
 Check basically that this port has one chance to be specified on time. It's a necessary condition not sufficient at all. More...
 
virtual void exInit (bool start)
 
virtual void exSaveInit ()=0
 
virtual void exRestoreInit ()=0
 
virtual InputPortclone (Node *newHelder) const =0
 
virtual bool isEmpty ()
 
virtual void * get () const =0
 
virtual void releaseData ()=0
 
virtual void put (const void *data)=0
 
virtual std::string dump ()
 
virtual std::string getHumanRepr ()
 
virtual void setStringRef (std::string strRef)
 
virtual std::string typeName ()
 
bool canBeNull () const
 
- 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::InPort
virtual int edGetNumberOfLinks () const
 Returns number of physical backlinks NOT number of user backlinks. More...
 
virtual std::set< OutPort * > edSetOutPort () const
 Returns physical backlinks NOT user backlinks. More...
 
bool canSafelySqueezeMemory () const
 
bool isBackLinked () const
 
virtual ~InPort ()
 

Static Public Attributes

static const char NAME [] ="InputPort"
 
- 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

 InputPort (const InputPort &other, Node *newHelder)
 
 InputPort (const std::string &name, Node *node, TypeCode *type, bool canBeNull=false)
 
void releaseDataUnsafe ()
 
- 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::InPort
 InPort (const InPort &other, Node *newHelder)
 
 InPort (const std::string &name, Node *node, TypeCode *type)
 
void edRemoveAllLinksLinkedWithMe ()
 
virtual void edNotifyReferencedBy (OutPort *fromPort, bool isLoopProof=true)
 
virtual void edNotifyDereferencedBy (OutPort *fromPort)
 
virtual void getAllRepresentants (std::set< InPort * > &repr) const
 

Protected Attributes

Any_initValue
 
std::string _stringRef
 
bool _canBeNull
 
- Protected Attributes inherited from YACS::ENGINE::DataPort
TypeCode_type
 
std::string _name
 
- Protected Attributes inherited from YACS::ENGINE::Port
Node_node
 
int _id
 
- Protected Attributes inherited from YACS::ENGINE::InPort
std::set< std::pair< OutPort *, bool > > _backLinks
 

Friends

class Runtime
 
class OutPort
 

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

Base class for Input Ports.

Definition at line 43 of file InputPort.hxx.

Constructor & Destructor Documentation

◆ ~InputPort()

InputPort::~InputPort ( )
virtual

Definition at line 89 of file InputPort.cxx.

90 {
91  if(_initValue)
93 }

References _initValue, and YACS::ENGINE::RefCounter::decrRef().

◆ InputPort() [1/2]

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

Definition at line 36 of file InputPort.cxx.

37  : DataFlowPort(other, newHelder),
38  InPort(other, newHelder),
39  DataPort(other, newHelder),
40  Port(other, newHelder),
41  _initValue(0),
42  _canBeNull(other._canBeNull)
43 {
44  if(other._initValue)
45  _initValue=other._initValue->clone();
46 }
virtual Any * clone() const =0
DataFlowPort(const DataFlowPort &other, Node *newHelder)
DataPort(const DataPort &other, Node *newHelder)
Definition: DataPort.cxx:41
InPort(const InPort &other, Node *newHelder)
Definition: InPort.cxx:30
Port(Node *node)
Definition: Port.cxx:34

References _initValue, and YACS::ENGINE::Any::clone().

◆ InputPort() [2/2]

InputPort::InputPort ( const std::string &  name,
Node node,
TypeCode type,
bool  canBeNull = false 
)
protected

Definition at line 48 of file InputPort.cxx.

49  : DataFlowPort(name, node, type),
50  InPort(name, node, type),
51  DataPort(name, node, type),
52  Port(node),
53  _initValue(0),
55 {
56 }
bool canBeNull() const
Definition: InputPort.cxx:174

Member Function Documentation

◆ canBeNull()

bool InputPort::canBeNull ( ) const

Definition at line 174 of file InputPort.cxx.

175 {
176  return _canBeNull;
177 }

References _canBeNull.

◆ checkBasicConsistency()

void InputPort::checkBasicConsistency ( ) const
virtual

Check basically that this port has one chance to be specified on time. It's a necessary condition not sufficient at all.

Definition at line 148 of file InputPort.cxx.

149 {
150  if(!_canBeNull && !edIsManuallyInitialized() && _backLinks.size()==0 )
151  {
152  ostringstream stream;
153  stream << "InputPort::checkBasicConsistency : Port " << _name << " of node with name " << _node->getName() << " neither initialized nor linked back";
154  throw Exception(stream.str());
155  }
156 }
std::set< std::pair< OutPort *, bool > > _backLinks
Definition: InPort.hxx:78
virtual bool edIsManuallyInitialized() const
Specifies if this port has been manually set by the call of InputPort::edInit.
Definition: InputPort.cxx:76
const std::string & getName() const
Definition: Node.hxx:125
Node * _node
Definition: Port.hxx:55

References YACS::ENGINE::InPort::_backLinks, _canBeNull, YACS::ENGINE::DataPort::_name, YACS::ENGINE::Port::_node, edIsManuallyInitialized(), and YACS::ENGINE::Node::getName().

Referenced by YACS::ENGINE::OutNode::checkBasicConsistency(), YACS::ENGINE::StudyOutNode::checkBasicConsistency(), and exInit().

◆ clone()

◆ dump()

std::string InputPort::dump ( )
virtual

Reimplemented in YACS::ENGINE::InputXmlPort, YACS::ENGINE::InputStudyPort, YACS::ENGINE::InputPyPort, YACS::ENGINE::InputPresetPort, YACS::ENGINE::InputCppPort, YACS::ENGINE::InputCorbaPort, YACS::ENGINE::SeqAnyInputPort, YACS::ENGINE::ConditionInputPort, and YACS::ENGINE::AnyInputPort.

Definition at line 158 of file InputPort.cxx.

159 {
160  string xmldump = "<value><error> NO_SERIALISATION_AVAILABLE </error></value>";
161  return xmldump;
162 }

Referenced by getHumanRepr().

◆ edInit() [1/3]

void InputPort::edInit ( Any value)

Definition at line 95 of file InputPort.cxx.

96 {
97  InputPort *manuallySet=getRuntime()->adapt(this,
99  try
100  {
101  manuallySet->put((const void *) value);
102  if(manuallySet!=this)
103  delete manuallySet;
104  }
105  catch(ConversionException&)
106  {
107  if(manuallySet!=this)
108  delete manuallySet;
109  throw;
110  }
111  exSaveInit();
112  modified();
113 }
Base class for Input Ports.
Definition: InputPort.hxx:44
virtual void put(const void *data)=0
virtual void exSaveInit()=0
void modified()
Definition: Port.cxx:53
static const char RUNTIME_ENGINE_INTERACTION_IMPL_NAME[]
Definition: Runtime.hxx:135
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::DataPort::_type, YACS::ENGINE::Runtime::adapt(), exSaveInit(), YACS::ENGINE::getRuntime(), YACS::ENGINE::Port::modified(), put(), and YACS::ENGINE::Runtime::RUNTIME_ENGINE_INTERACTION_IMPL_NAME.

◆ edInit() [2/3]

void InputPort::edInit ( const std::string &  impl,
const void *  value 
)

Initialize the port with an object (value) coming from a world with implementation impl.

You should be careful when using this method : the caller must set the context according to implementation For instance, if implementation is Python, the caller must hold the Global Interpreter Lock (also known as GIL).

Definition at line 120 of file InputPort.cxx.

121 {
122  InputPort *manuallySet=getRuntime()->adapt(this,impl,_type,true);
123  try
124  {
125  manuallySet->put(value);
126  if(manuallySet!=this)
127  delete manuallySet;
128  }
129  catch(ConversionException&)
130  {
131  if(manuallySet!=this)
132  delete manuallySet;
133  throw;
134  }
135  exSaveInit();
136  modified();
137 }

References YACS::ENGINE::DataPort::_type, YACS::ENGINE::Runtime::adapt(), exSaveInit(), YACS::ENGINE::getRuntime(), YACS::ENGINE::Port::modified(), and put().

◆ edInit() [3/3]

template<class T >
void YACS::ENGINE::InputPort::edInit ( value)

◆ edIsInitialized()

bool InputPort::edIsInitialized ( ) const

soon deprecated

Perform a quick and not complete check. Use ComposedNode::CheckConsistency instead.

Definition at line 84 of file InputPort.cxx.

85 {
86  return (edIsManuallyInitialized() || _backLinks.size()!=0 );
87 }

References YACS::ENGINE::InPort::_backLinks, and edIsManuallyInitialized().

◆ edIsManuallyInitialized()

◆ edRemoveManInit()

◆ exInit()

void InputPort::exInit ( bool  start)
virtual

Definition at line 63 of file InputPort.cxx.

64 {
66  if(start)
67  exRestoreInit();
68 }
virtual void exRestoreInit()=0
virtual void checkBasicConsistency() const
Check basically that this port has one chance to be specified on time. It's a necessary condition not...
Definition: InputPort.cxx:148

References checkBasicConsistency(), and exRestoreInit().

Referenced by YACS::ENGINE::NbBranches::exInit(), YACS::ENGINE::SplitterNode::init(), YACS::ENGINE::ForLoop::init(), YACS::ENGINE::OptimizerLoop::init(), and YACS::ENGINE::WhileLoop::init().

◆ exRestoreInit()

◆ exSaveInit()

◆ get()

◆ getHumanRepr()

std::string InputPort::getHumanRepr ( )
virtual

Reimplemented in YACS::ENGINE::InputPyPort.

Definition at line 164 of file InputPort.cxx.

165 {
166  return dump();
167 }
virtual std::string dump()
Definition: InputPort.cxx:158

References dump().

◆ getNameOfTypeOfCurrentInstance()

string InputPort::getNameOfTypeOfCurrentInstance ( ) const
virtual

Reimplemented from YACS::ENGINE::DataFlowPort.

Definition at line 58 of file InputPort.cxx.

59 {
60  return NAME;
61 }
static const char NAME[]
Definition: InputPort.hxx:48

References NAME.

◆ getPublicRepresentant()

virtual InputPort* YACS::ENGINE::InputPort::getPublicRepresentant ( )
inlinevirtual

◆ isEmpty()

◆ isIntermediate()

virtual bool YACS::ENGINE::InputPort::isIntermediate ( ) const
inlinevirtual

Reimplemented in YACS::ENGINE::ProxyPort.

Definition at line 59 of file InputPort.hxx.

59 { return false; }

◆ put()

virtual void YACS::ENGINE::InputPort::put ( const void *  data)
pure virtual

Implemented in YACS::ENGINE::XmlPython, YACS::ENGINE::InputXmlPort, YACS::ENGINE::XmlNeutral, YACS::ENGINE::XmlCpp, YACS::ENGINE::XmlCorba, YACS::ENGINE::PyXml, YACS::ENGINE::InputPyPort, YACS::ENGINE::PyNeutral, YACS::ENGINE::PyInit, YACS::ENGINE::PyCpp, YACS::ENGINE::PyCorbaStruct, YACS::ENGINE::PyCorbaSequence, YACS::ENGINE::PyCorbaObjref, YACS::ENGINE::PyCorbaBool, YACS::ENGINE::PyCorbaString, YACS::ENGINE::PyCorbaDouble, YACS::ENGINE::PyCorbaInt, YACS::ENGINE::NeutralXml, YACS::ENGINE::NeutralPyStruct, YACS::ENGINE::NeutralPySequence, YACS::ENGINE::NeutralPyObjref, YACS::ENGINE::NeutralPyBool, YACS::ENGINE::NeutralPyString, YACS::ENGINE::NeutralPyInt, YACS::ENGINE::NeutralPyDouble, YACS::ENGINE::NeutralInit, YACS::ENGINE::NeutralCpp, YACS::ENGINE::NeutralCorbaStruct, YACS::ENGINE::NeutralCorbaObjref, YACS::ENGINE::NeutralCorbaString, YACS::ENGINE::NeutralCorbaSequence, YACS::ENGINE::NeutralCorbaBool, YACS::ENGINE::NeutralCorbaDouble, YACS::ENGINE::NeutralCorbaInt, YACS::ENGINE::CppXml, YACS::ENGINE::CppPy, YACS::ENGINE::InputCppPort, YACS::ENGINE::CppNeutral, YACS::ENGINE::CppCpp, YACS::ENGINE::CppCorba, YACS::ENGINE::CorbaXml, YACS::ENGINE::CorbaPyStruct, YACS::ENGINE::CorbaPySequence, YACS::ENGINE::CorbaPyObjref, YACS::ENGINE::CorbaPyBool, YACS::ENGINE::CorbaPyString, YACS::ENGINE::CorbaPyInt, YACS::ENGINE::CorbaPyDouble, YACS::ENGINE::InputCorbaPort, YACS::ENGINE::CorbaNeutral, YACS::ENGINE::CorbaCpp, YACS::ENGINE::CorbaCorba, YACS::ENGINE::InputPort4DF2DS, YACS::ENGINE::ProxyPort, YACS::ENGINE::InPropertyPort, YACS::ENGINE::ConditionInputPort, and YACS::ENGINE::AnyInputPort.

Referenced by edInit(), YACS::ENGINE::DynParaLoop::prepareInputsFromOutOfScope(), YACS::ENGINE::CppPy::put(), YACS::ENGINE::CppCpp::put(), YACS::ENGINE::CppNeutral::put(), YACS::ENGINE::XmlCorba::put(), YACS::ENGINE::XmlCpp::put(), YACS::ENGINE::XmlNeutral::put(), YACS::ENGINE::XmlPython::put(), YACS::ENGINE::ProxyPort::put(), YACS::ENGINE::CorbaCorba::put(), YACS::ENGINE::CorbaCpp::put(), YACS::ENGINE::CorbaNeutral::put(), YACS::ENGINE::CorbaPyDouble::put(), YACS::ENGINE::CorbaPyInt::put(), YACS::ENGINE::CorbaPyString::put(), YACS::ENGINE::CorbaPyBool::put(), YACS::ENGINE::CorbaPyObjref::put(), YACS::ENGINE::CorbaPySequence::put(), YACS::ENGINE::CorbaPyStruct::put(), YACS::ENGINE::PyCorbaObjref::put(), YACS::ENGINE::PyCorbaSequence::put(), YACS::ENGINE::PyCorbaStruct::put(), YACS::ENGINE::PyInit::put(), YACS::ENGINE::PyNeutral::put(), YACS::ENGINE::NeutralCorbaString::put(), YACS::ENGINE::NeutralCorbaObjref::put(), YACS::ENGINE::NeutralCorbaStruct::put(), YACS::ENGINE::NeutralCpp::put(), YACS::ENGINE::NeutralInit::put(), and YACS::ENGINE::DynParaLoop::putValueOnBranch().

◆ releaseData()

◆ releaseDataUnsafe()

void YACS::ENGINE::InputPort::releaseDataUnsafe ( )
protected

◆ setStringRef()

void InputPort::setStringRef ( std::string  strRef)
virtual

Definition at line 169 of file InputPort.cxx.

170 {
171  _stringRef = strRef;
172 }
std::string _stringRef
Definition: InputPort.hxx:90

References _stringRef.

Referenced by YACS::ENGINE::XmlCorba::put(), and YACS::ENGINE::XmlPython::put().

◆ typeName()

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

Friends And Related Function Documentation

◆ OutPort

friend class OutPort
friend

Definition at line 46 of file InputPort.hxx.

◆ Runtime

friend class Runtime
friend

Definition at line 45 of file InputPort.hxx.

Member Data Documentation

◆ _canBeNull

bool YACS::ENGINE::InputPort::_canBeNull
protected

Definition at line 91 of file InputPort.hxx.

Referenced by canBeNull(), and checkBasicConsistency().

◆ _initValue

◆ _stringRef

std::string YACS::ENGINE::InputPort::_stringRef
protected

◆ NAME


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