Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / NestedUpcall / MT_Client_Test / client.h
blobb4d9a8c861f09523ff800590be1eb013503582a4
2 //=============================================================================
3 /**
4 * @file client.h
6 * Test for multithreaded client using one global ORB (and Reactor)
8 * @author Michael Kircher
9 */
10 //=============================================================================
12 #ifndef MT_CLIENT_H
13 #define MT_CLIENT_H
15 #include "ace/Get_Opt.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "ace/Task.h"
22 #include "ace/Thread_Manager.h"
23 #include "tao/ORB.h"
24 #include "MT_Client_TestC.h"
26 /**
27 * @class MT_Client
29 * @brief A simple client talking to one server
31 * It is connecting to a server which holds the Object_A
32 * or using the "-m" switch to a server holding the MT_Object
34 class MT_Client
37 public:
38 /// = Constructor and destructor.
39 MT_Client (void);
40 ~MT_Client (void);
42 /// Execute client example code.
43 int run (void);
45 /// Initialize the client communication endpoint with server.
46 int init (int argc,
47 ACE_TCHAR **argv,
48 int client_number);
50 private:
51 /// reading the IOR of object A in
52 int read_ior (ACE_TCHAR *filename);
54 /// Parses the arguments passed on the command line.
55 int parse_args (void);
57 /// # of arguments on the command line.
58 int argc_;
60 /// arguments from command line.
61 ACE_TCHAR **argv_;
63 /// Key of the object
64 char *object_key_;
66 /// Flag to tell server to shutdown.
67 int shutdown_;
69 /// Remember our orb.
70 CORBA::ORB_var orb_var_;
72 /// pointer to the mt Object
73 MT_Object_var mT_Object_var_;
75 /// This is used to choose the server...
76 int client_number_;
78 /// number of loops
79 unsigned long iterations_;
83 /**
84 * @class MT_Client_Task
86 * @brief Wrapper for the MT_Client to be an extra thread
88 * No big purpose, just wrapping
90 class MT_Client_Task : public ACE_Task<ACE_SYNCH>
92 public:
93 MT_Client_Task (int argc, ACE_TCHAR **argv, int client_number);
95 virtual int svc (void);
97 private:
98 MT_Client mT_Client_;
99 int argc_;
100 ACE_TCHAR **argv_;
102 /// To determine if we use the first or the second server.
103 int client_number_;
106 #endif /* MT_CLIENT_H */