Salome HOME
NRI : Merge from V1_2.
[modules/superv.git] / src / GraphBase / DataFlowBase_GOTONode.cxx
1 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : DataFlowBase_GOTONode.cxx
8 //  Author : Jean Rahuel, CEA
9 //  Module : SUPERV
10 //  $Header:
11
12 using namespace std;
13 #include <strstream>
14 #include <iostream>
15
16 #include "DataFlowBase_GOTONode.hxx"
17
18 GraphBase::GOTONode::GOTONode() :
19   GraphBase::InLineNode::InLineNode() {
20
21   CoupledNode( NULL ) ;
22   cdebug << "GraphBase::GOTONode::GOTONode "  << this 
23          << " _Name " << (void *) Name() << " " << Name() << " _Comment "
24          << (void *) Comment() << " "  << Comment() << " "  << endl ;
25
26 }
27
28 GraphBase::GOTONode::GOTONode( CORBA::ORB_ptr ORB ,
29                                SALOME_NamingService* ptrNamingService ,
30                                const char *FuncName ,
31                                const SUPERV::ListOfStrings & aPythonFunction ,
32                                const char *NodeName ,
33                                const SUPERV::KindOfNode akind ,
34                                const SUPERV::SDate NodeFirstCreation ,
35                                const SUPERV::SDate NodeLastModification  ,
36                                const char * NodeEditorRelease ,
37                                const char * NodeAuthor ,
38                                const char * NodeComment ,
39                                const bool   GeneratedName ,
40                                const long   X ,
41                                const long   Y ,
42                                int * Graph_prof_debug ,
43                                ostream * Graph_fdebug ) :
44   GraphBase::InLineNode::InLineNode( ORB , ptrNamingService , FuncName , aPythonFunction ,
45                                      NodeName , akind , NodeFirstCreation ,
46                                      NodeLastModification  , NodeEditorRelease ,
47                                      NodeAuthor , NodeComment , GeneratedName ,
48                                      X , Y , Graph_prof_debug , Graph_fdebug ) {
49
50   CoupledNode( NULL ) ;
51   cdebug_in << "GraphBase::GOTONode::GOTONode "  << this 
52             << "' _Name " << (void *) Name() << " '" << Name() << " _Comment "
53             << (void *) Comment() << " "  << Comment() << " " 
54             << " KindOfNode " << Kind() << " FuncName " << FuncName
55             << " ServiceName " << ServiceName() << " In("
56             << ServiceInParameter().length()
57             << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
58
59   cdebug_out << "GraphBase::GOTONode::GOTONode" << endl;
60 }
61
62 GraphBase::GOTONode::~GOTONode() {
63   cdebug << "GraphBase::GOTONode::~GOTONode "  << this 
64          << " _Name " << (void *) Name() << " " << Name() << " _Comment "
65          << (void *) Comment() << " "  << Comment() << " "  << endl ;
66 //  if ( _ComponentName != NULLSTRING )
67 //    delete [] _ComponentName ;
68 //  delete [] _Name ;
69 //  delete [] _EditorRelease ;
70 //  if ( _Author != NULLSTRING )
71 //    delete [] _Author ;
72 //  if ( _Computer != FACTORYSERVER )
73 //    delete [] _Computer;
74 //  if ( _Comment != NULLSTRING )
75 //    delete [] _Comment;
76 }
77
78 //bool GraphBase::GOTONode::SaveXML( ostream &f , char *Tabs ,
79 bool GraphBase::GOTONode::SaveXML( QDomDocument & Graph , QDomElement & info ,
80                                    int XCoordinate , int YCoordinate ) const {
81   GraphBase::ListOfFuncName aFuncNames ; 
82   GraphBase::ListOfPythonFunctions aPythonFunction ;
83   if ( PyFuncName() ) {
84     aFuncNames.resize( 1 ) ;
85     aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
86     aPythonFunction.resize( 1 ) ;
87     aPythonFunction[0] = PythonFunction() ;
88   }
89   char * CoupledName = "" ;
90   if ( CoupledNode() ) {
91     CoupledName = CoupledNode()->Name() ;
92   }
93 //  return GraphBase::ComputingNode::SaveXML( f , Tabs , "" , "" , "" ,
94   return GraphBase::ComputingNode::SaveXML( Graph , info , "" , "" , "" ,
95                                             CoupledName ,
96                                             aFuncNames , aPythonFunction ,
97                                             XCoordinate , YCoordinate ) ;
98 }
99
100 bool GraphBase::GOTONode::SavePY( ostream &f , const char * aGraphName ,
101                                   int XCoordinate , int YCoordinate ) const {
102   GraphBase::ListOfFuncName aFuncNames ; 
103   GraphBase::ListOfPythonFunctions aPythonFunction ;
104   if ( PyFuncName() ) {
105     aFuncNames.resize( 1 ) ;
106     aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
107     aPythonFunction.resize( 1 ) ;
108     aPythonFunction[0] = PythonFunction() ;
109   }
110   return GraphBase::ComputingNode::SavePY( f , aGraphName , "" , "" , "" ,
111                                            CoupledNode() ,
112                                            aFuncNames , aPythonFunction ,
113                                            XCoordinate , YCoordinate ) ;
114 }
115