1 #include "ConditionInputPort.hxx"
2 #include "WhileLoop.hxx"
3 #include "OutputPort.hxx"
7 using namespace YACS::ENGINE;
10 ConditionInputPort::ConditionInputPort(const std::string& name, WhileLoop *node):InputPort(name,node,Runtime::_tc_bool),
11 DataPort(name,node,Runtime::_tc_bool),
12 Port(node),_outOfScopeBackLink(0),_value(0)
16 ConditionInputPort::ConditionInputPort(const ConditionInputPort& other, Node *newHelder):InputPort(other,newHelder),
17 DataPort(other,newHelder),Port(other,newHelder),
18 _outOfScopeBackLink(0),_value(0)
21 _value=other._value->clone();
24 ConditionInputPort::~ConditionInputPort()
30 void ConditionInputPort::exSaveInit()
32 if(_initValue) _initValue->decrRef();
34 _initValue->incrRef();
37 void ConditionInputPort::exRestoreInit()
47 InputPort *ConditionInputPort::clone(Node *newHelder) const
49 return new ConditionInputPort(*this,newHelder);
52 bool ConditionInputPort::isLinkedOutOfScope() const
54 return _outOfScopeBackLink!=0;
57 void ConditionInputPort::edNotifyReferencedBy(OutPort *fromPort)
59 if(!((ComposedNode*)(_node))->isInMyDescendance(fromPort->getNode()))
61 if(_outOfScopeBackLink)
62 throw Exception("ConditionInputPort::edNotifyReferenced : already linked from outside");
63 _outOfScopeBackLink=fromPort;
66 InputPort::edNotifyReferencedBy(fromPort);
69 void ConditionInputPort::edNotifyDereferencedBy(OutPort *fromPort)
71 if(fromPort==_outOfScopeBackLink)
72 _outOfScopeBackLink=0;
74 if(!((ComposedNode*)(_node))->isInMyDescendance(fromPort->getNode()))
75 throw Exception("ConditionInputPort::edNotifyDereferencedBy link does not exists");
76 InputPort::edNotifyDereferencedBy(fromPort);
79 void *ConditionInputPort::get() const
81 return (void *)_value;
84 void ConditionInputPort::put(const void *data) throw(ConversionException)
86 Any *dataCst=(Any *)data;
93 std::string ConditionInputPort::dump()
96 if (_value->getBoolValue())
97 xmldump="<value><boolean>true</boolean></value>\n";
99 xmldump="<value><boolean>false</boolean></value>\n";