Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / examples / Load_Balancing / Identity_Client.h
blob5610af4904391f56adf408bf6396e5ec93f346ba
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Identity_Client.h
7 * Code for Identity_Client, which is used in conjunction with
8 * Identity_Server to test/demonstrate the functionality of the
9 * Load Balancing service.
11 * @author Marina Spivak <marina@cs.wustl.edu>
13 //=============================================================================
16 #ifndef IDENTITY_CLIENT_H_
17 #define IDENTITY_CLIENT_H_
19 #include "tao/Utils/ORB_Manager.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 /**
26 * @class Identity_Client
28 * Contacts the <Object_Group_Factory> in th Load Balancing Server
29 * to obtain a reference to the type of the <Object_Group>
30 * specified on the command line. Then, queries the
31 * <Object_Group> for its id and members, and prints that
32 * information. Finally, performs <number_of_invocations_>
33 * <Identity::get_name> calls, performing <Object_Group::resolve>
34 * before each <get_name> call in order to get the <Identity>
35 * reference to use for the call. (This provides an example of
36 * fine-grained, i.e., per call, Load Balancing among all the
37 * <Identity> objects registered with the <Object_Group> for the
38 * client's <get_name> calls.
40 class Identity_Client
42 public:
43 /// Default constructor.
44 Identity_Client ();
46 /// Destructor.
47 ~Identity_Client ();
49 /// Initializes <orb_manager_>, and parses commandline arguments.
50 int init (int argc, ACE_TCHAR *argv[]);
52 /// See TITLE.
53 int run ();
55 private:
56 /// Parses the commandline arguments.
57 int parse_args (int argc, ACE_TCHAR *argv[]);
59 /// The ORB manager.
60 TAO_ORB_Manager orb_manager_;
62 /// The ior of the <Object_Group_Factory> object we shall use to
63 /// to obtain an <Object_Group> object.
64 const ACE_TCHAR *group_factory_ior_;
66 /// Number of times to invoke <get_name> method on <Identity>
67 /// objects. The default value is 5.
68 size_t number_of_invocations_;
70 /**
71 * Flag indicating which <Object_Group> to use to obtain references
72 * to <Identity> objects. Random group should be used if the flag
73 * is set to 1, and round robin group otherwise. Round robin is the
74 * default.
76 size_t use_random_;
79 #endif /* IDENTITY_CLIENT_H_ */