Version: 8.3.0
YACS::ENGINE::InputCppPort Class Reference

Class for C++ Ports. More...

#include <CppPorts.hxx>

Inheritance diagram for YACS::ENGINE::InputCppPort:
Collaboration diagram for YACS::ENGINE::InputCppPort:

Public Member Functions

 InputCppPort (const std::string &name, Node *node, TypeCode *type)
 
 InputCppPort (const InputCppPort &other, Node *newHelder)
 
 ~InputCppPort ()
 
bool edIsManuallyInitialized () const
 Specifies if this port has been manually set by the call of InputPort::edInit. More...
 
void edRemoveManInit ()
 Removes eventually previous manual initialisation. More...
 
virtual void put (const void *data) throw (ConversionException)
 
void put (YACS::ENGINE::Any *data) throw (ConversionException)
 
InputPortclone (Node *newHelder) const
 
virtual YACS::ENGINE::AnygetCppObj () const
 
void * get () const throw (Exception)
 
virtual bool isEmpty ()
 
virtual void exSaveInit ()
 Save the current data value for further reinitialization of the port. More...
 
virtual void exRestoreInit ()
 Restore the saved data value to current data value. More...
 
virtual std::string dump ()
 
- Public Member Functions inherited from YACS::ENGINE::InputPort
virtual ~InputPort ()
 
std::string getNameOfTypeOfCurrentInstance () const
 
virtual InputPortgetPublicRepresentant ()
 returns the final physical port behind 'this'. More...
 
virtual bool isIntermediate () const
 
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 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 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 ()
 

Protected Attributes

YACS::ENGINE::Any_data
 
YACS::ENGINE::Any_initData
 
- Protected Attributes inherited from YACS::ENGINE::InputPort
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
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::DataPort
static DataPortisCrossingType (const std::vector< DataPort * > &historyOfLink)
 
- Static Public Attributes inherited from YACS::ENGINE::InputPort
static const char NAME [] ="InputPort"
 
- Protected Member Functions inherited from YACS::ENGINE::InputPort
 InputPort (const InputPort &other, Node *newHelder)
 
 InputPort (const std::string &name, Node *node, TypeCode *type, bool canBeNull=false)
 
- Static Protected Attributes inherited from YACS::ENGINE::Port
static int _total = 0
 
static const char NAME [] ="Port"
 

Detailed Description

Class for C++ Ports.

See Also
CppNode

Definition at line 39 of file CppPorts.hxx.

Constructor & Destructor Documentation

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

Definition at line 34 of file CppPorts.cxx.

Referenced by clone().

35  : InputPort(name, node, type), DataPort(name, node, type), Port(node), _data(NULL),_initData(NULL)
36 {
37 }
InputCppPort::InputCppPort ( const InputCppPort other,
Node newHelder 
)

Definition at line 48 of file CppPorts.cxx.

References _data, and _initData.

48  :InputPort(other,newHelder),DataPort(other,newHelder),Port(other,newHelder)
49 {
50  _initData=other._initData;
51  _data=other._data;
52 }
InputCppPort::~InputCppPort ( )

Definition at line 39 of file CppPorts.cxx.

References _data, DEBTRACE, YACS::ENGINE::RefCounter::decrRef(), and YACS::ENGINE::RefCounter::getRefCnt().

40 {
41  if(_data)
42  {
43  DEBTRACE("_data ref count: " << _data->getRefCnt());
44  _data->decrRef();
45  }
46 }

Member Function Documentation

InputPort * InputCppPort::clone ( Node newHelder) const
virtual

Implements YACS::ENGINE::InputPort.

Definition at line 79 of file CppPorts.cxx.

References InputCppPort().

80 {
81  return new InputCppPort(*this,newHelder);
82 }
std::string InputCppPort::dump ( )
virtual

Reimplemented from YACS::ENGINE::InputPort.

Definition at line 122 of file CppPorts.cxx.

