2 //=============================================================================
4 * @file Notify_Test_Client.h
6 * Prototype Test Driver for all the Notify tests.
8 * @author Pradeep Gore <pradeep@cs.wustl.edu>
10 //=============================================================================
13 #ifndef NOTIFY_TEST_CLIENT_H
14 #define NOTIFY_TEST_CLIENT_H
16 #include "ace/Atomic_Op_T.h"
17 #include "ace/Thread_Mutex.h"
18 #include "orbsvcs/CosNotifyChannelAdminS.h"
19 #include "orbsvcs/CosNotifyCommC.h"
20 #include "orbsvcs/CosNamingC.h"
21 #include "notify_test_export.h"
23 class TAO_Notify_Tests_Peer
;
26 * @class Notify_Test_Client
28 * @brief Notify_Test_Client
30 * Shows how consumers Notify_Test_Client for events.
32 class TAO_NOTIFY_TEST_Export Notify_Test_Client
35 Notify_Test_Client ();
36 virtual ~Notify_Test_Client ();
38 /// starts the orb and resolves the notify factory via a naming service.
39 virtual int init (int argc
, ACE_TCHAR
*argv
[]);
41 /// Allow the user to override this empty method
42 virtual int parse_args (int argc
, ACE_TCHAR
* argv
[]);
44 /// Call ORB::run to accept requests.
46 int ORB_run (ACE_Time_Value
& tv
);
48 /// How many clients will call consumer_done.
49 void consumer_start (TAO_Notify_Tests_Peer
*);
51 /// Callback for clients to unregister themselves.
52 void consumer_done (TAO_Notify_Tests_Peer
*);
54 /// Access the done boolean.
55 bool is_done () const;
57 /// Access the ORB. This class retains ownership.
58 CORBA::ORB_ptr
orb ();
60 /// Access the Root POA. This class retains ownership.
61 PortableServer::POA_ptr
root_poa ();
63 /// Access the Naming Context. This class retains ownership.
64 CosNaming::NamingContext_ptr
naming_context ();
66 /// Access the Notify Factory. This class retains ownership.
67 CosNotifyChannelAdmin::EventChannelFactory_ptr
notify_factory ();
69 /// Create an Event Channel. Ownership is passed to the caller.
70 CosNotifyChannelAdmin::EventChannel_ptr
create_event_channel (
75 /// Initializes the ORB.
76 int init_ORB (int argc
,
79 /// Try to get hold of a running naming service.
80 void resolve_naming_service ();
82 /// Try to resolve the Notify factory from the Naming service.
83 void resolve_Notify_factory ();
86 /// Reference to the root poa.
87 PortableServer::POA_var root_poa_
;
89 /// The ORB that we use.
92 /// Handle to the name service.
93 CosNaming::NamingContext_var naming_context_
;
96 CosNotifyChannelAdmin::EventChannelFactory_var notify_factory_
;
98 /// The group operator between admin-proxy's.
99 CosNotifyChannelAdmin::InterFilterGroupOperator ifgop_
;
101 /// Initial qos specified to the factory when creating the EC.
102 CosNotification::QoSProperties initial_qos_
;
104 /// Initial admin props specified to the factory when creating the EC.
105 CosNotification::AdminProperties initial_admin_
;
108 ACE_Atomic_Op
< TAO_SYNCH_MUTEX
, int > num_clients_
;
112 #endif /* NOTIFY_TEST_CLIENT_H */