Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Mixed_Sync_ASync_Events / test_i.h
blobef96d582596a1b0e3f8de9cd8ebcb9e056ae089b
2 //=============================================================================
3 /**
4 * @file test_i.h
5 */
6 //=============================================================================
8 #ifndef TAO_MSAE_TEST_I_H
9 #define TAO_MSAE_TEST_I_H
11 #include "testS.h"
13 /**
14 * @class Test_i
16 * @brief Test implementation
18 * Implements the Test interface in test.idl
20 class Test_i : public POA_A::Test
22 public:
23 /// ctor
24 Test_i (CORBA::ORB_ptr orb,
25 A::AMI_TestHandler_ptr rh,
26 CORBA::ULong max_count = 10,
27 A::RunMode mode = A::RM_SLAVE);
29 void set_opponent (A::Test_ptr opp);
31 virtual void request (
32 ::A::RequestMode mode,
33 ::CORBA::ULong & counter,
34 ::A::FollowUp_out follow_up);
36 virtual void report (
37 const char * msg);
39 void shutdown (void);
41 private:
42 CORBA::ORB_var orb_;
44 A::AMI_TestHandler_var rh_;
46 A::Test_var opponent_;
48 CORBA::ULong max_count_;
50 A::RunMode mode_;
52 unsigned int seed_;
55 class TestHandler
56 : public ACE_Event_Handler
58 public:
59 TestHandler (CORBA::ORB_ptr orb,
60 CORBA::ULong max_count,
61 A::RunMode mode);
63 void set_counter (CORBA::ULong counter);
65 void set_opponent (A::Test_ptr opp);
67 void set_reply_handler (A::AMI_TestHandler_ptr rh);
69 virtual int handle_timeout (const ACE_Time_Value &tv,
70 const void *arg);
72 virtual int handle_exception (ACE_HANDLE fc = ACE_INVALID_HANDLE);
74 void handle_followup (A::FollowUp fup, CORBA::ULong counter);
76 void start ();
78 CORBA::ORB_ptr orb () { return this->orb_.in (); }
79 A::Test_ptr opponent () { return this->opponent_.in (); }
80 CORBA::ULong max_count () { return this->max_count_; }
81 A::RunMode mode () { return this->mode_; }
83 private:
84 CORBA::ORB_var orb_;
85 A::Test_var opponent_;
86 A::AMI_TestHandler_var rh_;
87 CORBA::ULong max_count_;
88 A::RunMode mode_;
89 CORBA::ULong counter_;
90 unsigned int seed_;
93 class Test_Reply_i : public POA_A::AMI_TestHandler
95 public:
96 Test_Reply_i (CORBA::ORB_ptr orb,
97 CORBA::ULong max_count,
98 A::RunMode mode);
100 virtual void request (
101 ::CORBA::ULong counter,
102 ::A::FollowUp follow_up);
104 virtual void request_excep (
105 ::Messaging::ExceptionHolder * excep_holder);
107 virtual void report (
108 void);
110 virtual void report_excep (
111 ::Messaging::ExceptionHolder * excep_holder);
113 TestHandler& test_handler () { return this->evh_; }
115 private:
116 TestHandler evh_;
121 #endif /* TAO_MSAE_TEST_I_H */