Salome HOME
merge from branch DEV tag mergeto_trunk_04apr08
[modules/yacs.git] / src / engine / Test / ToyNode.cxx
1 #include "ToyNode.hxx"
2 #include "TypeCode.hxx"
3 #include <iostream>
4
5 using namespace YACS::ENGINE;
6 using namespace std;
7
8 char ToyNode::MY_IMPL_NAME[]="TOY";
9
10 const char ToyNode1S::KIND[]="TESTKIND1";
11
12 const char ToyNode2S::KIND[]="TESTKIND2";
13
14 char LimitNode::MY_IMPL_NAME[]="LIMIT";
15
16 char ToyNode::NAME_FOR_NB[]="NbOfEntries";
17
18 char SeqToyNode::NAME_NBOFELTS_INSEQ_INPRT[]="NbOfEltsInSeq";
19
20 char SeqToyNode::NAME_SEQ_OUTPRT[]="MySeq";
21
22 char Seq2ToyNode::NAME_SEQ_INPRT1[]="SeqIn1";
23
24 char Seq2ToyNode::NAME_SEQ_INPRT2[]="SeqIn2";
25
26 char Seq2ToyNode::NAME_SEQ_OUTPRT[]="SeqOut";
27
28 char Seq3ToyNode::NAME_SEQ_INPRT1[]="SeqIn1";
29
30 char Seq3ToyNode::NAME_SEQ_INPRT2[]="SeqIn2";
31
32 char Seq3ToyNode::NAME_SEQ_OUTPRT[]="SeqOut";
33
34 char LimitNode::NAME_FOR_SWPORT[]="SwitchPort";
35
36 char LimitNode::NAME_FOR_SWPORT2[]="SwitchPort2";
37
38 InputToyPort::InputToyPort(const InputToyPort& other, Node *newHelder):InputPort(other,newHelder),DataPort(other,newHelder),Port(other,newHelder),
39                                                                        _data(0),_initData(0)
40 {
41   if(other._data)
42     _data=other._data->clone();
43   if(other._initData)
44     _initData=other._initData->clone();
45 }
46
47 InputToyPort::InputToyPort(const string& name, Node *node):InputPort(name, node, Runtime::_tc_double),DataPort(name, node, Runtime::_tc_double),Port(node),_data(0),_initData(0)
48 {
49 }
50
51 void InputToyPort::put(const void *data) throw(ConversionException)
52 {
53   put((Any *)data);
54 }
55
56 bool InputToyPort::edIsManuallyInitialized() const
57 {
58   return _initData!=0;
59 }
60
61 void *InputToyPort::get() const throw(Exception)
62 {
63   return (void *)_data;
64 }
65
66 void InputToyPort::edRemoveManInit()
67 {
68   if(_initData)
69     _initData->decrRef();
70   _initData=0;
71   InputPort::edRemoveManInit();
72 }
73
74 InputPort *InputToyPort::clone(Node *newHelder) const
75 {
76   return new InputToyPort(*this,newHelder);
77 }
78
79 void InputToyPort::put(Any *data)
80 {
81   if(_data)
82     _data->decrRef();
83   _data=data;
84   _data->incrRef();
85 }
86
87 void InputToyPort::exSaveInit()
88   {
89     if(_initData) _initData->decrRef();
90     _initData=_data;
91     _initData->incrRef();
92   }
93
94 void InputToyPort::exRestoreInit()
95   {
96     if(!_initData)return;
97     if(_data) _data->decrRef();
98     _data=_initData;
99     _data->incrRef();
100   }
101
102 InputToyPort::~InputToyPort()
103 {
104   if(_data)
105     _data->decrRef();
106   if(_initData)
107     _initData->decrRef();
108 }
109
110 OutputToyPort::OutputToyPort(const string& name, Node *node, TypeCode *type):OutputPort(name, node, type),DataPort(name, node, type),Port(node),_data(0)
111 {
112 }
113
114 OutputToyPort::OutputToyPort(const OutputToyPort& other, Node *newHelder):OutputPort(other,newHelder),DataPort(other,newHelder),Port(other,newHelder),_data(0)
115 {
116   if(other._data)
117     _data=other._data->clone();
118 }
119
120 void OutputToyPort::put(const void *data) throw(ConversionException)
121 {
122   put((Any *)data);
123   OutputPort::put(data);
124 }
125
126 OutputPort *OutputToyPort::clone(Node *newHelder) const
127 {
128   return new OutputToyPort(*this,newHelder);
129 }
130
131 void OutputToyPort::put(Any *data)
132 {
133   if(_data)
134     _data->decrRef();
135   _data=data;
136   _data->incrRef();
137 }
138
139 OutputToyPort::~OutputToyPort()
140 {
141   if(_data)
142     _data->decrRef();
143 }
144
145 void OutputToyPort::exInit()
146 {
147   if(_data)
148     {
149       _data->decrRef();
150       _data=0;
151     }
152 }
153
154 ToyNode::ToyNode(const ToyNode& other, ComposedNode *father):ElementaryNode(other,father),_nbOfInputsPort(other._nbOfInputsPort,this)
155 {
156 }
157
158 ToyNode::ToyNode(const string& name):ElementaryNode(name),_nbOfInputsPort(NAME_FOR_NB,this,Runtime::_tc_int)
159 {
160   _implementation=MY_IMPL_NAME;
161 }
162
163 void ToyNode::execute()
164 {
165   int i=0;
166   double d=0.;
167   for(list<InputPort *>::iterator iter=_setOfInputPort.begin();iter!=_setOfInputPort.end();iter++)
168     {
169       i++;
170       InputToyPort *p=(InputToyPort *) (*iter);
171       d+=p->getAny()->getDoubleValue();
172     }
173   int size=_setOfOutputPort.size();
174   if(size)
175     d/=(double)(size);
176   Any *tmp=AtomAny::New((int)_setOfInputPort.size());
177   _nbOfInputsPort.put((const void *)tmp);
178   tmp->decrRef();
179   for(list<OutputPort *>::iterator iter2=_setOfOutputPort.begin();iter2!=_setOfOutputPort.end();iter2++)
180     {
181       Any *tmp=AtomAny::New(d);
182       (*iter2)->put(tmp);
183       tmp->decrRef();
184     }
185 }
186
187 std::list<OutputPort *> ToyNode::getSetOfOutputPort() const
188 {
189   list<OutputPort *> ret=ElementaryNode::getSetOfOutputPort();
190   ret.push_back((OutputPort *)&_nbOfInputsPort);
191   return ret;
192 }
193
194 int ToyNode::getNumberOfOutputPorts() const
195 {
196   return ElementaryNode::getNumberOfInputPorts()+1;
197 }
198
199 OutputPort *ToyNode::getOutputPort(const std::string& name) const throw(Exception)
200 {
201   if(name==NAME_FOR_NB)
202     return (OutputPort *)&_nbOfInputsPort;
203   else
204     return ElementaryNode::getOutputPort(name);
205 }
206
207 Node *ToyNode::simpleClone(ComposedNode *father, bool editionOnly) const
208 {
209   return new ToyNode(*this,father);
210 }
211
212 ToyNode1S::ToyNode1S(const std::string& name):ServiceNode(name)
213 {
214 }
215
216 ToyNode1S::ToyNode1S(const ToyNode1S& other, ComposedNode *father):ServiceNode(other,father)
217 {
218 }
219
220 void ToyNode1S::execute()
221 {
222   //nothing only to test deployment calculation not for running.
223 }
224
225 std::string ToyNode1S::getKind() const
226 {
227   return KIND;
228 }
229
230 ServiceNode *ToyNode1S::createNode(const std::string& name)
231 {
232   ToyNode1S* node=new ToyNode1S(name);
233   node->setComponent(_component);
234   return node;
235 }
236
237 Node *ToyNode1S::simpleClone(ComposedNode *father, bool editionOnly) const
238 {
239   return new ToyNode1S(*this,father);
240 }
241
242 ToyNode2S::ToyNode2S(const std::string& name):ServiceNode(name)
243 {
244 }
245
246 ToyNode2S::ToyNode2S(const ToyNode2S& other, ComposedNode *father):ServiceNode(other,father)
247 {
248 }
249
250 void ToyNode2S::execute()
251 {
252   //nothing only to test deployment calculation not for running.
253 }
254
255 std::string ToyNode2S::getKind() const
256 {
257   return KIND;
258 }
259
260 ServiceNode *ToyNode2S::createNode(const std::string& name)
261 {
262   ToyNode2S* node=new ToyNode2S(name);
263   node->setComponent(_component);
264   return node;
265 }
266
267 Node *ToyNode2S::simpleClone(ComposedNode *father, bool editionOnly) const
268 {
269   return new ToyNode2S(*this,father);
270 }
271
272 void SeqToyNode::execute()
273 {
274   int val=_inIntValue.getIntValue();
275   SequenceAny *tmp=SequenceAny::New(Runtime::_tc_double,val);
276   double d=(double) val;
277   for(int i=0;i<val;i++)
278     {
279       Any *tmp2=AtomAny::New(d);
280       tmp->setEltAtRank(i,tmp2);
281       tmp2->decrRef();
282       d+=1.;
283     }
284   _seqOut.put((const void *)tmp);
285   tmp->decrRef();
286 }
287
288 SeqToyNode::SeqToyNode(const SeqToyNode& other, ComposedNode *father):ElementaryNode(other,father),
289                                                                       _seqOut(other._seqOut,this),
290                                                                       _inIntValue(other._inIntValue,this)
291 {
292 }
293
294 SeqToyNode::SeqToyNode(const std::string& name):ElementaryNode(name),_seqOut(NAME_SEQ_OUTPRT,this,Runtime::_tc_double),
295                                                 _inIntValue(NAME_NBOFELTS_INSEQ_INPRT,this,Runtime::_tc_int)
296 {
297   _implementation=ToyNode::MY_IMPL_NAME;
298   TypeCodeSeq *tc=new TypeCodeSeq("","",Runtime::_tc_double);
299   _seqOut.edSetType(tc);
300   tc->decrRef();
301 }
302
303 int SeqToyNode::getNumberOfInputPorts() const
304 {
305   return ElementaryNode::getNumberOfInputPorts()+1;
306 }
307
308 std::list<InputPort *> SeqToyNode::getSetOfInputPort() const
309 {
310   list<InputPort *> ret=ElementaryNode::getSetOfInputPort();
311   ret.push_back((InputPort *)&_inIntValue);
312   return ret;
313 }
314
315 InputPort *SeqToyNode::getInputPort(const std::string& name) const throw(Exception)
316 {
317   if(name==NAME_NBOFELTS_INSEQ_INPRT)
318     return (InputPort *)&_inIntValue;
319   else
320     return ElementaryNode::getInputPort(name);
321 }
322
323 int SeqToyNode::getNumberOfOutputPorts() const
324 {
325   return ElementaryNode::getNumberOfOutputPorts()+1;
326 }
327
328 std::list<OutputPort *> SeqToyNode::getSetOfOutputPort() const
329 {
330   list<OutputPort *> ret=ElementaryNode::getSetOfOutputPort();
331   ret.push_back((OutputPort *)&_seqOut);
332   return ret;
333 }
334
335 OutputPort *SeqToyNode::getOutputPort(const std::string& name) const throw(Exception)
336 {
337   if(name==NAME_SEQ_OUTPRT)
338     return (OutputPort *)&_seqOut;
339   else
340     return ElementaryNode::getOutputPort(name);
341 }
342
343 Node *SeqToyNode::simpleClone(ComposedNode *father, bool editionOnly) const
344 {
345   return new SeqToyNode(*this,father);
346 }
347
348 void Seq2ToyNode::execute()
349 {
350   SequenceAny *vals1=(SequenceAny *)_inValue1.getValue();
351   SequenceAny *vals2=(SequenceAny *)_inValue2.getValue();
352   int val=vals1->size();
353   SequenceAny *tmp=SequenceAny::New(Runtime::_tc_int,val);
354   for(int i=0;i<val;i++)
355     {
356       Any *tmp2=AtomAny::New((int)((*vals1)[i]->getDoubleValue()+(*vals2)[i]->getDoubleValue()));
357       tmp->setEltAtRank(i,tmp2);
358       tmp2->decrRef();
359     }
360   _seqOut.put((const void *)tmp);
361   tmp->decrRef();
362 }
363
364 Seq2ToyNode::Seq2ToyNode(const Seq2ToyNode& other, ComposedNode *father):ElementaryNode(other,father),
365                                                                         _seqOut(other._seqOut,this),
366                                                                         _inValue1(other._inValue1,this),
367                                                                         _inValue2(other._inValue1,this)
368 {
369 }
370
371 Seq2ToyNode::Seq2ToyNode(const std::string& name):ElementaryNode(name),_seqOut(NAME_SEQ_OUTPRT,this,Runtime::_tc_double),
372                                                   _inValue1(NAME_SEQ_INPRT1,this,Runtime::_tc_int),
373                                                   _inValue2(NAME_SEQ_INPRT2,this,Runtime::_tc_int)
374 {
375   _implementation=ToyNode::MY_IMPL_NAME;
376   TypeCodeSeq *tc=new TypeCodeSeq("","",Runtime::_tc_double);
377   _inValue1.edSetType(tc);
378   _inValue2.edSetType(tc);
379   tc->decrRef();
380   tc=new TypeCodeSeq("","",Runtime::_tc_int);
381   _seqOut.edSetType(tc);
382   tc->decrRef();
383 }
384
385 int Seq2ToyNode::getNumberOfInputPorts() const
386 {
387   return ElementaryNode::getNumberOfOutputPorts()+2;
388 }
389
390 std::list<InputPort *> Seq2ToyNode::getSetOfInputPort() const
391 {
392   list<InputPort *> ret=ElementaryNode::getSetOfInputPort();
393   ret.push_back((InputPort *)&_inValue1);
394   ret.push_back((InputPort *)&_inValue2);
395   return ret;
396 }
397
398 InputPort *Seq2ToyNode::getInputPort(const std::string& name) const throw(Exception)
399 {
400   if(name==NAME_SEQ_INPRT1)
401     return (InputPort *)&_inValue1;
402   else if(name==NAME_SEQ_INPRT2)
403     return (InputPort *)&_inValue2;
404   else
405     return ElementaryNode::getInputPort(name);
406 }
407
408 int Seq2ToyNode::getNumberOfOutputPorts() const
409 {
410   return ElementaryNode::getNumberOfOutputPorts()+1;
411 }
412
413 std::list<OutputPort *> Seq2ToyNode::getSetOfOutputPort() const
414 {
415   list<OutputPort *> ret=ElementaryNode::getSetOfOutputPort();
416   ret.push_back((OutputPort *)&_seqOut);
417   return ret;
418 }
419
420 OutputPort *Seq2ToyNode::getOutputPort(const std::string& name) const throw(Exception)
421 {
422   if(name==NAME_SEQ_OUTPRT)
423     return (OutputPort *)&_seqOut;
424   else
425     return ElementaryNode::getOutputPort(name);
426 }
427
428 Node *Seq2ToyNode::simpleClone(ComposedNode *father, bool editionOnly) const
429 {
430   return new Seq2ToyNode(*this,father);
431 }
432
433 void Seq3ToyNode::execute()
434 {
435   SequenceAny *vals1=(SequenceAny *)_inValue1.getValue();
436   SequenceAny *vals2=(SequenceAny *)_inValue2.getValue();
437   int val=vals1->size();
438   TypeCodeSeq *tc1=new TypeCodeSeq("","",Runtime::_tc_int);
439   SequenceAny *tmp=SequenceAny::New(tc1,val);
440   tc1->decrRef();
441   for(int i=0;i<val;i++)
442     {
443       Any *anyTemp=(Any *)(*vals1)[i];
444       SequenceAny *anyTemp2=(SequenceAny *)anyTemp;
445       int val2=anyTemp2->size();
446       SequenceAny *tmp2=SequenceAny::New(Runtime::_tc_int,val2);
447       for(int j=0;j<val2;j++)
448         {
449           Any *tmp3=AtomAny::New((int)((*vals1)[i][j]->getDoubleValue()+(*vals2)[i][j]->getDoubleValue()));
450           tmp2->setEltAtRank(j,tmp3);
451           tmp3->decrRef();
452         }
453       tmp->setEltAtRank(i,tmp2);
454       tmp2->decrRef();
455     }
456   _seqOut.put((const void *)tmp);
457   tmp->decrRef();
458 }
459
460 Seq3ToyNode::Seq3ToyNode(const Seq3ToyNode& other, ComposedNode *father):ElementaryNode(other,father),
461                                                                         _seqOut(other._seqOut,this),
462                                                                         _inValue1(other._inValue1,this),
463                                                                         _inValue2(other._inValue1,this)
464 {
465 }
466
467 Seq3ToyNode::Seq3ToyNode(const std::string& name):ElementaryNode(name),_seqOut(NAME_SEQ_OUTPRT,this,Runtime::_tc_double),
468                                                   _inValue1(NAME_SEQ_INPRT1,this,Runtime::_tc_int),
469                                                   _inValue2(NAME_SEQ_INPRT2,this,Runtime::_tc_int)
470 {
471   _implementation=ToyNode::MY_IMPL_NAME;
472   TypeCodeSeq *tc1=new TypeCodeSeq("","",Runtime::_tc_double);
473   TypeCodeSeq *tc2=new TypeCodeSeq("","",tc1);
474   tc1->decrRef();
475   _inValue1.edSetType(tc2);
476   _inValue2.edSetType(tc2);
477   tc2->decrRef();
478   tc1=new TypeCodeSeq("","",Runtime::_tc_int);
479   tc2=new TypeCodeSeq("","",tc1);
480   tc1->decrRef();
481   _seqOut.edSetType(tc2);
482   tc2->decrRef();
483 }
484
485 int Seq3ToyNode::getNumberOfInputPorts() const
486 {
487   return ElementaryNode::getNumberOfOutputPorts()+2;
488 }
489
490 std::list<InputPort *> Seq3ToyNode::getSetOfInputPort() const
491 {
492   list<InputPort *> ret=ElementaryNode::getSetOfInputPort();
493   ret.push_back((InputPort *)&_inValue1);
494   ret.push_back((InputPort *)&_inValue2);
495   return ret;
496 }
497
498 InputPort *Seq3ToyNode::getInputPort(const std::string& name) const throw(Exception)
499 {
500   if(name==NAME_SEQ_INPRT1)
501     return (InputPort *)&_inValue1;
502   else if(name==NAME_SEQ_INPRT2)
503     return (InputPort *)&_inValue2;
504   else
505     return ElementaryNode::getInputPort(name);
506 }
507
508 int Seq3ToyNode::getNumberOfOutputPorts() const
509 {
510   return ElementaryNode::getNumberOfOutputPorts()+1;
511 }
512
513 std::list<OutputPort *> Seq3ToyNode::getSetOfOutputPort() const
514 {
515   list<OutputPort *> ret=ElementaryNode::getSetOfOutputPort();
516   ret.push_back((OutputPort *)&_seqOut);
517   return ret;
518 }
519
520 OutputPort *Seq3ToyNode::getOutputPort(const std::string& name) const throw(Exception)
521 {
522   if(name==NAME_SEQ_OUTPRT)
523     return (OutputPort *)&_seqOut;
524   else
525     return ElementaryNode::getOutputPort(name);
526 }
527
528 Node *Seq3ToyNode::simpleClone(ComposedNode *father, bool editionOnly) const
529 {
530   return new Seq3ToyNode(*this,father);
531 }
532
533 InputLimitPort::InputLimitPort(const InputLimitPort& other, Node *newHelder):InputPort(other,newHelder),
534                                                                              DataPort(other,newHelder),Port(other,newHelder),
535                                                                              _data(0),_initData(0)
536 {
537   if(other._data)
538     _data=other._data->clone();
539   if(other._initData)
540     _initData=other._initData->clone();
541 }
542
543 InputLimitPort::InputLimitPort(const string& name, Node *node)
544                 :InputPort(name, node, Runtime::_tc_double),
545                 DataPort(name, node, Runtime::_tc_double),
546                 Port(node),_data(0),_initData(0)
547 {
548 }
549
550 void InputLimitPort::put(const void *data) throw(ConversionException)
551 {
552   put((Any *)data);
553 }
554
555 InputPort *InputLimitPort::clone(Node *newHelder) const
556 {
557   return new InputLimitPort(*this,newHelder);
558 }
559
560 bool InputLimitPort::edIsManuallyInitialized() const
561 {
562   return _initData!=0;
563 }
564
565 void *InputLimitPort::get() const throw(Exception)
566 {
567   if(!_data)
568     {
569       string what="InputLimitPort::get : no value currently in input whith name \""; what+=_name; what+="\"";
570       throw Exception(what);
571     }
572   return (void *)_data;
573 }
574
575 void InputLimitPort::edRemoveManInit()
576 {
577   if(_initData)
578     _initData->decrRef();
579   _initData=0;
580   InputPort::edRemoveManInit();
581 }
582
583 void InputLimitPort::put(Any *data)
584 {
585   if(_data)
586     _data->decrRef();
587   _data=data;
588   _data->incrRef();
589 }
590
591 void InputLimitPort::exSaveInit()
592 {
593   if(_initData) _initData->decrRef();
594   _initData=_data;
595   _initData->incrRef();
596 }
597
598 void InputLimitPort::exRestoreInit()
599 {
600   if(!_initData)return;
601   if(_data) _data->decrRef();
602   _data=_initData;
603   _data->incrRef();
604 }
605
606 InputLimitPort::~InputLimitPort()
607 {
608   if(_data)
609     _data->decrRef();
610   if(_initData)
611     _initData->decrRef();
612 }
613
614 OutputLimitPort::OutputLimitPort(const OutputLimitPort& other, Node *newHelder):OutputPort(other,newHelder),
615                                                                                 DataPort(other,newHelder),Port(other,newHelder),_data(0)
616 {
617   if(other._data)
618     _data=other._data->clone();
619 }
620
621 OutputLimitPort::OutputLimitPort(const string& name, Node *node, TypeCode *type):OutputPort(name, node, type),DataPort(name, node, type),Port(node),_data(0)
622 {
623 }
624
625 void OutputLimitPort::put(const void *data) throw(ConversionException)
626 {
627   put((Any *)data);
628   OutputPort::put(data);
629 }
630
631 OutputPort *OutputLimitPort::clone(Node *newHelder) const
632 {
633   return new OutputLimitPort(*this,newHelder);
634 }
635
636 void OutputLimitPort::put(Any *data)
637 {
638   if(_data)
639     _data->decrRef();
640   _data=data;
641   _data->incrRef();
642 }
643
644 OutputLimitPort::~OutputLimitPort()
645 {
646   if(_data)
647     _data->decrRef();
648 }
649
650 void LimitNode::init(bool start)
651 {
652   if(start)
653     _current=0.;
654   Node::init(start);
655 }
656
657 void LimitNode::execute()
658 {
659   _current+=_entry.getAny()->getDoubleValue();
660   Any *tmp=AtomAny::New(_current);
661   _counterPort.put((const void *)tmp);
662   tmp->decrRef();
663   bool verdict=(_current<_limit);
664   tmp=AtomAny::New(verdict);
665   _switchPort.put((const void *)tmp);
666   tmp->decrRef();
667 }
668
669 Node *LimitNode::simpleClone(ComposedNode *father, bool editionOnly) const
670 {
671   return new LimitNode(*this,father);
672 }
673
674 std::list<InputPort *> LimitNode::getSetOfInputPort() const
675 {
676   list<InputPort *> ret=ElementaryNode::getSetOfInputPort();
677   ret.push_back((InputPort *)&_entry);
678   return ret;
679 }
680
681 std::list<OutputPort *> LimitNode::getSetOfOutputPort() const
682 {
683   list<OutputPort *> ret=ElementaryNode::getSetOfOutputPort();
684   ret.push_back((OutputPort *)&_switchPort);
685   ret.push_back((OutputPort *)&_counterPort);
686   return ret;
687 }
688
689 InputPort *LimitNode::getInputPort(const std::string& name) const throw(Exception)
690 {
691   if(name==NAME_FOR_SWPORT)
692     return (InputPort *)&_entry;
693   else
694     return ElementaryNode::getInputPort(name);
695 }
696
697 OutputPort *LimitNode::getOutputPort(const std::string& name) const throw(Exception)
698 {
699   if(name==NAME_FOR_SWPORT)
700     return (OutputPort *)&_switchPort;
701   else if(name==NAME_FOR_SWPORT2)
702     return (OutputPort *)&_counterPort;
703   else
704     return ElementaryNode::getOutputPort(name);
705 }
706
707 LimitNode::LimitNode(const LimitNode& other, ComposedNode *father):ElementaryNode(other,father),
708                                                                    _limit(other._limit),_current(other._limit),
709                                                                    _entry(other._entry,this),
710                                                                    _switchPort(other._switchPort,this),
711                                                                    _counterPort(other._counterPort,this)
712 {
713 }
714
715 LimitNode::LimitNode(const string& name):ElementaryNode(name),_limit(0.),_current(0.),
716                                          _entry(NAME_FOR_SWPORT,this),
717                                          _switchPort(NAME_FOR_SWPORT,this, Runtime::_tc_bool),
718                                          _counterPort(NAME_FOR_SWPORT2,this, Runtime::_tc_double)
719 {
720 }