Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / TransportCurrent / lib / Client_Request_Interceptor.h
blob49bbe7f5619afbeb819750d2a3c87a2d124ff075
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Client_Request_Interceptor.h
7 * Implementation header for the client request interceptor for the
8 * Transport::Current test.
10 * @author Ossama Othman <ossama@uci.edu>
12 //=============================================================================
14 #ifndef CLIENT_REQUEST_INTERCEPTOR_H
15 #define CLIENT_REQUEST_INTERCEPTOR_H
17 #include /**/ "ace/config.h"
18 #include /**/ "Current_Test_Export.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "tao/PI/PI.h"
25 #include "tao/PortableInterceptorC.h"
26 #include "tao/LocalObject.h"
27 #include "tao/ORB.h"
28 #include "tao/CORBA_String.h"
30 namespace Test
32 /// A metod doing the actual testing, so we could change it for the
33 /// different traits implementations
34 typedef int (*TEST) (CORBA::ORB_ptr);
37 /**
38 * @class Client_Request_Interceptor
40 * @brief Client request interceptor that exercises
41 * Transport::Current support.
43 * This client request interceptor forwards a request to a secondary
44 * object by throwing the PortableInterceptor::ForwardRequest
45 * exception from within the send_request() interception point. It
46 * only forwards the initial request. See the README file for
47 * details.
49 class Current_Test_Export Client_Request_Interceptor
50 : public virtual PortableInterceptor::ClientRequestInterceptor,
51 public virtual ::CORBA::LocalObject
53 public:
54 /// Constructor.
55 Client_Request_Interceptor (const char *orb_id,
56 TEST test);
57 /**
58 * @name Methods Required by the Client Request Interceptor
59 * Interface
61 * These are methods that must be implemented since they are pure
62 * virtual in the abstract base class. They are the canonical
63 * methods required for all client request interceptors.
65 //@{
66 /// Return the name of this ClientRequestinterceptor.
67 virtual char * name ();
69 virtual void destroy ();
71 virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri);
73 virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr ri);
75 virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri);
77 virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri);
79 virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri);
80 //@}
82 // Number of interceptions
83 CORBA::Long interceptions ();
85 private:
86 // Implementation method, every inteception point will have to
87 // call it, supplying a name.
88 void test_transport_current (const ACE_TCHAR* amethod);
90 private:
91 ///The ID of the ORB this interceptor is registered with.
92 CORBA::String_var orb_id_;
94 /// Pseudo-reference to the ORB this interceptor is registered
95 /// with.
96 CORBA::ORB_var orb_;
98 /// The number of requests intercepted by this interceptor.
99 CORBA::ULong request_count_;
101 /// Stringified reference to the object the initial request will be
102 /// forwarded to by this interceptor.
103 CORBA::String_var forward_str_;
105 /// Synchronize internal state...
106 TAO_SYNCH_MUTEX lock_;
108 /// Unique request ID
109 unsigned long requestID_;
111 /// Test function
112 TEST test_;
114 } // namespace Test
116 #endif /* CLIENT_REQUEST_INTERCEPTOR_H */