ACE+TAO-7_0_8
[ACE_TAO.git] / TAO / tests / Bug_2542_Regression / bug_2542_regression.cpp
blob7ade799ab8115768d13bcd7febb43825c996511e
1 #include "TestC.h"
2 #include "tao/CodecFactory/CodecFactory.h"
4 int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
7 try
9 CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
10 CORBA::Object_var object =
11 orb->resolve_initial_references("CodecFactory");
13 IOP::CodecFactory_var codec_factory =
14 IOP::CodecFactory::_narrow(object.in ());
15 IOP::Encoding e = {IOP::ENCODING_CDR_ENCAPS,1,2};
17 IOP::Codec_var codec = codec_factory->create_codec(e);
19 CORBA::Any any_o;
20 Value* value = new OBV_Value;
21 any_o <<= &value;
23 CORBA::OctetSeq_var bin = codec->encode(any_o);
24 CORBA::Any_var any_n = codec->decode(bin.in ());
26 catch (const CORBA::Exception& ex)
28 ex._tao_print_exception ("Caught a CORBA exception\n");
29 return 1;
31 catch (...)
33 return 1;
36 return 0;