Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/superv.git] / src / GraphBase / DataFlowBase_DataPort.cxx
index ae0f79fc732f940a6245a87c5eaa824229a8b5e2..7b0a17e17bf8e59305bfaca8c4c31681336a2a27 100644 (file)
@@ -71,31 +71,32 @@ void GraphBase::DataPort::InitialValues(CORBA::Any aValue ) {
   }
   else if ( !strcmp( Type , "boolean" ) ) {
     cdebug << "boolean" << endl ;
-    InitialValue <<= (long ) 0 ;
+    InitialValue <<= (CORBA::Long ) 0 ;
   }
   else if ( !strcmp( Type , "char" ) ) {
     cdebug << "char" << endl ;
-    InitialValue <<= (long ) 0 ;
+    InitialValue <<= (CORBA::Long ) 0 ;
   }
   else if ( !strcmp( Type , "short" ) ) {
     cdebug << "short" << endl ;
-    InitialValue <<= (long ) 0 ;
+    InitialValue <<= (CORBA::Long ) 0 ;
   }
   else if ( !strcmp( Type , "int" ) ) {
     cdebug << "long" << endl ;
-    InitialValue <<= (long ) 0 ;
+    InitialValue <<= (CORBA::Long ) 0 ;
   }
   else if ( !strcmp( Type , "long" ) ) {
     cdebug << "long" << endl ;
-    InitialValue <<= (long ) 0 ;
+    InitialValue <<= (CORBA::Long ) 0 ;
   }
   else if ( !strcmp( Type , "float" ) ) {
     cdebug << "float" << endl ;
 #ifdef REDHAT // mkr : debug for PAL12255
-    InitialValue <<= (double ) 0. ;
+    InitialValue <<= (float ) 0. ;
 #else     
-    double d = 0.;
-    InitialValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//JR    double d = 0.;
+//JR    InitialValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+    InitialValue <<= (CORBA::Float) 0. ;
 #endif
     
   }
@@ -104,8 +105,9 @@ void GraphBase::DataPort::InitialValues(CORBA::Any aValue ) {
 #ifdef REDHAT // mkr : debug for PAL12255
     InitialValue <<= (double ) 0. ;
 #else
-    double d = 0.;
-    InitialValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//JR    double d = 0.;
+//JR    InitialValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+    InitialValue <<= (CORBA::Double) 0. ;
 #endif
   }
   else { // Default
@@ -115,7 +117,7 @@ void GraphBase::DataPort::InitialValues(CORBA::Any aValue ) {
   }
 //  else {
 //    cdebug << "InitialValues ERROR (other) " << Type << endl ;
-//    InitialValue <<= (long ) 0 ;
+//    InitialValue <<= (CORBA::Long ) 0 ;
 //  }
   _InitialValue = new CORBA::Any( InitialValue ) ;
   _Value = &_InitialValue ;
@@ -149,7 +151,7 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
 #endif
   switch (aDataValue->type()->kind()) { // Input Value
   case CORBA::tk_string: { // Input string Value
-    char * t;
+    const char * t;
     *aDataValue >>= t;
 #if ValueTrace
     cdebug << t << " (string)" ;
@@ -165,12 +167,13 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
       CORBA::Any * theValue = new CORBA::Any() ;
       if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
            !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
-        long l ;
-        sscanf( t , "%ld" , &l ) ;
+        long ll ;
+        sscanf( t , "%ld" , &ll ) ;
+        CORBA::Long l = ll ;
         *theValue <<= l ;
         *theValue >>= l;
 #if ValueTrace
-        cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ;
+        cdebug << " --> Value( " << l << ") (CORBA::Long) kind " << theValue->type()->kind() ;
 #endif
       }
       else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
@@ -179,7 +182,8 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
 #ifdef REDHAT // mkr : debug for PAL12255
        *theValue <<= d ;
 #else
-       theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//JR   theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+       *theValue <<= (CORBA::Double) d ;
 #endif
         *theValue >>= d ;
 #if ValueTrace
@@ -216,11 +220,11 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
     }
     break;
   }
