2 #include "tao/CodecFactory/CodecFactory.h"
4 int ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
8 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
10 orb
->register_value_factory(
11 Base::_tao_obv_static_repository_id(),
13 orb
->register_value_factory(
14 Value::_tao_obv_static_repository_id(),
17 CORBA::Object_var object
=
18 orb
->resolve_initial_references("CodecFactory");
20 IOP::CodecFactory_var codec_factory
=
21 IOP::CodecFactory::_narrow(object
.in ());
22 IOP::Encoding e
= {IOP::ENCODING_CDR_ENCAPS
,1,2};
24 IOP::Codec_var codec
= codec_factory
->create_codec(e
);
29 values
[0] = new OBV_Value(1,"An instance of Value");
31 any_o
.type(_tc_BaseSeq
);
33 CORBA::OctetSeq_var bin
= codec
->encode(any_o
);
34 CORBA::Any_var any_n
= codec
->decode(bin
.in ());
36 const BaseSeq
* out
= 0;
37 if (!(any_n
.in () >>= out
))
39 ACE_ERROR_RETURN ((LM_ERROR
,
40 "Error: extract out of any failed\n"),
43 if (ACE_OS::strcmp( (*out
)[0]->_tao_obv_repository_id(),
44 Value::_tao_obv_static_repository_id()) != 0)
46 ACE_ERROR_RETURN ((LM_ERROR
, "Error: wrong type!\n"), 1);
51 catch (const CORBA::Exception
& ex
)
53 ex
._tao_print_exception ("Caught a CORBA exception\n");