Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/superv.git] / src / GraphBase / DataFlowBase_DataPort.cxx
1 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : DataFlowBase_DataPort.cxx
25 //  Author : Jean Rahuel, CEA
26 //  Module : SUPERV
27 //  $Header:
28
29 using namespace std;
30 #include <stdio.h>
31 #include "DataFlowBase_DataPort.hxx"
32
33 GraphBase::DataPort::DataPort() :
34               Port() {
35   pthread_mutex_init( &_MutexWait , NULL ) ;
36   _PortState = SUPERV::UndefinedState ;
37   _Done = false ;
38   InitialValues( CORBA::Any() ) ;
39 }
40
41 GraphBase::DataPort::DataPort( const char *const * NodeName  ,
42                                const SALOME_ModuleCatalog::ServicesParameter aserviceParameter ,
43                                const SUPERV::KindOfPort aKind ,
44                                const SALOME_ModuleCatalog::DataStreamDependency aDependency ) :
45            Port( NodeName , aserviceParameter , aKind , aDependency ) {
46   pthread_mutex_init( &_MutexWait , NULL ) ;
47   _PortState = SUPERV::UndefinedState ;
48   _Done = false ;
49   InitialValues( CORBA::Any() ) ;
50 }
51
52 GraphBase::DataPort::~DataPort() {
53 }
54
55 void GraphBase::DataPort::InitialValues(CORBA::Any aValue ) {
56   _theValue = new CORBA::Any( aValue ) ;
57 //JR 24.02.2005 Memory Leak  string _Type = CORBA::string_dup(GetServicesParameter().Parametertype) ;
58   string _Type = string( GetServicesParameter().Parametertype ) ;
59   const char * Type = _Type.c_str();
60   CORBA::Any InitialValue ;
61   cdebug << "InitialValues " << NodeName() << " " << PortName() << " " << PortType()
62          << " : " ;
63   if ( !strcmp( Type , "" ) ) {
64     cdebug << "void" << endl ;
65     InitialValue <<= (void *) NULL ;
66   }
67   else if ( !strcmp( Type , "string" ) ) {
68     cdebug << "string" << endl ;
69 //    InitialValue <<= (char *) NULL ;
70     InitialValue <<= "" ;
71   }
72   else if ( !strcmp( Type , "boolean" ) ) {
73     cdebug << "boolean" << endl ;
74     InitialValue <<= (CORBA::Long ) 0 ;
75   }
76   else if ( !strcmp( Type , "char" ) ) {
77     cdebug << "char" << endl ;
78     InitialValue <<= (CORBA::Long ) 0 ;
79   }
80   else if ( !strcmp( Type , "short" ) ) {
81     cdebug << "short" << endl ;
82     InitialValue <<= (CORBA::Long ) 0 ;
83   }
84   else if ( !strcmp( Type , "int" ) ) {
85     cdebug << "long" << endl ;
86     InitialValue <<= (CORBA::Long ) 0 ;
87   }
88   else if ( !strcmp( Type , "long" ) ) {
89     cdebug << "long" << endl ;
90     InitialValue <<= (CORBA::Long ) 0 ;
91   }
92   else if ( !strcmp( Type , "float" ) ) {
93     cdebug << "float" << endl ;
94 #ifdef REDHAT // mkr : debug for PAL12255
95     InitialValue <<= (float ) 0. ;
96 #else     
97 //JR    double d = 0.;
98 //JR    InitialValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
99     InitialValue <<= (CORBA::Float) 0. ;
100 #endif
101     
102   }
103   else if ( !strcmp( Type , "double" ) ) {
104     cdebug << "double" << endl ;
105 #ifdef REDHAT // mkr : debug for PAL12255
106     InitialValue <<= (double ) 0. ;
107 #else
108 //JR    double d = 0.;
109 //JR    InitialValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
110     InitialValue <<= (CORBA::Double) 0. ;
111 #endif
112   }
113   else { // Default
114     cdebug << "objref" << endl ;
115 //    InitialValue.replace(CORBA::_tc_Object, NULL);
116     InitialValue <<= CORBA::Object::_nil() ;
117   }
118 //  else {
119 //    cdebug << "InitialValues ERROR (other) " << Type << endl ;
120 //    InitialValue <<= (CORBA::Long ) 0 ;
121 //  }
122   _InitialValue = new CORBA::Any( InitialValue ) ;
123   _Value = &_InitialValue ;
124 }
125
126 void GraphBase::DataPort::SetValue( const CORBA::Any & aDataValue ) {
127   CORBA::Any * aValue = new CORBA::Any( aDataValue ) ;
128   SetValue( aValue ) ;
129 }
130
131 #define ValueTrace 0
132 void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
133 //  cdebug << pthread_self() << " SetValue(aDataValue) --> pthread_mutex_lock " << &_MutexWait
134 //         << endl ;
135   if ( pthread_mutex_lock( &_MutexWait ) ) {
136     perror( "lock DataValue" ) ;
137     exit( 0 ) ;
138   }
139 //  cdebug << pthread_self() << " SetValue(aDataValue) pthread_mutex_locked " << &_MutexWait
140 //         << endl ;
141
142   delete _theValue ;
143
144 //JR 21.02.2005 Debug Memory leak :  string _Type = CORBA::string_dup( GetServicesParameter().Parametertype ) ;
145 //  const char * Type = _Type.c_str() ;
146   const char * Type = GetServicesParameter().Parametertype ;
147   _Value = &_theValue ;
148 #if ValueTrace
149   cdebug << "NewValue " << NodeName() << " " << PortName() << " " << PortType()
150          << " : " << aDataValue << " kind " << aDataValue->type()->kind() << " " ;
151 #endif
152   switch (aDataValue->type()->kind()) { // Input Value
153   case CORBA::tk_string: { // Input string Value
154     const char * t;
155     *aDataValue >>= t;
156 #if ValueTrace
157     cdebug << t << " (string)" ;
158 #endif
159     if ( !strcmp( Type , "string" ) ) { // SuperVision Value
160       _theValue = aDataValue ;
161       *_theValue >>= t;
162 #if ValueTrace
163       cdebug << " == Value( " << t << ") (string)";
164 #endif
165     }
166     else {
167       CORBA::Any * theValue = new CORBA::Any() ;
168       if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
169            !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
170         long ll ;
171         sscanf( t , "%ld" , &ll ) ;
172         CORBA::Long l = ll ;
173         *theValue <<= l ;
174         *theValue >>= l;
175 #if ValueTrace
176         cdebug << " --> Value( " << l << ") (CORBA::Long) kind " << theValue->type()->kind() ;
177 #endif
178       }
179       else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
180         double d ;
181         sscanf( t , "%lf" , &d ) ;
182 #ifdef REDHAT // mkr : debug for PAL12255
183         *theValue <<= d ;
184 #else
185 //JR    theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
186         *theValue <<= (CORBA::Double) d ;
187 #endif
188         *theValue >>= d ;
189 #if ValueTrace
190         cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
191 #endif
192       }
193       else { // Default
194         CORBA::Object_ptr ObjRef ;
195         try {
196           ObjRef = StringToObject( t ) ;
197           *theValue <<= ObjRef ;
198         }
199         catch( ... ) {
200           *theValue <<= CORBA::Object::_nil() ;
201         }
202 #if OMNIORB_VERSION >= 4
203         *theValue >>= (CORBA::Any::to_object ) ObjRef ;
204 #else
205         *theValue >>= ObjRef ;
206 #endif
207 #if ValueTrace
208         cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind "
209                << theValue->type()->kind() ;
210 #endif
211       }
212       //_theValue = theValue ;
213       _theValue = new CORBA::Any( *theValue ) ;
214
215       //*_Value = theValue ;
216       _Value = &_theValue ;
217
218 //JR 21.02.2005 Debug Memory leak : 
219       delete aDataValue ;
220     }
221     break;
222   }
223   case CORBA::tk_long: { // Input CORBA::Long Value
224     CORBA::Long l;
225     *aDataValue >>= l;
226 #if ValueTrace
227     cdebug << "Value( " << l << ") (CORBA::Long)";
228 #endif
229     if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
230          !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { // SuperVision Value
231       _theValue = aDataValue ;
232       *_Value = aDataValue ;
233       *_theValue >>= l;
234 #if ValueTrace
235       cdebug << " == Value( " << l << ") (CORBA::Long)";
236 #endif
237     }
238     else {
239       CORBA::Any * theValue = new CORBA::Any() ;
240       if ( !strcmp( Type , "string" ) ) {
241         long ll = l;
242         char t[40] ;
243         sprintf( t , "%ld" , ll ) ;
244         *theValue <<=  t ;
245         const char *tt ;
246         *theValue >>= tt ;
247 #if ValueTrace
248         cdebug << " --> Value( " << t << ") (string) kind " << theValue->type()->kind() ;
249 #endif
250       }
251       else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
252         double d = l ;
253 #ifdef REDHAT // mkr : debug for PAL12255
254         *theValue <<= d ;
255 #else
256 //JR    theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
257         *theValue <<= (CORBA::Double) d ;
258 #endif
259         *theValue >>= d ;
260
261 #if ValueTrace
262         cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
263 #endif
264       }
265       else { // Default
266         CORBA::Object_ptr ObjRef ;
267         *theValue <<= CORBA::Object::_nil() ;
268 #if OMNIORB_VERSION >= 4
269         *theValue >>= (CORBA::Any::to_object ) ObjRef ;
270 #else
271         *theValue >>= ObjRef ;
272 #endif
273 #if ValueTrace
274         cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind "
275                << theValue->type()->kind() ;
276 #endif
277       }
278
279       //_theValue = theValue ;
280       _theValue = new CORBA::Any( *theValue ) ;
281
282       //*_Value = theValue ;
283       _Value = &_theValue ;
284
285 //JR 21.02.2005 Debug Memory leak : 
286       delete aDataValue ;
287     }
288     break;
289   }
290   case CORBA::tk_double: { // Input double Value
291     double d;
292     *aDataValue >>= d;
293 #if ValueTrace
294     cdebug << "Value( " << d << ") (double)";
295 #endif
296     if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) { // SuperVision Value
297       //_theValue = aDataValue ;
298       _theValue = new CORBA::Any( *aDataValue ) ;
299
300       //*_Value = aDataValue ;
301       _Value = &_theValue ;
302
303       *_theValue >>= d;
304 #if ValueTrace
305       cdebug << " == Value( " << d << ") (double)";
306 #endif
307     }
308     else {
309       CORBA::Any * theValue = new CORBA::Any() ;
310       if ( !strcmp( Type , "string" ) ) {
311         char t[40] ;
312         sprintf( t , "%lf" , d ) ;
313         *theValue <<=  t ;
314         const char *tt ;
315         *theValue >>= tt ;
316 #if ValueTrace
317         cdebug << " --> Value( " << t << ") (string) kind " << theValue->type()->kind() ;
318 #endif
319       }
320       else if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
321                 !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
322         CORBA::Long l = (CORBA::Long ) d ;
323         *theValue <<= l ;
324         *theValue >>= l;
325 #if ValueTrace
326         cdebug << " --> Value( " << l << ") (CORBA::Long) kind " << theValue->type()->kind() ;
327 #endif
328       }
329       else { // Default
330         CORBA::Object_ptr ObjRef ;
331         *theValue <<= CORBA::Object::_nil() ;
332 #if OMNIORB_VERSION >= 4
333         *theValue >>= (CORBA::Any::to_object ) ObjRef ;
334 #else
335         *theValue >>= ObjRef ;
336 #endif
337 #if ValueTrace
338         cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind "
339                << theValue->type()->kind() ;
340 #endif
341       }
342       //_theValue = theValue ;
343       _theValue = new CORBA::Any( *theValue ) ;
344
345       //*_Value = theValue ;
346       _Value = &_theValue ;
347
348 //JR 21.02.2005 Debug Memory leak : 
349       delete aDataValue ;
350     }
351     break;
352   }
353   case CORBA::tk_objref: { // Input objref Value
354     CORBA::Object_ptr obj ;
355 #if OMNIORB_VERSION >= 4
356     *aDataValue >>= (CORBA::Any::to_object ) obj;
357 #else
358     *aDataValue >>= obj;
359 #endif
360 #if ValueTrace
361     cdebug << "Value( " << ObjectToString( obj ) << ") (object reference)";
362 #endif
363     if ( strcmp( Type , "string" ) &&
364          strcmp( Type , "boolean" ) && strcmp( Type , "char" ) &&
365          strcmp( Type , "short" ) && strcmp( Type , "long" ) &&
366          strcmp( Type , "double" ) ) { // SuperVision Default Value
367       _theValue = aDataValue ;
368       *_Value = aDataValue ;
369 #if OMNIORB_VERSION >= 4
370       *_theValue >>= (CORBA::Any::to_object ) obj ;
371 #else
372       *_theValue >>= obj;
373 #endif
374 #if ValueTrace
375       cdebug << " == Value( " << ObjectToString( obj ) << ") (object reference)";
376 #endif
377     }
378     else {
379       CORBA::Any * theValue = new CORBA::Any() ;
380       if ( !strcmp( Type , "string" ) ) {
381         *theValue <<=  ObjectToString( obj ) ;
382 #if OMNIORB_VERSION >= 4
383         *theValue >>= (CORBA::Any::to_object ) obj ;
384 #else
385         *theValue >>= obj ;
386 #endif
387 #if ValueTrace
388         cdebug << " --> Value( " << ObjectToString( obj ) << ") (string) kind " << theValue->type()->kind() ;
389 #endif
390       }
391       else if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
392                 !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
393 #ifdef OMNI_LONG_IS_INT
394         long ll = (long ) obj ;
395         CORBA::Long l = (CORBA::Long ) ll ;
396 #else
397         CORBA::Long l = (CORBA::Long ) obj ;
398 #endif
399         *theValue <<= l ;
400         *theValue >>= l;
401 #if ValueTrace
402         cdebug << " --> Value( " << l << ") (CORBA::Long) kind " << theValue->type()->kind() ;
403 #endif
404       }
405       else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
406         double d = (double ) 0. ;
407 #ifdef REDHAT // mkr : debug for PAL12255
408         *theValue <<= d ;
409 #else
410 //JR    theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
411         *theValue <<= (CORBA::Double) d ;
412 #endif
413         *theValue >>= d;
414 #if ValueTrace
415         cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
416 #endif
417       }
418       //_theValue = theValue ;
419       _theValue = new CORBA::Any( *theValue ) ;
420
421       //*_Value = theValue ;
422       _Value = &_theValue ;
423
424 //JR 21.02.2005 Debug Memory leak : 
425       delete aDataValue ;
426     }
427     break;
428   }
429   default: {
430     cdebug << "Value" << " (other(tk_string,tk_double,tk_long,tk_objref)) ERROR kind "
431            << aDataValue->type()->kind() ;
432     break;
433   }
434   }
435 #if ValueTrace
436   cdebug << endl ;
437 #endif
438   if ( pthread_mutex_unlock( &_MutexWait ) ) {
439     perror( "unlock DataValue" ) ;
440     exit( 0 ) ;
441   }
442 //  cdebug << pthread_self() << " SetValue(aDataValue) --> pthread_mutex_unlocked " << &_MutexWait
443 //         << endl ;
444
445 }
446
447 // PAL8506
448 //JR 30.03.2005 Memory Leak + Debug(crash) CORBA::Any const * GraphBase::DataPort::Value() const {
449 const CORBA::Any GraphBase::DataPort::Value() const {
450   pthread_mutex_t * aMutexWait = (pthread_mutex_t *) &_MutexWait ;
451 //  cdebug << pthread_self() << " Value() --> pthread_mutex_lock " << aMutexWait << endl ;
452   if ( pthread_mutex_lock( aMutexWait ) ) {
453     perror( "lock DataValue" ) ;
454     exit( 0 ) ;
455   }
456 //  cdebug << pthread_self() << " Value() --> pthread_mutex_locked " << aMutexWait << endl ;
457   const CORBA::Any *const Value = *_Value ;
458 //JR 30.03.2005  CORBA::Any * theValue ;
459   CORBA::Any theValue ;
460 //  cdebug  << pthread_self() << " Value " << NodeName() << " " << PortName() << " "
461 //          << PortType() << " _Value " << _Value << " *_Value " << *_Value  << " Value->type "
462 //          << Value->type() ;
463   if ( Value->type() ) {
464 //    cdebug << " kind " << Value->type()->kind() << " :" << endl ;
465   }
466   else {
467 //    cdebug << " Null" << endl ;
468   }
469   if ( PortDone() ) {
470 //JR 21.02.2005 Debug Memory leak :     theValue = new CORBA::Any( *Value ) ;
471 //JR 30.03.2005     theValue = (CORBA::Any * ) Value ;
472     theValue = *Value ;
473 //JR 30.03.2005    switch ( theValue->type()->kind() ) {
474     switch ( theValue.type()->kind() ) {
475     case CORBA::tk_string: {
476       const char * t;
477 //JR 30.03.2005      *theValue >>= t;
478       theValue >>= t;
479 //      cdebug << "GraphBase::DataPort::Value() : " << t << " (string) " << endl ;
480       break;
481     }
482     case CORBA::tk_double: {
483       double d;
484 //JR 30.03.2005      *theValue >>= d;
485       theValue >>= d;
486 //      cdebug << "GraphBase::DataPort::Value() : " << d << " (double) " << endl ;
487       break;
488     }
489     case CORBA::tk_long: {
490       CORBA::Long l;
491 //JR 30.03.2005      *theValue >>= l;
492       theValue >>= l;
493 //      cdebug << "GraphBase::DataPort::Value() : " << l << " (CORBA::Long) " << endl ;
494       break;
495     }
496     case CORBA::tk_objref: {
497       CORBA::Object_ptr obj ;
498       char * retstr ;
499       try {
500 //JR 30.03.2005        *theValue >>= obj ;
501 #if OMNIORB_VERSION >= 4
502         theValue >>= (CORBA::Any::to_object ) obj ;
503 #else
504         theValue >>= obj ;
505 #endif
506         retstr = ObjectToString( obj );
507 //        cdebug << "GraphBase::DataPort::Value() : " << retstr
508 //               << "(object reference) " << endl;
509       }
510       catch( ... ) {
511         cdebug << "ToString( object ) Catched ERROR" << endl ;
512       }
513       break;
514     }
515     default: {
516       cdebug << "GraphBase::DataPort::Value() : " << NodeName() << "( " << PortName() << " ) " << PortType()
517              << " (other(tk_string,tk_double,tk_long,tk_objref)) ERROR" << endl ;
518       break;
519     }
520     }
521   }
522   else {
523 //    cdebug << "GraphBase::DataPort::InitialValue() " << endl ;
524 //JR 21.02.2005 Debug Memory leak :    theValue = new CORBA::Any( *Value ) ;
525 //JR 30.03.2005    theValue = (CORBA::Any * ) Value ;
526     theValue = *Value ;
527   }
528   if ( pthread_mutex_unlock( aMutexWait ) ) {
529     perror( "unlock DataValue" ) ;
530     exit( 0 ) ;
531   }
532 //  cdebug << pthread_self() << " Value() --> pthread_mutex_unlocked " << aMutexWait << endl ;
533     
534   return theValue ;
535 }
536
537 bool GraphBase::DataPort::BoolValue() const {
538   bool RetVal = false ;
539   pthread_mutex_t * aMutexWait = (pthread_mutex_t *) &_MutexWait ;
540 //  cdebug << pthread_self() << " BoolValue() --> pthread_mutex_lock " << aMutexWait << endl ;
541   if ( pthread_mutex_lock( aMutexWait ) ) {
542     perror( "lock DataValue" ) ;
543     exit( 0 ) ;
544   }
545 //  cdebug << pthread_self() << " BoolValue() --> pthread_mutex_locked " << aMutexWait
546 //         << endl ;
547   if ( (*_Value)->type()->kind() == CORBA::tk_long ) {
548     CORBA::Long val ;
549     **_Value >>= val ;
550     if ( val ) {
551       RetVal = true ;
552     }
553   }
554   else if ( (*_Value)->type()->kind() == CORBA::tk_boolean ) {
555     bool val ;
556     **_Value >>= val ;
557     if ( val ) {
558       RetVal = true ;
559     }
560   }
561   if ( pthread_mutex_unlock( aMutexWait ) ) {
562     perror( "unlock DataValue" ) ;
563     exit( 0 ) ;
564   }
565 //  cdebug << pthread_self() << " " << NodeName() << "( " << PortName() << " ) BoolValue " << RetVal << endl ;
566   return RetVal ;
567 }
568
569 void GraphBase::DataPort::StringValue(ostream & f ) const {
570   pthread_mutex_t * aMutexWait = (pthread_mutex_t *) &_MutexWait ;
571 //  cdebug_in << pthread_self() << " StringValue() --> pthread_mutex_lock " << aMutexWait
572 //            << endl ;
573   if ( pthread_mutex_lock( aMutexWait ) ) {
574     perror( "lock DataValue" ) ;
575     exit( 0 ) ;
576   }
577 //  cdebug << pthread_self() << " StringValue() --> pthread_mutex_locked " << aMutexWait
578 //         << endl ;
579   if ( PortDone() ) {
580 //    cdebug << "StringValue " << NodeName() << " " << PortName() << " " << PortType()
581 //           << " _Value "  << _Value << " *_Value "
582 //           << *_Value  << " " << endl ;
583     const CORBA::Any * theValue = *_Value ;
584     switch (theValue->type()->kind()) {
585     case CORBA::tk_string:
586       const char * t;
587       *theValue >>= t;
588       f << t << " (string)" ;
589       break;
590     case CORBA::tk_double:
591       double d;
592       *theValue >>= d;
593       f << d << " (double)" ;
594       break;
595     case CORBA::tk_long:
596       CORBA::Long l;
597       *theValue >>= l;
598       f << l << " (CORBA::Long)" ;
599       break;
600     case CORBA::tk_objref:
601       CORBA::Object_ptr ObjRef ;
602       try {
603 #if OMNIORB_VERSION >= 4
604         *theValue >>= (CORBA::Any::to_object ) ObjRef ;
605 #else
606         *theValue >>= ObjRef ;
607 #endif
608         f << "(object reference) " << ObjectToString( ObjRef ) ;
609       }
610       catch(...) {
611         f << "(object reference) catched error" ;
612       }
613       break;
614     default:
615       f << "(other ERROR)" ;
616       break;
617     }
618   }
619   else {
620     f << " Default (undefined) DATAPORT NOT DONE"  ;
621   }
622   if ( pthread_mutex_unlock( aMutexWait ) ) {
623     perror( "unlock DataValue" ) ;
624     exit( 0 ) ;
625   }
626 //  cdebug_out << pthread_self() << " StringValue() --> pthread_mutex_unlocked " << aMutexWait
627 //             << endl ;
628     
629 }
630
631