Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / DevGuideExamples / PortableInterceptors / SimpleCodec / ClientInterceptor.cpp
blobe083f001718b20e6eb0d9356a518ad722a16f2b9
1 #include "ClientInterceptor.h"
2 #include "tao/OctetSeqC.h"
3 #include "tao/PI/ClientRequestInfo.h"
4 #include <iostream>
6 const CORBA::ULong service_ctx_id = 0xdeed;
8 ClientInterceptor::
9 ClientInterceptor (IOP::CodecFactory_var cf)
10 : myname_ ("Client_Authentication_Interceptor")
12 std::cout << "Calling ClientInterceptor constructor." << std::endl;
14 // Set up a structure that contains information necessary to
15 // create a GIOP 1.2 CDR encapsulation Codec.
16 IOP::Encoding encoding;
17 encoding.format = IOP::ENCODING_CDR_ENCAPS;
18 encoding.major_version = 1;
19 encoding.minor_version = 2;
21 // Obtain the CDR encapsulation Codec.
22 this->codec = cf->create_codec (encoding);
25 ClientInterceptor::~ClientInterceptor ()
29 char *
30 ClientInterceptor::name ()
32 std::cout << "Calling ClientInterceptor name() method" << std::endl;
33 return CORBA::string_dup (this->myname_);
36 void
37 ClientInterceptor::destroy ()
41 void
42 ClientInterceptor::send_poll (
43 PortableInterceptor::ClientRequestInfo_ptr ri)
45 ACE_UNUSED_ARG(ri);
46 std::cout << "Calling send_poll()." << std::endl;
50 void
51 ClientInterceptor::send_request (
52 PortableInterceptor::ClientRequestInfo_ptr ri)
54 std::cout << "Calling send_request()." << std::endl;
56 IOP::ServiceContext sc;
57 sc.context_id = service_ctx_id;
59 const CORBA::Long gid = 9007;
60 std::cout << "GID: " << gid << std::endl;
62 CORBA::Any gid_as_any;
63 gid_as_any <<= gid;
65 sc.context_data = *codec->encode(gid_as_any);
67 // Add this context to the service context list.
68 ri->add_request_service_context (sc, false);
71 void
72 ClientInterceptor::receive_reply (
73 PortableInterceptor::ClientRequestInfo_ptr ri)
75 ACE_UNUSED_ARG(ri);
76 std::cout << "Calling receive_reply()." << std::endl;
79 void
80 ClientInterceptor::receive_other (
81 PortableInterceptor::ClientRequestInfo_ptr ri)
83 ACE_UNUSED_ARG(ri);
84 std::cout << "Calling receive_other()." << std::endl;
87 void
88 ClientInterceptor::receive_exception (
89 PortableInterceptor::ClientRequestInfo_ptr ri)
91 ACE_UNUSED_ARG(ri);
92 std::cout << "Calling receive_exception()." << std::endl;