Salome HOME
Traces
[modules/superv.git] / src / GraphEditor / DataFlowEditor_OutNode.hxx
index 4c14b833bd361e734f014e353967ada41ad12a02..cf560f07972fb939086d77e5b4b460f76cf77926 100644 (file)
@@ -33,7 +33,6 @@
 
 namespace GraphEditor {
 
-//  class OutNode : public GraphBase::Graph {
   class OutNode : public GraphBase::Base {
     
     private :
@@ -51,7 +50,7 @@ namespace GraphEditor {
 
       CORBA::ORB_ptr _Orb;
 
-      bool Valid() ;
+      bool Valid(bool kLoopSwitch = true ) ;
       bool Executable() ;
 
       bool LoadNodes( map< string , int > & aMapOfNodes ,
@@ -79,6 +78,18 @@ namespace GraphEditor {
 
       void DateModification() ;
 
+      // asv 20.09.04 added from GraphExecutor::FiniteStateMachine class (removed from there)
+//      static map< string , GraphBase::Graph * > _MapOfGraphs ;
+//      static map< string , int >                _MapOfGraphNames ;
+    
+//      GraphBase::Graph * MapGraph( const char * aGraphName ) ;
+//      bool MapGraph( GraphBase::Graph * aGraph , const char * aGraphName ) ;
+//      void EraseGraph( const char * aGraphName ) ;
+//      bool GraphName( const char * aGraphName ) ;
+//      string GraphInstanceName( const char * aGraphName ) ;
+      // end added from FiniteStateMachine
+
+
     public:
 
       OutNode();
@@ -103,8 +114,6 @@ namespace GraphEditor {
                const char * DebugFileName ) ;
       virtual ~OutNode();
 
-      GraphExecutor::FiniteStateMachine * Automaton() { return theAutomaton ; } ;
-
       bool Name( const char * aName ) ;
 
       void Set_prof_debug( CORBA::ORB_ptr ORB , const char * DebugFileName ) ;
@@ -161,9 +170,15 @@ namespace GraphEditor {
            return _Graph->RemoveNode( NodeName ) ; } ;
       bool ReNameNode( const char* OldNodeName ,
                        const char* NewNodeName ) {
-           DateModification() ;
-           _Valid = false ;
-           return _Graph->ReNameNode( OldNodeName , NewNodeName ) ; } ;
+//PAL9048 JR Debug : a node may not have the same name as the graph
+           if ( strcmp( Graph()->Name() , NewNodeName ) ) {
+             DateModification() ;
+             _Valid = false ;
+             return _Graph->ReNameNode( OldNodeName , NewNodeName ) ;
+          }
+           cdebug << "Editor::OutNode::ReNameNode ERROR "  << NewNodeName << " already exists"
+                  << endl ;
+           return false ; } ;
 
       void Coordinates( const int X , const int Y ) {
            return _Graph->Coordinates( X , Y ) ; } ;
@@ -263,9 +278,9 @@ namespace GraphEditor {
                          const int index , long &X , long &Y ) ;
 
 
-      bool IsValid() {
+      bool IsValid(bool kLoopSwitch = true ) {
            if ( !_Valid )
-             Valid() ;
+             Valid( kLoopSwitch ) ;
            return _Valid ; } ;
       bool IsNotValid() const {
            return !_Valid ; } ;
@@ -284,10 +299,21 @@ namespace GraphEditor {
       bool IsNotExecutable() const {
            return !_Executable ; } ;
 
-      const CORBA::Any *GetInData( const char *ToNodeName ,
-                                   const char *ToParameterName ) ;
-      const CORBA::Any *GetOutData( const char *FromNodeName ,
-                                    const char *FromParameterName ) ;
+      // iterate through ALL links (OutPort-InPort pairs) and check if their types are 
+      // compatible - IsCompatible(type1, type2).  
+      // Returns true if all are compatible.   
+      bool IsLinksCompatible();
+
+      // Returns true if an out-port of type "OutPortType" can be bound with 
+      // in-port of type "InPortType".  Called from IsLinksCompatible() and Link_Impl::IsValid().
+      bool IsCompatible( const char* OutPortType, const char* InPortType ) const;
+
+//JR 30.03.2005      const CORBA::Any *GetInData( const char *ToNodeName ,
+      const CORBA::Any GetInData( const char *ToNodeName ,
+                                  const char *ToParameterName ) ;
+//JR 30.03.2005      const CORBA::Any *GetOutData( const char *FromNodeName ,
+      const CORBA::Any GetOutData( const char *FromNodeName ,
+                                   const char *FromParameterName ) ;
   } ;
 
 };