Version: 9.15.0
YACS::ENGINE::ConditionInputPort Class Reference

#include <ConditionInputPort.hxx>

Inheritance diagram for YACS::ENGINE::ConditionInputPort:
Collaboration diagram for YACS::ENGINE::ConditionInputPort:

Public Member Functions

void exSaveInit ()
 
void exRestoreInit ()
 
bool isLinkedOutOfScope () const
 
void edNotifyReferencedBy (OutPort *fromPort, bool isLoopProof) override
 
void edNotifyDereferencedBy (OutPort *fromPort)
 
void * get () const
 
virtual void put (const void *data)
 
void put (Any *data)
 
void releaseData () override
 
std::string dump ()
 
virtual std::string getAsString ()
 returns port value as a string that can be used in a GUI for example More...
 
bool getValue () const
 
virtual std::string typeName ()
 
- 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
 
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 bool isEmpty ()
 
virtual std::string getHumanRepr ()
 
virtual void setStringRef (std::string strRef)
 
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
 
- 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

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

Private Member Functions

 ConditionInputPort (const std::string &name, WhileLoop *node)
 
 ConditionInputPort (const ConditionInputPort &other, Node *newHelder)
 
virtual ~ConditionInputPort ()
 
InputPortclone (Node *newHelder) const
 

Private Attributes

OutPort_outOfScopeBackLink
 

Friends

class WhileLoop
 

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

Definition at line 32 of file ConditionInputPort.hxx.

Constructor & Destructor Documentation

◆ ConditionInputPort() [1/2]

ConditionInputPort::ConditionInputPort ( const std::string &  name,
WhileLoop node 
)
private

Definition at line 29 of file ConditionInputPort.cxx.

29  :InputPort(name,node,Runtime::_tc_bool),
30  DataPort(name,node,Runtime::_tc_bool),
31  Port(node),_outOfScopeBackLink(0),_value(0)
32 {
33 }
DataPort(const DataPort &other, Node *newHelder)
Definition: DataPort.cxx:41
InputPort(const InputPort &other, Node *newHelder)
Definition: InputPort.cxx:36
Port(Node *node)
Definition: Port.cxx:34
static YACS::ENGINE::TypeCode * _tc_bool
Definition: Runtime.hxx:138

Referenced by clone().

◆ ConditionInputPort() [2/2]

ConditionInputPort::ConditionInputPort ( const ConditionInputPort other,
Node newHelder 
)
private

Definition at line 35 of file ConditionInputPort.cxx.

35  :InputPort(other,newHelder),
36  DataPort(other,newHelder),Port(other,newHelder),
38 {
39  if(other._value)
40  _value=other._value->clone();
41 }
virtual Any * clone() const =0

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

◆ ~ConditionInputPort()

ConditionInputPort::~ConditionInputPort ( )
privatevirtual

Definition at line 43 of file ConditionInputPort.cxx.

44 {
45  if(_value)
46  _value->decrRef();
47 }

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

Member Function Documentation

◆ clone()

InputPort * ConditionInputPort::clone ( Node newHelder) const
privatevirtual

Implements YACS::ENGINE::InputPort.

Definition at line 66 of file ConditionInputPort.cxx.

67 {
68  return new ConditionInputPort(*this,newHelder);
69 }
ConditionInputPort(const std::string &name, WhileLoop *node)

References ConditionInputPort().

◆ dump()

std::string ConditionInputPort::dump ( )
virtual

Reimplemented from YACS::ENGINE::InputPort.

Definition at line 121 of file ConditionInputPort.cxx.

122 {
123  string xmldump;
124  if (_value->getBoolValue())
125  xmldump="<value><boolean>true</boolean></value>\n";
126  else
127  xmldump="<value><boolean>false</boolean></value>\n";
128  return xmldump;
129 }
virtual bool getBoolValue() const =0

References _value, and YACS::ENGINE::Any::getBoolValue().

◆ edNotifyDereferencedBy()

void ConditionInputPort::edNotifyDereferencedBy ( OutPort fromPort)
virtual

Reimplemented from YACS::ENGINE::InPort.

Definition at line 87 of file ConditionInputPort.cxx.

88 {
89  if(fromPort==_outOfScopeBackLink)
91  else
92  if(!((ComposedNode*)(_node))->isInMyDescendance(fromPort->getNode()))
93  throw Exception("ConditionInputPort::edNotifyDereferencedBy link does not exists");
95 }
Base class for all composed nodes.
virtual void edNotifyDereferencedBy(OutPort *fromPort)
Definition: InPort.cxx:102
Node * getNode() const
Definition: Port.hxx:46
Node * _node
Definition: Port.hxx:55

