From de0e6b45956e3640047575eaf8a62e3cd201daac Mon Sep 17 00:00:00 2001 From: rahuel Date: Tue, 30 Aug 2005 06:08:43 +0000 Subject: [PATCH] overload for << operator for Any type --- src/GraphBase/DataFlowBase_Base.cxx | 78 ++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/src/GraphBase/DataFlowBase_Base.cxx b/src/GraphBase/DataFlowBase_Base.cxx index f7ddcc9..ae44e86 100644 --- a/src/GraphBase/DataFlowBase_Base.cxx +++ b/src/GraphBase/DataFlowBase_Base.cxx @@ -29,7 +29,7 @@ using namespace std; #include "DataFlowBase_Base.hxx" -char *SuperVision_Version = "2.0" ; +char *SuperVision_Version = "3.0" ; char *NULLSTRING = "" ; @@ -70,6 +70,82 @@ CORBA::Object_ptr GraphBase::Base::StringToObject( char * obj ) const { return _Orb->string_to_object( obj ); } +ostream & GraphBase::Base::AnyValue( const CORBA::Any & anAny ) { + switch (anAny.type()->kind()) { + case CORBA::tk_string: { + char * t; + anAny >>= t; + *_fdebug << " " << t << " (tk_string)" << endl ; + break; + } + case CORBA::tk_boolean: { + bool b ; + anAny >>= (CORBA::Any::to_boolean ) b; + *_fdebug << " " << b << " (tk_boolean)" << endl ; + break; + } + case CORBA::tk_char: { + unsigned char c ; + anAny >>= (CORBA::Any::to_char ) c; + *_fdebug << " " << c << "(tk_char)" << endl ; + break; + } + case CORBA::tk_short: { + short s; + anAny >>= s; + *_fdebug << " " << s << "(tk_short)" << endl ; + break; + } + case CORBA::tk_long: { + long l; + anAny >>= l; + *_fdebug << " " << l << "(tk_long)" << endl ; + break; + } + case CORBA::tk_float: { + float f; + anAny >>= f; + *_fdebug << " " << f << "(tk_float)" << endl ; + break; + } + case CORBA::tk_double: { + double d; + anAny >>= d; + *_fdebug << " " << d << "(tk_double)" << endl ; + break; + } + case CORBA::tk_objref: { + try { + CORBA::Object_ptr obj ; + anAny >>= obj ; + if ( CORBA::is_nil( obj ) ) { + *_fdebug << "CORBA::Object_ptr " << obj << " nil reference (tk_object)" + << endl ; + } + else { + *_fdebug << "CORBA::Object_ptr " << obj << "(tk_object)" << endl ; + } + try { + char * retstr ; + retstr = ObjectToString( obj ) ; + *_fdebug << retstr << "(tk_object)" << endl ; + } + catch( ... ) { + *_fdebug << "ObjectToString( CORBA::Object_ptr ) Catched ERROR" << endl ; + } + } + catch( ... ) { + *_fdebug << "anAny >>= CORBA::Object_ptr ( tk_object ) Catched ERROR" << endl ; + } + break; + } + default: { + *_fdebug << " " << "(other ERROR)" << endl ; + } + } + return *_fdebug ; +} + string DataStreamTypeToString( const SALOME_ModuleCatalog::DataStreamType aDataStreamType ) { string aIdlType ; switch ( aDataStreamType ) { -- 2.39.2