-  case CORBA::tk_long: { // Input long Value
-    long l;
+  case CORBA::tk_long: { // Input CORBA::Long Value
+    CORBA::Long l;
     *aDataValue >>= l;
 #if ValueTrace
-    cdebug << "Value( " << l << ") (long)";
+    cdebug << "Value( " << l << ") (CORBA::Long)";
 #endif
     if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
          !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { // SuperVision Value
@@ -228,16 +232,17 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
       *_Value = aDataValue ;
       *_theValue >>= l;
 #if ValueTrace
-      cdebug << " == Value( " << l << ") (long)";
+      cdebug << " == Value( " << l << ") (CORBA::Long)";
 #endif
     }
     else {
       CORBA::Any * theValue = new CORBA::Any() ;
       if ( !strcmp( Type , "string" ) ) {
+       long ll = l;
         char t[40] ;
-        sprintf( t , "%ld" , l ) ;
+        sprintf( t , "%ld" , ll ) ;
         *theValue <<=  t ;
-        char *tt ;
+        const char *tt ;
         *theValue >>= tt ;
 #if ValueTrace
         cdebug << " --> Value( " << t << ") (string) kind " << theValue->type()->kind() ;
@@ -248,7 +253,8 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
 #ifdef REDHAT // mkr : debug for PAL12255
        *theValue <<= d ;
 #else
-       theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//JR   theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+       *theValue <<= (CORBA::Double) d ;
 #endif
         *theValue >>= d ;
 
@@ -305,7 +311,7 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
         char t[40] ;
         sprintf( t , "%lf" , d ) ;
         *theValue <<=  t ;
-        char *tt ;
+        const char *tt ;
         *theValue >>= tt ;
 #if ValueTrace
         cdebug << " --> Value( " << t << ") (string) kind " << theValue->type()->kind() ;
@@ -313,11 +319,11 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
       }
       else if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
                 !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
-        long l = (long ) d ;
+        CORBA::Long l = (CORBA::Long ) d ;
         *theValue <<= l ;
         *theValue >>= l;
 #if ValueTrace
-        cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ;
+        cdebug << " --> Value( " << l << ") (CORBA::Long) kind " << theValue->type()->kind() ;
 #endif
       }
       else { // Default
@@ -384,11 +390,16 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
       }
       else if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
                 !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
-        long l = (long ) obj ;
+#ifdef OMNI_LONG_IS_INT
+        long ll = (long ) obj ;
+        CORBA::Long l = (CORBA::Long ) ll ;
+#else
+        CORBA::Long l = (CORBA::Long ) obj ;
+#endif
         *theValue <<= l ;
         *theValue >>= l;
 #if ValueTrace
-        cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ;
+        cdebug << " --> Value( " << l << ") (CORBA::Long) kind " << theValue->type()->kind() ;
 #endif
       }
       else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
@@ -396,7 +407,8 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
 #ifdef REDHAT // mkr : debug for PAL12255
        *theValue <<= d ;
 #else
-       theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//JR   theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+       *theValue <<= (CORBA::Double) d ;
 #endif
         *theValue >>= d;
 #if ValueTrace
@@ -461,7 +473,7 @@ const CORBA::Any GraphBase::DataPort::Value() const {
 //JR 30.03.2005    switch ( theValue->type()->kind() ) {
     switch ( theValue.type()->kind() ) {
     case CORBA::tk_string: {
-      char * t;
+      const char * t;
 //JR 30.03.2005      *theValue >>= t;
       theValue >>= t;
 //      cdebug << "GraphBase::DataPort::Value() : " << t << " (string) " << endl ;
@@ -475,10 +487,10 @@ const CORBA::Any GraphBase::DataPort::Value() const {
       break;
     }
     case CORBA::tk_long: {
-      long l;
+      CORBA::Long l;
 //JR 30.03.2005      *theValue >>= l;
       theValue >>= l;
-//      cdebug << "GraphBase::DataPort::Value() : " << l << " (long) " << endl ;
+//      cdebug << "GraphBase::DataPort::Value() : " << l << " (CORBA::Long) " << endl ;
       break;
     }
     case CORBA::tk_objref: {
@@ -533,7 +545,7 @@ bool GraphBase::DataPort::BoolValue() const {
 //  cdebug << pthread_self() << " BoolValue() --> pthread_mutex_locked " << aMutexWait
 //         << endl ;
   if ( (*_Value)->type()->kind() == CORBA::tk_long ) {
-    long val ;
+    CORBA::Long val ;
     **_Value >>= val ;
     if ( val ) {
       RetVal = true ;
@@ -571,7 +583,7 @@ void GraphBase::DataPort::StringValue(ostream & f ) const {
     const CORBA::Any * theValue = *_Value ;
     switch (theValue->type()->kind()) {
     case CORBA::tk_string:
-      char * t;
+      const char * t;
       *theValue >>= t;
       f << t << " (string)" ;
       break;
@@ -581,9 +593,9 @@ void GraphBase::DataPort::StringValue(ostream & f ) const {
       f << d << " (double)" ;
       break;
     case CORBA::tk_long:
-      long l;
+      CORBA::Long l;
       *theValue >>= l;
-      f << l << " (long)" ;
+      f << l << " (CORBA::Long)" ;
       break;
     case CORBA::tk_objref:
       CORBA::Object_ptr ObjRef ;