2 #include "tao/CodecFactory/CodecFactory.h"
4 #include "ace/Log_Msg.h"
7 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
12 CORBA::ORB_init (argc
,
16 // Obtain a reference to the CodecFactory.
17 CORBA::Object_var obj
=
18 orb
->resolve_initial_references ("CodecFactory");
20 IOP::CodecFactory_var codec_factory
=
21 IOP::CodecFactory::_narrow (obj
.in ());
23 // ----------------------------------------------------------
25 // Set up a structure that contains information necessary to
26 // create a GIOP 1.1 CDR encapsulation Codec.
27 IOP::Encoding encoding
;
28 encoding
.format
= IOP::ENCODING_CDR_ENCAPS
;
29 encoding
.major_version
= 1;
30 encoding
.minor_version
= 1;
32 // Obtain the CDR encapsulation Codec.
33 IOP::Codec_var codec
=
34 codec_factory
->create_codec (encoding
);
36 // ----------------------------------------------------------
38 CORBA::OctetSeq_var encoded_data
;
39 CORBA::Any_var decoded_data
;
41 Foo::type_ulong l
= 9192631;
48 codec
->encode_value (tmp
);
51 codec
->decode_value (encoded_data
.in (),
54 Foo::type_ulong check
= 0;
56 if (!(decoded_data
>>= check
))
57 ACE_ERROR_RETURN ((LM_ERROR
,
58 "ERROR: Unable to extract typedefed decoded "
63 ACE_ERROR_RETURN ((LM_ERROR
,
64 "ERROR: Extracted value not equal "
65 "to the encoded value\n"),
70 "(%P|%t) Test passed\n"));
72 catch (const CORBA::Exception
& ex
)
74 ex
._tao_print_exception ("Bug_1693_Test test:");