]> SALOME platform Git repositories - modules/yacs.git/blob - src/engine/OutputDataStreamPort.cxx
Salome HOME
PR: merge from BR_DATACONV_PR tag "mergeto_trunk_25oct06"
[modules/yacs.git] / src / engine / OutputDataStreamPort.cxx
1 #include "OutputDataStreamPort.hxx"
2 #include "InputDataStreamPort.hxx"
3 //#include "TypeCheckerDataStream.hxx"
4
5 using namespace YACS::ENGINE;
6 using namespace std;
7
8 const char OutputDataStreamPort::NAME[]="OutputDataStreamPort";
9
10 OutputDataStreamPort::OutputDataStreamPort(const string& name, Node *node, TypeCode* type):DataStreamPort(name,node,type),OutPort(node),Port(node)
11 {
12 }
13
14 string OutputDataStreamPort::getNameOfTypeOfCurrentInstance() const
15 {
16   return NAME;
17 }
18
19 bool OutputDataStreamPort::edAddInputDataStreamPort(InputDataStreamPort *port) throw(ConversionException)
20 {
21 //   if(!TypeCheckerDataStream::areStaticallyCompatible(edGetType(),port->edGetType()))
22 //     throw ConversionException(TypeCheckerDataStream::edGetTypeInPrintableForm(edGetType()),TypeCheckerDataStream::edGetTypeInPrintableForm(port->    throw ConversionException(TypeCheckerDataStream::edGetTypeInPrintableForm(edGetType()),TypeCheckerDataStream::edGetTypeInPrintableForm(port->edGetType()));
23   if(!isAlreadyInSet(port))
24     {
25       _setOfInputDataStreamPort.insert(port);
26       return true;
27     }
28   else
29     return false;
30 }
31
32 void OutputDataStreamPort::edRemoveInputDataStreamPort(InputDataStreamPort *inputPort) throw(Exception)
33 {
34   if(isAlreadyInSet(inputPort))
35     _setOfInputDataStreamPort.erase(inputPort);
36 //   else
37 //     throw Exception("OutputDataStreamPort::edRemoveInputDataStreamPort : link does not exist, unable to remove it");
38 }
39
40 //Idem OutputDataStreamPort::edRemoveInputDataStreamPort but no exception thrown if inputPort is not known
41 void OutputDataStreamPort::edRemoveInputDataStreamPortOneWay(InputDataStreamPort *inputPort)
42 {
43   _setOfInputDataStreamPort.erase(inputPort);
44 }
45
46 bool OutputDataStreamPort::addInPort(InPort *inPort) throw(Exception)
47 {
48 }
49
50 void OutputDataStreamPort::removeInPort(InPort *inPort) throw(Exception)
51 {
52 }
53
54 bool OutputDataStreamPort::isLinked()
55 {
56   return _setOfInputDataStreamPort.empty();
57 }
58
59 bool OutputDataStreamPort::isAlreadyInSet(InputDataStreamPort *inputPort) const
60 {
61   bool ret=false;
62   for(set<InputDataStreamPort *>::const_iterator iter=_setOfInputDataStreamPort.begin();iter!=_setOfInputDataStreamPort.end();iter++)
63     if((*iter)==inputPort)
64       ret=true;
65   return ret;
66 }