Version: 8.3.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 throw (Exception)
 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 put (const void *data)=0 throw (ConversionException)
 
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...
 
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)
 
- 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 () throw (Exception)
 
virtual void edNotifyReferencedBy (OutPort *fromPort)
 
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::InPort
std::set< OutPort * > _backLinks
 
- 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 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 ( )
virtual

Definition at line 89 of file InputPort.cxx.

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

90 {
91  if(_initValue)
93 }
InputPort::InputPort ( const InputPort other,
Node newHelder 
)
protected

Definition at line 36 of file InputPort.cxx.

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

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 }
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 }

Member Function Documentation

bool InputPort::canBeNull ( ) const

Definition at line 174 of file InputPort.cxx.

References _canBeNull.

175 {
176  return _canBeNull;
177 }
void InputPort::checkBasicConsistency ( ) const throw (Exception)
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.

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

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::string InputPort::dump ( )
virtual

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

Definition at line 158 of file InputPort.cxx.

Referenced by getHumanRepr().

159 {
160  string xmldump = "<value><error> NO_SERIALISATION_AVAILABLE </error></value>";
161  return xmldump;
162 }
void InputPort::edInit ( Any value)

Definition at line 95 of file InputPort.cxx.

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.

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 }
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.

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

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 }
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.

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

85 {
86  return (edIsManuallyInitialized() || _backLinks.size()!=0 );
87 }
bool InputPort::edIsManuallyInitialized ( ) const
virtual
void InputPort::exInit ( bool  start)
virtual
std::string InputPort::getHumanRepr ( )
virtual

Reimplemented in YACS::ENGINE::InputPyPort.

Definition at line 164 of file InputPort.cxx.

References dump().

165 {
166  return dump();
167 }
string InputPort::getNameOfTypeOfCurrentInstance ( ) const
virtual

Reimplemented from YACS::ENGINE::DataFlowPort.

Definition at line 58 of file InputPort.cxx.

References NAME.

59 {
60  return NAME;
61 }
virtual InputPort* YACS::ENGINE::InputPort::getPublicRepresentant ( )
inlinevirtual

returns the final physical port behind 'this'.

Reimplemented from YACS::ENGINE::InPort.

Reimplemented in YACS::ENGINE::ProxyPort, and YACS::ENGINE::InPropertyPort.

Definition at line 57 of file InputPort.hxx.

Referenced by YACS::ENGINE::ProxyPort::getPublicRepresentant(), YACS::ENGINE::OptimizerLoop::initInterceptors(), and YACS::ENGINE::OutputPort::isAlreadyInSet().

57 { return this; }
virtual bool YACS::ENGINE::InputPort::isIntermediate ( ) const
inlinevirtual

Reimplemented in YACS::ENGINE::ProxyPort.

Definition at line 59 of file InputPort.hxx.

59 { return false; }
virtual void YACS::ENGINE::InputPort::put ( const void *  data) throw (ConversionException)
pure virtual

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

Referenced by edInit(), YACS::ENGINE::DynParaLoop::prepareInputsFromOutOfScope(), and YACS::ENGINE::DynParaLoop::putValueOnBranch().

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

Definition at line 169 of file InputPort.cxx.

References _stringRef.

170 {
171  _stringRef = strRef;
172 }
virtual std::string YACS::ENGINE::InputPort::typeName ( )
inlinevirtual

Friends And Related Function Documentation

friend class OutPort
friend

Definition at line 46 of file InputPort.hxx.

friend class Runtime
friend

Definition at line 45 of file InputPort.hxx.

Member Data Documentation

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

Definition at line 89 of file InputPort.hxx.

Referenced by canBeNull(), and checkBasicConsistency().

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

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