summaryrefslogtreecommitdiff
path: root/TAO/performance-tests/Pluggable/PP_Test_Client.h
blob: ac817bf8db9380c709d4780a27e57ff5e679e312 (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
// -*- c++ -*-
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO/performance-tests/Pluggable
//
// = FILENAME
//    PP_Test_Client.h
//
// = DESCRIPTION
//      This class implements some basic no-op twoway and oneway requests
//      to time the latency of the pluggable protocol implementation.
//
// = AUTHOR
//    Jeff Parsons <parsons@cs.wustl.edu>
//
// ============================================================================

#ifndef _PP_TEST_CLIENT_H
#define _PP_TEST_CLIENT_H

#include "ace/Get_Opt.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "tao/corba.h"
#include "PP_TestC.h"

class PP_Test_Client
{
  // = TITLE
  //    Defines a class that encapsulates behaviour of the PP_Test 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
  //    PP_Teset CORBA server.  All the complexity for initializing the
  //    server is hidden in the class.  Just the run() interface is needed.
public:
  // = Constructor and destructor.
  PP_Test_Client (int shutdown = 0);
  // Use <testing_collocation> to control some client's behaviors.

  ~PP_Test_Client (void);

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

  int init (int argc, char **argv);
  // Initialize the client communication endpoint with server.
  // <collocation_test_ior> is used to pass in the ior file name.

private:
  int read_ior (char *filename);
  // Function to read the cubit factory ior from a file.

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

  void send_oneway (void);
  // Oneway operation test.

  void send_void (void);
  // Twoway operation test.

  int run_void (void);
  // This method runs only the send_void() test.

  int run_oneway (void);
  // This method runs only the send_oneway() test.

  int shutdown_server (int do_shutdown);
  // Invoke the method with <do_shutdown> != 0 to shutdown the server.

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

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

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

  char *factory_key_;
  // Key of factory obj ref.

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

  int shutdown_;
  // Flag to tell server to shutdown.

  Pluggable_Test_Factory_var factory_;
  // factory pointer for cubit.

  CORBA::Environment env_;
  // Environment variable.

  Pluggable_Test_var objref_;
  // Pluggable_Test obj ref.

  u_int call_count_;
  // # of calls made to functions.

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

  FILE *factory_ior_file_;
  // File from which to obtain the IOR.

  ACE_HANDLE f_handle_;
  // File handle to read the IOR.

  int only_void_;
  // Run only the cube_void() test.

  int only_oneway_;
  // Run only the cube_oneway() test.
};

#endif /* _PP_TEST_CLIENT_H */