summaryrefslogtreecommitdiff
path: root/TAO/tests/Simple/bank/Client_i.h
blob: 5f4d13ac7a5b1655412f7a1c602874dbdcd50cc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// -*- C++ -*-
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO/tests/Simple
//
// = FILENAME
//    Client_i.h
//
// = DESCRIPTION
//    This class implements a simple CORBA client that accesses a Bank
//    server.
//
// = AUTHORS
//    Vishal Kachroo <vishal@cs.wustl.edu>
//
// ============================================================================

#include "BankC.h"
#include "orbsvcs/Naming/Naming_Utils.h"

class Client_i
{
  // = TITLE
  //     Simple Client implementation.
  //
  // = DESCRIPTION
  //     Class wrapper for a client that gets the server IOR and then
  //     makes several calls to the server before optionally shutting
  //     it down.
public:
  // = Initialization and termination methods.
  Client_i (void);
  // Constructor.

  ~Client_i (void);
  // Destructor.

  int run (void);
  // Execute client example code.

  int init (int argc, char *argv[]);
  // Initialize the client communication endpoint with server.

private:
  int read_ior (char *filename);
  // Function to read the server IOR from a file.

  int parse_args (void);
  // Parses the arguments passed on the command line.

  CORBA::Float check_accounts (void);
  // Checks the various operations of the account.

  void deposit (CORBA::Float deposit_amount,
		CORBA::Environment &env);
  // Deposit in the account.

  void withdraw (CORBA::Float withdrawl_amount);
  // Withdraw from the account.

  Bank::Account_ptr open (const char *name,
			  CORBA::Float initial_balance,
			  CORBA::Environment &env);
  // Open a new account with the given name and initial balance.


  void close (Bank::Account_ptr account,
	      CORBA::Environment &env);
  // Close a given Account.

  CORBA::Float balance (CORBA::Environment &env);
  // Returns the current balance in the account.

  int obtain_initial_references (void);
  // To initialize the naming service and get a ptr to server.

  int argc_;
  // # of arguments on the command line.

  char **argv_;
  // arguments from command line.

  char *ior_;
  // IOR of the obj ref of the server.

  u_int loop_count_;
  // Number of times to invoke the <time> operation.

  int shutdown_;
  // Flag for server shutdown.

  CORBA::Environment env_;
  // Environment variable.

  Bank::Account_var server_;
  // Account Server object ptr.

  Bank::AccountManager_var accountmanager_server_;
  // Account Manager server object ptr.

  TAO_Naming_Client my_name_client_;
  // An instance of the name client used for resolving the factory
  // objects.

  CORBA::ORB_var orb_;
  // Remember our orb.

  CORBA::Float initial_balance_;
  // Filled up by a command line argument.
};