1 // SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : DataFlowBase_EndOfSwitchNode.cxx
8 // Author : Jean Rahuel, CEA
16 #include "DataFlowBase_EndOfSwitchNode.hxx"
18 GraphBase::EndOfSwitchNode::EndOfSwitchNode() :
19 GraphBase::GOTONode::GOTONode() {
21 cdebug << "GraphBase::EndOfSwitchNode::EndOfSwitchNode " << this
22 << " _Name " << (void *) Name() << " " << Name() << " _Comment "
23 << (void *) Comment() << " " << Comment() << " " << endl ;
27 GraphBase::EndOfSwitchNode::EndOfSwitchNode( CORBA::ORB_ptr ORB ,
28 SALOME_NamingService* ptrNamingService ,
29 const char * FuncName ,
30 const SUPERV::ListOfStrings & aPythonFunction ,
31 const char *NodeName ,
32 const SUPERV::KindOfNode akind ,
33 const SUPERV::SDate NodeFirstCreation ,
34 const SUPERV::SDate NodeLastModification ,
35 const char * NodeEditorRelease ,
36 const char * NodeAuthor ,
37 const char * NodeComment ,
38 const bool GeneratedName ,
41 int * Graph_prof_debug ,
42 ofstream * Graph_fdebug ) :
43 GraphBase::GOTONode::GOTONode( ORB , ptrNamingService , FuncName ,
45 NodeName , akind , NodeFirstCreation ,
46 NodeLastModification , NodeEditorRelease ,
47 NodeAuthor , NodeComment , GeneratedName ,
48 X , Y , Graph_prof_debug , Graph_fdebug ) {
50 cdebug_in << "GraphBase::EndOfSwitchNode::EndOfSwitchNode " << this
51 << "' _Name " << (void *) Name() << " '" << Name() << " _Comment "
52 << (void *) Comment() << " " << Comment() << " "
53 << " KindOfNode " << Kind() << " FuncName " << FuncName
54 << " ServiceName " << ServiceName() << " In("
55 << ServiceInParameter().length()
56 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
58 cdebug_out << "GraphBase::EndOfSwitchNode::EndOfSwitchNode" << endl;
61 GraphBase::EndOfSwitchNode::~EndOfSwitchNode() {
62 cdebug << "GraphBase::EndOfSwitchNode::~EndOfSwitchNode " << this
63 << " _Name " << (void *) Name() << " " << Name() << " _Comment "
64 << (void *) Comment() << " " << Comment() << " " << endl ;
65 // if ( _ComponentName != NULLSTRING )
66 // delete [] _ComponentName ;
68 // delete [] _EditorRelease ;
69 // if ( _Author != NULLSTRING )
70 // delete [] _Author ;
71 // if ( _Computer != FACTORYSERVER )
72 // delete [] _Computer;
73 // if ( _Comment != NULLSTRING )
74 // delete [] _Comment;
77 bool GraphBase::EndOfSwitchNode::DecrEndSwitchInPortLinked( GraphBase::InPort * anInPort ) {
79 // if ( !anInPort->BranchOfSwitchLinked() ) {
80 RetVal = anInPort->BranchOfSwitchLinked( true ) ;
81 //JR 16.02.2005 : except for DefaultPort
82 if ( !anInPort->IsGate() ) {
83 _EndSwitchInPortLinkedNumber -= 1 ;
86 << "->EndOfSwitchNode::DecrEndSwitchInPortLinked EndSwitchInPortLinkedNumber "
87 << _EndSwitchInPortLinkedNumber << " InPort '" << anInPort->PortName() << "' of "
88 << anInPort->NodeName() << " RetVal " << RetVal << endl ;
91 // cdebug << "EndOfSwitchNode::DecrEndSwitchInPortLinked EndSwitchInPortLinkedNumber "
92 // << _EndSwitchInPortLinkedNumber << " InPort " << anInPort->PortName()
93 // << " already done RetVal " << RetVal << endl ;
98 bool GraphBase::EndOfSwitchNode::CheckEndSwitchInPortsLinked() {
99 // Check that all inports of the EndSwitchNode will have a value only once
100 if ( _EndSwitchInPortLinkedNumber != 0 ) {
102 << "->EndOfSwitchNode::CheckEndSwitchInPortsLinked EndSwitchInPortLinkedNumber "
103 << _EndSwitchInPortLinkedNumber << endl ;
104 if ( !SwitchWithGOTO() ) {
105 return false ; // Some InPort is not linked
108 // Check that all inports of the EndSwitchNode are reachable in that branch(es)
110 for ( i = 0 ; i < GetNodeInPortsSize()-1 ; i++ ) {
111 if ( !GetChangeNodeInPort( i )->IsDataStream() &&
112 !GetChangeNodeInPort( i )->BranchOfSwitchLinked() ) {
113 cdebug << Name() << "->EndOfSwitchNode::CheckEndSwitchInPortsLinked "
114 << GetNodeInPort( i )->PortName() << " have no link in that branch"
116 if ( !SwitchWithGOTO() ) {
117 return false ; // that InPort is not linked
121 return true ; // Ok : all InPorts are linked