1 #ifndef __INPUTPORT_HXX__
2 #define __INPUTPORT_HXX__
7 #include "DataFlowPort.hxx"
8 #include "ConversionException.hxx"
9 #include "yacsconfig.h"
18 /*! \brief Base class for Input Ports
23 class InputPort : public DataFlowPort, public InPort
25 friend class Runtime; // for port creation
28 static const char NAME[];
32 std::string getNameOfTypeOfCurrentInstance() const;
33 //! returns the final physical port behind 'this'.
35 virtual InPort *getPublicRepresentant() { return this; }
37 virtual InputPort *getPublicRepresentant() { return this; }
39 virtual bool isIntermediate() const { return false; }
40 virtual bool edIsManuallyInitialized() const;
42 bool edIsInitialized() const;
46 void edInit(Any *value);
47 void edInit(const std::string& impl,const void* value);
48 virtual void edRemoveManInit();
49 virtual void checkBasicConsistency() const throw(Exception);
50 virtual void exInit(bool start);
51 virtual void exSaveInit() = 0;
52 virtual void exRestoreInit() = 0;
53 virtual InputPort *clone(Node *newHelder) const = 0;
54 virtual bool isEmpty();
56 virtual void *get() const = 0;
57 virtual void put(const void *data) throw(ConversionException) = 0;
58 virtual std::string dump();
59 virtual void setStringRef(std::string strRef);
60 virtual std::string typeName() {return "YACS__ENGINE__InputPort";}
62 InputPort(const InputPort& other, Node *newHelder);
63 InputPort(const std::string& name, Node *node, TypeCode* type);
66 std::string _stringRef;
69 /*! \brief Base class for Proxy Input Ports
74 class ProxyPort : public InputPort
77 ProxyPort(InputPort* p);
80 void edRemoveAllLinksLinkedWithMe() throw(Exception);
81 InputPort *clone(Node *newHelder) const;
82 void edNotifyReferencedBy(OutPort *fromPort);
83 void edNotifyDereferencedBy(OutPort *fromPort);
84 std::set<OutPort *> edSetOutPort() const;
86 InPort *getPublicRepresentant();
88 InputPort *getPublicRepresentant();
91 virtual void put(const void *data) throw(ConversionException) ;
92 int edGetNumberOfLinks() const;
93 bool isIntermediate() const { return true; }
96 void getAllRepresentants(std::set<InPort *>& repr) const;
97 virtual std::string typeName() {return "YACS__ENGINE__ProxyPort";}
103 void InputPort::edInit(T value)
105 InputPort *manuallySet=getRuntime()->adapt(this,
106 Runtime::RUNTIME_ENGINE_INTERACTION_IMPL_NAME,_type);
107 Any* any=AtomAny::New(value);
108 manuallySet->put((const void *) any);
109 if(manuallySet!=this)