References YACS::ENGINE::Port::_node, _outOfScopeBackLink, YACS::ENGINE::InPort::edNotifyDereferencedBy(), and YACS::ENGINE::Port::getNode().

◆ edNotifyReferencedBy()

void ConditionInputPort::edNotifyReferencedBy ( OutPort fromPort,
bool  isLoopProof 
)
overridevirtual
Parameters
[in]isLoopProof- Tells if the data coming from fromPort will be send again in case of this is initialized. This value is important if this is an InPort of a Node contained directly or not inside a Loop, ForEachLoop, OptimizerLoop. In this case, to optimize memory consumption (see squeezeMemory method), we need to know if data coming from fromPort will be generated again in case. If true (the default) it means that for that link is a link loop proof so no need to take care. If false, the link is not loop proof so event in the context of agressive memory management the data can't be safely released.

Reimplemented from YACS::ENGINE::InPort.

Definition at line 76 of file ConditionInputPort.cxx.

77 {
78  if(!((ComposedNode*)(_node))->isInMyDescendance(fromPort->getNode()))
79  {
81  throw Exception("ConditionInputPort::edNotifyReferenced : already linked from outside");
82  _outOfScopeBackLink=fromPort;
83  }
84  InputPort::edNotifyReferencedBy(fromPort,isLoopProof);
85 }
virtual void edNotifyReferencedBy(OutPort *fromPort, bool isLoopProof=true)
Definition: InPort.cxx:93

References YACS::ENGINE::Port::_node, _outOfScopeBackLink, YACS::ENGINE::InPort::edNotifyReferencedBy(), and YACS::ENGINE::Port::getNode().

◆ exRestoreInit()

void ConditionInputPort::exRestoreInit ( )
virtual

◆ exSaveInit()

void ConditionInputPort::exSaveInit ( )
virtual

◆ get()

void * ConditionInputPort::get ( ) const
virtual

Implements YACS::ENGINE::InputPort.

Definition at line 97 of file ConditionInputPort.cxx.

98 {
99  return (void *)_value;
100 }

References _value.

◆ getAsString()

std::string ConditionInputPort::getAsString ( )
virtual

returns port value as a string that can be used in a GUI for example

Do nothing here. To subclass

Reimplemented from YACS::ENGINE::DataPort.

Definition at line 131 of file ConditionInputPort.cxx.

132 {
133  return (getValue() ? "True" : "False");
134 }

References getValue().

◆ getValue()

bool YACS::ENGINE::ConditionInputPort::getValue ( ) const
inline

◆ isLinkedOutOfScope()

bool ConditionInputPort::isLinkedOutOfScope ( ) const

Definition at line 71 of file ConditionInputPort.cxx.

72 {
73  return _outOfScopeBackLink!=0;
74 }

References _outOfScopeBackLink.

Referenced by YACS::ENGINE::WhileLoop::exUpdateState().

◆ put() [1/2]

void ConditionInputPort::put ( Any data)

Definition at line 114 of file ConditionInputPort.cxx.

115 {
117  _value=data;
118  _value->incrRef();
119 }

References _value, YACS::ENGINE::RefCounter::incrRef(), and releaseData().

◆ put() [2/2]

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

Implements YACS::ENGINE::InputPort.

Definition at line 102 of file ConditionInputPort.cxx.

103 {
104  put((Any*)data);
105 }
: Interface for management of storage of data formated dynamically in its TypeCode....
Definition: Any.hxx:79
virtual void put(const void *data)

◆ releaseData()

void ConditionInputPort::releaseData ( )
overridevirtual

Implements YACS::ENGINE::InputPort.

Definition at line 107 of file ConditionInputPort.cxx.

108 {
109  if(_value)
110  _value->decrRef();
111  _value=nullptr;
112 }

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

Referenced by put().

◆ typeName()

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

Reimplemented from YACS::ENGINE::InputPort.

Definition at line 57 of file ConditionInputPort.hxx.

57 {return "YACS__ENGINE__ConditionInputPort";}

Friends And Related Function Documentation

◆ WhileLoop

friend class WhileLoop
friend

Definition at line 34 of file ConditionInputPort.hxx.

Member Data Documentation

◆ _outOfScopeBackLink

OutPort* YACS::ENGINE::ConditionInputPort::_outOfScopeBackLink
private

◆ _value

Any* YACS::ENGINE::ConditionInputPort::_value
protected

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