Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / Bug_2542_Regression / bug_2542_regression.cpp
blobb50261e9d9d9fbeb116439abd05a4f8aadf6547a
1 #include "TestC.h"
2 #include "tao/CodecFactory/CodecFactory.h"
4 int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
6 try
8 CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
9 CORBA::Object_var object =
10 orb->resolve_initial_references("CodecFactory");
12 IOP::CodecFactory_var codec_factory =
13 IOP::CodecFactory::_narrow(object.in ());
14 IOP::Encoding e = {IOP::ENCODING_CDR_ENCAPS,1,2};
16 IOP::Codec_var codec = codec_factory->create_codec(e);
18 CORBA::Any any_o;
19 Value* value = new OBV_Value;
20 any_o <<= &value;
22 CORBA::OctetSeq_var bin = codec->encode(any_o);
23 CORBA::Any_var any_n = codec->decode(bin.in ());
25 catch (const CORBA::Exception& ex)
27 ex._tao_print_exception ("Caught a CORBA exception\n");
28 return 1;
30 catch (...)
32 return 1;
35 return 0;