summaryrefslogtreecommitdiff
path: root/TAO/performance-tests/Cubit/COOL/IDL_Cubit/client.h
blob: 94cc36a14bd2d3182bf8dd350ffdc54d5ac582ec (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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO/tests/IDL_Cubit
//
// = FILENAME
//    clnt.h
//
// = DESCRIPTION
//      This class implements a simple "cube" CORBA client for the Cubit
//      example using stubs generated by the TAO ORB IDL compiler.
//
// = AUTHORS
//    Copyright 1994-1995 by Sun Microsystems Inc.
//    and
//    Aniruddha Gokhale, Sumedh Mungee, and Sergio Flores-Gaitan
//
// ============================================================================

#include "ace/Get_Opt.h"
#include "cubit.H"

class Cubit_Client
  // = TITLE
  //    Defines a class that encapsulates behaviour of the Cubit client
  //    example.  Provides a better understanding of the logic in an
  //    object oriented way.
  //
  // = DESCRIPTION
  //    This class declares an interface to run the example client for
  //    Cubit CORBA server.  All the complexity for initializing the
  //    server is hidden in the class.  Just the run() interface is needed.
{
public:
  // = Constructor and destructor.
  Cubit_Client (void);
  ~Cubit_Client (void);

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

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

  void print_exception (const char * str,
			const CORBA_Environment &env=Cubit_Client::env_);
			
private:
  int func (u_int i);
  // simple function that returns the substraction of 117 from the parameter.

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

  void print_stats (const char *call_name, ACE_Profile_Timer::ACE_Elapsed_Time &elapsed_time);
  // prints the time stats

  void cube_union_stub (void);
  // Exercise the union.  Cube a union.

  void cube_union_dii (void);
  // Exercise the union using dii.

  void cube_struct (int i);
  // calculate the cube from a struct.

  void cube_long (int i);
  // calculate the cube from a long

  void cube_octet (int i);
  // Cube an octet

  void cube_short (int i);
  // Cube a short.

  void cube_sequence (int i);
  // Cube a sequence.

  void cube_struct_dii (void);
  // Cube the numbers in a struct

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

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

  const char *cubit_factory_key_;
  // Key of factory obj ref.

  char *cubit_key_;
  // Key of the obj ref to be retrieved via the factory.

  char *hostname_;
  // Hostname of server.

  CORBA::UShort portnum_;
  // default port number of server.

  u_int loop_count_;
  // Number of times to do the cube operations.

  int exit_later_;
  // Flag to tell server to not exit immediately

  Cubit_Factory_ptr factory_;
  // factory pointer for cubit.

  CORBA::Object_ptr objref_;
  // storage of the factory objref

  static CORBA::Environment env_;
  // Environment variable

  Cubit_ptr cubit_;
  // Cubit obj ref

  CORBA::ORB_ptr orb_ptr_;
  // Remember our orb

  u_int call_count_;
  // # of calls made to functions

  u_int error_count_;
  // #  of errors incurred in the lifetime of the application.
};