References _data, YACS::ENGINE::InputPort::_stringRef, YACS::ENGINE::convertNeutralXml(), YACS::ENGINE::DataPort::edGetType(), and YACS::ENGINE::Objref.

123 {
124  if( _data == NULL)
125  return "<value>None</value>";
126 
127  if (edGetType()->kind() != YACS::ENGINE::Objref)
128  return convertNeutralXml(edGetType(), _data);
129  //return convertCppXml(edGetType(), _data);
130  if (! _stringRef.empty())
131  return _stringRef;
132  else
133  return convertNeutralXml(edGetType(), _data);
134 // {
135 // stringstream msg;
136 // msg << "Cannot retreive init reference string for port " << _name
137 // << " on node " << _node->getName();
138 // throw Exception(msg.str());
139 // }
140 }
bool InputCppPort::edIsManuallyInitialized ( ) const
virtual

Specifies if this port has been manually set by the call of InputPort::edInit.

Reimplemented from YACS::ENGINE::InputPort.

Definition at line 54 of file CppPorts.cxx.

References _initData.

55 {
56  return _initData!= NULL;
57 }
void InputCppPort::edRemoveManInit ( )
virtual

Removes eventually previous manual initialisation.

Reimplemented from YACS::ENGINE::InputPort.

Definition at line 59 of file CppPorts.cxx.

References _initData, and YACS::ENGINE::InputPort::edRemoveManInit().

60 {
61  _initData=NULL;
63 }
void InputCppPort::exRestoreInit ( )
virtual

Restore the saved data value to current data value.

If no data has been saved (_initData == 0) don't restore

Implements YACS::ENGINE::InputPort.

Definition at line 114 of file CppPorts.cxx.

References _data, and _initData.

115 {
116  if(!_initData)return;
118  //DEBTRACE("_initData.ob refcnt: " << _initData->ob_refcnt);
119  //DEBTRACE("_data.ob refcnt: " << _data->ob_refcnt);
120 }
void InputCppPort::exSaveInit ( )
virtual

Save the current data value for further reinitialization of the port.

Implements YACS::ENGINE::InputPort.

Definition at line 103 of file CppPorts.cxx.

References _data, and _initData.

104 {
106  //DEBTRACE("_initData.ob refcnt: " << _initData->ob_refcnt);
107  //DEBTRACE("_data.ob refcnt: " << _data->ob_refcnt);
108 }
void * InputCppPort::get ( ) const throw (Exception)
virtual

Implements YACS::ENGINE::InputPort.

Definition at line 89 of file CppPorts.cxx.

References _data.

90 {
91  return (void*) _data;
92 }
YACS::ENGINE::Any * InputCppPort::getCppObj ( ) const
virtual

Definition at line 84 of file CppPorts.cxx.

References _data.

Referenced by YACS::ENGINE::CppNode::execute().

85 {
86  return _data;
87 }
bool InputCppPort::isEmpty ( )
virtual

Reimplemented from YACS::ENGINE::InputPort.

Definition at line 94 of file CppPorts.cxx.

References _data.

95 {
96  return _data == NULL;
97 }
void InputCppPort::put ( const void *  data) throw (ConversionException)
virtual

Implements YACS::ENGINE::InputPort.

Definition at line 65 of file CppPorts.cxx.

66 {
67  put((YACS::ENGINE::Any *)data);
68 }
void InputCppPort::put ( YACS::ENGINE::Any data) throw (ConversionException)

Definition at line 70 of file CppPorts.cxx.

References DEBTRACE.

71 {
72  if(_data)
73  _data->decrRef();
74  _data=data;
75  _data->incrRef();
76  DEBTRACE("value ref count: " << _data->getRefCnt());
77 }

Member Data Documentation

YACS::ENGINE::Any* YACS::ENGINE::InputCppPort::_data
protected
YACS::ENGINE::Any* YACS::ENGINE::InputCppPort::_initData
protected

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