1 #ifndef __TOYNODE_HXX__
2 #define __TOYNODE_HXX__
4 #include "ServiceNode.hxx"
5 #include "AnyInputPort.hxx"
6 #include "OutputPort.hxx"
7 #include "InputPort.hxx"
14 class InputToyPort : public InputPort
17 InputToyPort(const InputToyPort& other, Node *newHelder);
18 InputToyPort(const std::string& name, Node *node);
19 void put(const void *data) throw(ConversionException);
20 InputPort *clone(Node *newHelder) const;
21 bool edIsManuallyInitialized() const;
22 void *get() const throw(Exception);
23 void edRemoveManInit();
26 Any *getAny() { return _data; }
34 class OutputToyPort : public OutputPort
37 OutputToyPort(const std::string& name, Node *node, TypeCode *type);
38 OutputToyPort(const OutputToyPort& other, Node *newHelder);
39 void put(const void *data) throw(ConversionException);
40 OutputPort *clone(Node *newHelder) const;
44 Any *get() { return _data; }
49 class ToyNode : public ElementaryNode
52 OutputToyPort _nbOfInputsPort;
55 ToyNode(const ToyNode& other, ComposedNode *father);
56 ToyNode(const std::string& name);
57 OutputPort *edGetNbOfInputsOutputPort() { return &_nbOfInputsPort; }
58 std::list<OutputPort *> getSetOfOutputPort() const;
59 int getNumberOfOutputPorts()const;
60 OutputPort *getOutputPort(const std::string& name) const throw(Exception);
62 Node *simpleClone(ComposedNode *father, bool editionOnly) const;
64 static char NAME_FOR_NB[];
65 static char MY_IMPL_NAME[];
68 class ToyNode1S : public ServiceNode
71 ToyNode1S(const std::string& name);
72 ToyNode1S(const ToyNode1S& other, ComposedNode *father);
74 std::string getKind() const;
75 ServiceNode *createNode(const std::string& name);
77 Node *simpleClone(ComposedNode *father, bool editionOnly) const;
79 static const char KIND[];
82 class ToyNode2S : public ServiceNode
85 ToyNode2S(const std::string& name);
86 ToyNode2S(const ToyNode2S& other, ComposedNode *father);
88 std::string getKind() const;
89 ServiceNode *createNode(const std::string& name);
91 Node *simpleClone(ComposedNode *father, bool editionOnly) const;
93 static const char KIND[];
96 class SeqToyNode : public ElementaryNode
99 OutputToyPort _seqOut;
100 AnyInputPort _inIntValue;
103 SeqToyNode(const SeqToyNode& other, ComposedNode *father);
104 SeqToyNode(const std::string& name);
105 OutputPort *edGetSeqOut() const { return (OutputPort *)&_seqOut; }
106 InputPort *edGetInIntValue() const { return (InputPort *)&_inIntValue; }
107 int getNumberOfInputPorts() const;
108 std::list<InputPort *> getSetOfInputPort() const;
109 InputPort *getInputPort(const std::string& name) const throw(Exception);
110 int getNumberOfOutputPorts() const;
111 std::list<OutputPort *> getSetOfOutputPort() const;
112 OutputPort *getOutputPort(const std::string& name) const throw(Exception);
114 Node *simpleClone(ComposedNode *father, bool editionOnly) const;
116 static char NAME_NBOFELTS_INSEQ_INPRT[];
117 static char NAME_SEQ_OUTPRT[];
120 class Seq2ToyNode : public ElementaryNode
123 OutputToyPort _seqOut;
124 AnyInputPort _inValue1;
125 AnyInputPort _inValue2;
128 Seq2ToyNode(const Seq2ToyNode& other, ComposedNode *father);
129 Seq2ToyNode(const std::string& name);
130 OutputToyPort *edGetSeqOut() const { return (OutputToyPort *)&_seqOut; }
131 InputPort *edGetInValue1() const { return (InputPort *)&_inValue1; }
132 InputPort *edGetInValue2() const { return (InputPort *)&_inValue2; }
133 int getNumberOfInputPorts() const;
134 std::list<InputPort *> getSetOfInputPort() const;
135 InputPort *getInputPort(const std::string& name) const throw(Exception);
136 int getNumberOfOutputPorts() const;
137 std::list<OutputPort *> getSetOfOutputPort() const;
138 OutputPort *getOutputPort(const std::string& name) const throw(Exception);
140 Node *simpleClone(ComposedNode *father, bool editionOnly) const;
142 static char NAME_SEQ_INPRT1[];
143 static char NAME_SEQ_INPRT2[];
144 static char NAME_SEQ_OUTPRT[];
147 class Seq3ToyNode : public ElementaryNode
150 OutputToyPort _seqOut;
151 AnyInputPort _inValue1;
152 AnyInputPort _inValue2;
155 Seq3ToyNode(const Seq3ToyNode& other, ComposedNode *father);
156 Seq3ToyNode(const std::string& name);
157 OutputToyPort *edGetSeqOut() const { return (OutputToyPort *)&_seqOut; }
158 InputPort *edGetInValue1() const { return (InputPort *)&_inValue1; }
159 InputPort *edGetInValue2() const { return (InputPort *)&_inValue2; }
160 int getNumberOfInputPorts() const;
161 std::list<InputPort *> getSetOfInputPort() const;
162 InputPort *getInputPort(const std::string& name) const throw(Exception);
163 int getNumberOfOutputPorts() const;
164 std::list<OutputPort *> getSetOfOutputPort() const;
165 OutputPort *getOutputPort(const std::string& name) const throw(Exception);
167 Node *simpleClone(ComposedNode *father, bool editionOnly) const;
169 static char NAME_SEQ_INPRT1[];
170 static char NAME_SEQ_INPRT2[];
171 static char NAME_SEQ_OUTPRT[];
176 class InputLimitPort : public InputPort
178 friend class LimitNode;
180 void put(const void *data) throw(ConversionException);
181 InputPort *clone(Node *newHelder) const;
182 bool edIsManuallyInitialized() const;
183 void *get() const throw(Exception);
184 void edRemoveManInit();
187 Any *getAny() { return _data; }
189 void exRestoreInit();
191 InputLimitPort(const InputLimitPort& other, Node *newHelder);
192 InputLimitPort(const std::string& name, Node *node);
198 class OutputLimitPort : public OutputPort
200 friend class LimitNode;
202 void put(const void *data) throw(ConversionException);
203 OutputPort *clone(Node *newHelder) const;
206 Any *get() { return _data; }
208 OutputLimitPort(const OutputLimitPort& other, Node *newHelder);
209 OutputLimitPort(const std::string& name, Node *node, TypeCode *type);
214 class LimitNode : public ElementaryNode
219 InputLimitPort _entry;
220 OutputLimitPort _switchPort;
221 OutputLimitPort _counterPort;
223 void init(bool start=true);
225 void setLimit(double limit) { _limit=limit; }
226 InputPort *getEntry() { return &_entry; }
227 OutputPort *getSwitchPort() { return &_switchPort; }
228 OutputPort *getCounterPort() { return &_counterPort; }
229 std::list<InputPort *> getSetOfInputPort() const;
230 std::list<OutputPort *> getSetOfOutputPort() const;
231 InputPort *getInputPort(const std::string& name) const throw(Exception);
232 OutputPort *getOutputPort(const std::string& name) const throw(Exception);
233 LimitNode(const LimitNode& other, ComposedNode *father);
234 LimitNode(const std::string& name);
236 Node *simpleClone(ComposedNode *father, bool editionOnly) const;
238 static char MY_IMPL_NAME[];
239 static char NAME_FOR_SWPORT[];
240 static char NAME_FOR_SWPORT2[];