Version: 9.15.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)
 
void put (YACS::ENGINE::Any *data)
 
void releaseData () override
 
InputPortclone (Node *newHelder) const
 
virtual YACS::ENGINE::AnygetCppObj () const
 
void * get () const
 
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
 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...
 
bool canSafelySqueezeMemory () const
 
bool isBackLinked () const
 
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::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
 

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"
 
- 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 inherited from YACS::ENGINE::InputPort
 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
 
- 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() [1/2]

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

Definition at line 34 of file CppPorts.cxx.

35  : InputPort(name, node, type), DataPort(name, node, type), Port(node), _data(NULL),_initData(NULL)
36 {
37 }
DataPort(const DataPort &other, Node *newHelder)
Definition: DataPort.cxx:41
YACS::ENGINE::Any * _initData
Definition: CppPorts.hxx:59
YACS::ENGINE::Any * _data
Definition: CppPorts.hxx:58
InputPort(const InputPort &other, Node *newHelder)
Definition: InputPort.cxx:36
Port(Node *node)
Definition: Port.cxx:34

Referenced by clone().

◆ InputCppPort() [2/2]

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

Definition at line 48 of file CppPorts.cxx.

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

References _data, and _initData.

◆ ~InputCppPort()

InputCppPort::~InputCppPort ( )

Definition at line 39 of file CppPorts.cxx.

40 {
41  if(_data)
42  {
43  DEBTRACE("_data ref count: " << _data->getRefCnt());
44  _data->decrRef();
45  }
46 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
unsigned int getRefCnt() const
Definition: RefCounter.hxx:32

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

Member Function Documentation

◆ clone()

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

Implements YACS::ENGINE::InputPort.

Definition at line 85 of file CppPorts.cxx.

86 {
87  return new InputCppPort(*this,newHelder);
88 }
InputCppPort(const std::string &name, Node *node, TypeCode *type)
Definition: CppPorts.cxx:34

References InputCppPort().

◆ dump()

std::string InputCppPort::dump ( )
virtual

Reimplemented from YACS::ENGINE::InputPort.

Definition at line 128 of file CppPorts.cxx.

129 {
130  if( _data == NULL)
131  return "<value>None</value>";
132 
133  if (edGetType()->kind() != YACS::ENGINE::Objref)
134  return convertNeutralXml(edGetType(), _data);
135  //return convertCppXml(edGetType(), _data);
136  if (! _stringRef.empty())
137  return _stringRef;
138  else
139  return convertNeutralXml(edGetType(), _data);
140 // {
141 // stringstream msg;
142 // msg << "Cannot retreive init reference string for port " << _name
143 // << " on node " << _node->getName();
144 // throw Exception(msg.str());
145 // }
146 }
TypeCode * edGetType() const
Definition: DataPort.hxx:53
std::string _stringRef
Definition: InputPort.hxx:90
std::string convertNeutralXml(const TypeCode *t, YACS::ENGINE::Any *data)

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

◆ edIsManuallyInitialized()

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.

55 {
56  return _initData!= NULL;
57 }

References _initData.

◆ edRemoveManInit()

void InputCppPort::edRemoveManInit ( )
virtual

Removes eventually previous manual initialisation.

Reimplemented from YACS::ENGINE::InputPort.

Definition at line 59 of file CppPorts.cxx.

60 {
61  _initData=NULL;
63 }
virtual void edRemoveManInit()
Removes eventually previous manual initialisation.
Definition: InputPort.cxx:140

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

◆ exRestoreInit()

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 120 of file CppPorts.cxx.

121 {
122  if(!_initData)return;
124  //DEBTRACE("_initData.ob refcnt: " << _initData->ob_refcnt);
125  //DEBTRACE("_data.ob refcnt: " << _data->ob_refcnt);
126 }

References _data, and _initData.

◆ exSaveInit()

void InputCppPort::exSaveInit ( )
virtual

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

Implements YACS::ENGINE::InputPort.

Definition at line 109 of file CppPorts.cxx.

110 {
112  //DEBTRACE("_initData.ob refcnt: " << _initData->ob_refcnt);
113  //DEBTRACE("_data.ob refcnt: " << _data->ob_refcnt);
114 }

References _data, and _initData.

◆ get()

void * InputCppPort::get ( ) const
virtual

Implements YACS::ENGINE::InputPort.

Definition at line 95 of file CppPorts.cxx.

96 {
97  return (void*) _data;
98 }

References _data.

◆ getCppObj()

YACS::ENGINE::Any * InputCppPort::getCppObj ( ) const
virtual

Definition at line 90 of file CppPorts.cxx.

91 {
92  return _data;
93 }

References _data.

◆ isEmpty()

bool InputCppPort::isEmpty ( )
virtual

Reimplemented from YACS::ENGINE::InputPort.

Definition at line 100 of file CppPorts.cxx.

101 {
102  return _data == NULL;
103 }

References _data.

◆ put() [1/2]

void InputCppPort::put ( const void *  data)
virtual

Implements YACS::ENGINE::InputPort.

Definition at line 65 of file CppPorts.cxx.

66 {
67  put((YACS::ENGINE::Any *)data);
68 }
: Interface for management of storage of data formated dynamically in its TypeCode....
Definition: Any.hxx:79
virtual void put(const void *data)
Definition: CppPorts.cxx:65

◆ put() [2/2]

void InputCppPort::put ( YACS::ENGINE::Any data)

Definition at line 77 of file CppPorts.cxx.

78 {
79  releaseData();
80  _data=data;
81  _data->incrRef();
82  DEBTRACE("value ref count: " << _data->getRefCnt());
83 }
void releaseData() override
Definition: CppPorts.cxx:70

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

◆ releaseData()

void InputCppPort::releaseData ( )
overridevirtual

Implements YACS::ENGINE::InputPort.

Definition at line 70 of file CppPorts.cxx.

71 {
72  if(_data)
73  _data->decrRef();
74  _data=nullptr;
75 }

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

Referenced by put().

Member Data Documentation

◆ _data

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

◆ _initData

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

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