1 #include "Messenger_i.h"
2 #include "tao/CodecFactory/CodecFactory.h"
4 Messenger_i::Messenger_i (CORBA::ORB_ptr orb
)
5 : orb_ (CORBA::ORB::_duplicate (orb
))
9 Messenger_i::~Messenger_i ()
15 Messenger_i::send_message (const CORBA::OctetSeq
& user_name
)
19 // Obtain a reference to the CodecFactory.
20 CORBA::Object_var obj
=
21 orb_
->resolve_initial_references ("CodecFactory");
23 IOP::CodecFactory_var codec_factory
=
24 IOP::CodecFactory::_narrow (obj
.in ());
26 // Set up a structure that contains information necessary to
27 // create a GIOP 1.2 CDR encapsulation Codec.
28 IOP::Encoding encoding
;
29 encoding
.format
= IOP::ENCODING_CDR_ENCAPS
;
30 encoding
.major_version
= 1;
31 encoding
.minor_version
= 2;
33 // Obtain the CDR encapsulation Codec.
34 IOP::Codec_var codec
=
35 codec_factory
->create_codec (encoding
);
37 CORBA::Any_var user_name_as_any
;
38 user_name_as_any
= codec
->decode(user_name
);
40 const char * name
= 0;
41 user_name_as_any
>>= name
;
42 ACE_DEBUG ((LM_DEBUG
, "User's name: %C\n", name
));
44 catch (const CORBA::SystemException
&ex
)
46 ex
._tao_print_exception ("ERROR");
48 catch (const CORBA::Exception
&e
)
50 e
._tao_print_exception ("ERROR");
55 Messenger_i::shutdown ()
57 this->orb_
->shutdown (false);