Salome HOME
Memory Leaks
[modules/superv.git] / src / Supervision / Value_Impl.cxx
index d721730efd80767e47ef771319ad16ebba14b679..96e7d75df06afec9ac3efbe76bf1bf5b68374035 100644 (file)
@@ -154,6 +154,7 @@ bool Value_Impl::Input( const CORBA::Any * anAny ) {
 }
 
 CORBA::Any * Value_Impl::ToAny() {
+  beginService( "Value_Impl::ToAny" );
   CORBA::Any * anAny ;
   if ( _DataFlowEditor ) {
     char * name ;
@@ -163,6 +164,7 @@ CORBA::Any * Value_Impl::ToAny() {
     else {
       name = _DataFlowEditor->Graph()->Name() ;
     }
+    MESSAGE( "ToAny " << name<< "( " << _ParameterName << " )" ) ;
     if ( _InputPort ) {
       if ( _DataFlowNode ) {
         _InputValue = _DataFlowNode->HasInput( _ParameterName ) ;
@@ -170,49 +172,44 @@ CORBA::Any * Value_Impl::ToAny() {
       else {
         _InputValue = _DataFlowEditor->HasInput( _ParameterName ) ;
       }
-      if ( _InputValue && _DataFlowEditor->IsEditing() ) {
-        anAny = new CORBA::Any( * _DataFlowEditor->GetInData( name ,
+      GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
+      if ( _DataFlowExecutor ) {
+//JR 30.03.2005        anAny = new CORBA::Any( * _DataFlowExecutor->GetInData( name ,
+        anAny = new CORBA::Any( _DataFlowExecutor->GetInData( name ,
                                                               _ParameterName ) ) ;
       }
+      else if ( _InputValue ) {
+//JR 30.03.2005        anAny = new CORBA::Any( * _DataFlowEditor->GetInData( name ,
+        anAny = new CORBA::Any( _DataFlowEditor->GetInData( name ,
+                                                            _ParameterName ) ) ;
+      }
       else {
-        GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
-        if ( _DataFlowExecutor ) {
-          anAny = new CORBA::Any( * _DataFlowExecutor->GetInData( name ,
-                                                                  _ParameterName ) ) ;
-        }
-        else {
-          anAny = new CORBA::Any( *_Any ) ;
-        }
+        anAny = new CORBA::Any( *_Any ) ;
       }
     }
     else {
-      if ( _InputValue && _DataFlowEditor->IsEditing() ) {
-        anAny = new CORBA::Any( * _DataFlowEditor->GetOutData( name ,
+      GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
+      if ( _DataFlowExecutor ) {
+//JR 30.03.2005        anAny = new CORBA::Any( * _DataFlowExecutor->GetOutData( name ,
+        anAny = new CORBA::Any( _DataFlowExecutor->GetOutData( name ,
                                                               _ParameterName ) ) ;
       }
       else {
-        GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
-        if ( _DataFlowExecutor ) {
-          anAny = new CORBA::Any( * _DataFlowExecutor->GetOutData( name ,
-                                                                  _ParameterName ) ) ;
-        }
-        else {
-          anAny = new CORBA::Any( *_Any ) ;
-        }
+        anAny = new CORBA::Any( *_Any ) ;
       }
     }
   }
   else {
     anAny = new CORBA::Any( *_Any ) ;
   }
+  endService( "Value_Impl::ToAny" );
   return anAny ;
 }
 
 char * Value_Impl::ToString() {
 //  beginService( "Value_Impl::ToString" );
-  CORBA::Any anAny = *ToAny() ;
-//  cout << "Value_Impl::ToString " << _DataFlowNode->Name() << " "
-//       << _ParameterName << " " ;
+//JR 22.03.2005 Memory Leak  CORBA::Any anAny = *ToAny() ;
+  CORBA::Any anAny ;
   if ( _DataFlowEditor ) {
     char * name ;
     if ( _DataFlowNode ) {
@@ -221,6 +218,7 @@ char * Value_Impl::ToString() {
     else {
       name = _DataFlowEditor->Graph()->Name() ;
     }
+//    MESSAGE( "ToString " << name<< "( " << _ParameterName << " )" ) ;
     if ( _InputPort ) {
       if ( _DataFlowNode ) {
         _InputValue = _DataFlowNode->HasInput( _ParameterName ) ;
@@ -228,29 +226,40 @@ char * Value_Impl::ToString() {
       else {
         _InputValue = _DataFlowEditor->HasInput( _ParameterName ) ;
       }
-      if ( _InputValue && _DataFlowEditor->IsEditing() ) {
-        anAny = * _DataFlowEditor->GetInData( name ,
-                                              _ParameterName ) ;
+      GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
+      if ( _DataFlowExecutor ) {
+//        cout << "-->_DataFlowExecutor->GetInData " << name << " " << _ParameterName << endl ;
+//JR 30.03.2005        const CORBA::Any * AnyPtr = _DataFlowExecutor->GetInData( name ,
+        const CORBA::Any AnyRef = _DataFlowExecutor->GetInData( name ,
+                                                                _ParameterName ) ;
+//JR 30.03.2005        cout << "<--_DataFlowExecutor->GetInData " << AnyPtr << endl ;
+//JR 30.03.2005        anAny = * AnyPtr ;
+        anAny = AnyRef ;
+      }
+      else if ( _InputValue ) {
+//        cout << "_DataFlowEditor->GetInData _DataFlowNode " << _DataFlowNode
+//             << " _InputValue " << _InputValue << endl ;
+//JR 30.03.2005        anAny = * _DataFlowEditor->GetInData( name ,
+        anAny = _DataFlowEditor->GetInData( name ,
+                                            _ParameterName ) ;
       }
       else {
-        GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
-        if ( _DataFlowExecutor ) {
-          anAny = * _DataFlowExecutor->GetInData( name ,
-                                                  _ParameterName ) ;
-        }
+        anAny = *_Any ;
       }
     }
     else {
-      if ( _InputValue && _DataFlowEditor->IsEditing() ) {
-        anAny = * _DataFlowEditor->GetOutData( name ,
-                                               _ParameterName ) ;
+      GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
+      if ( _DataFlowExecutor ) {
+//        cout << "-->_DataFlowExecutor->GetOutData " << name << " " << _ParameterName << endl ;
+//JR 30.03.2005        const CORBA::Any * AnyPtr = _DataFlowExecutor->GetOutData( name ,
+        const CORBA::Any AnyRef = _DataFlowExecutor->GetOutData( name ,
+                                                                 _ParameterName ) ;
+//JR 30.03.2005        cout << "<--_DataFlowExecutor->GetOutData " << AnyPtr << endl ;
+//JR 30.03.2005        anAny = * AnyPtr ;
+        anAny = AnyRef ;
       }
       else {
-        GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
-        if ( _DataFlowExecutor ) {
-          anAny = * _DataFlowExecutor->GetOutData( name ,
-                                                   _ParameterName ) ;
-        }
+        anAny = *_Any ;
       }
     }
   }
@@ -323,27 +332,31 @@ bool Value_Impl::IsIOR() {
         _InputValue = _DataFlowEditor->HasInput( _ParameterName ) ;
       }
       if ( _InputValue && _DataFlowEditor->IsEditing() ) {
-        anAny = * _DataFlowEditor->GetInData( name ,
-                                              _ParameterName ) ;
+//JR 30.03.2005        anAny = * _DataFlowEditor->GetInData( name ,
+        anAny = _DataFlowEditor->GetInData( name ,
+                                            _ParameterName ) ;
       }
       else {
         GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
         if ( _DataFlowExecutor ) {
-          anAny = * _DataFlowExecutor->GetInData( name ,
-                                                  _ParameterName ) ;
+//JR 30.03.2005          anAny = * _DataFlowExecutor->GetInData( name ,
+          anAny = _DataFlowExecutor->GetInData( name ,
+                                                _ParameterName ) ;
        }
       }
     }
     else {
       if ( _InputValue && _DataFlowEditor->IsEditing() ) {
-        anAny = * _DataFlowEditor->GetOutData( name ,
-                                               _ParameterName ) ;
+//JR 30.03.2005        anAny = * _DataFlowEditor->GetOutData( name ,
+        anAny = _DataFlowEditor->GetOutData( name ,
+                                             _ParameterName ) ;
       }
       else {
         GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
         if ( _DataFlowExecutor ) {
-          anAny = * _DataFlowExecutor->GetOutData( name ,
-                                                   _ParameterName ) ;
+//JR 30.03.2005          anAny = * _DataFlowExecutor->GetOutData( name ,
+          anAny = _DataFlowExecutor->GetOutData( name ,
+                                                 _ParameterName ) ;
        }
       }
     }