Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / examples / Load_Balancing / Identity_Client.h
blobd5b36de150dad9e979048bdd2b1b5d715d5e35b3
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:
44 /// Default constructor.
45 Identity_Client (void);
47 /// Destructor.
48 ~Identity_Client (void);
50 /// Initializes <orb_manager_>, and parses commandline arguments.
51 int init (int argc, ACE_TCHAR *argv[]);
53 /// See TITLE.
54 int run (void);
56 private:
57 /// Parses the commandline arguments.
58 int parse_args (int argc, ACE_TCHAR *argv[]);
60 /// The ORB manager.
61 TAO_ORB_Manager orb_manager_;
63 /// The ior of the <Object_Group_Factory> object we shall use to
64 /// to obtain an <Object_Group> object.
65 const ACE_TCHAR *group_factory_ior_;
67 /// Number of times to invoke <get_name> method on <Identity>
68 /// objects. The default value is 5.
69 size_t number_of_invocations_;
71 /**
72 * Flag indicating which <Object_Group> to use to obtain references
73 * to <Identity> objects. Random group should be used if the flag
74 * is set to 1, and round robin group otherwise. Round robin is the
75 * default.
77 size_t use_random_;
80 #endif /* IDENTITY_CLIENT_H_ */