summaryrefslogtreecommitdiff
path: root/TAO/tests/NestedUpcall/MT_Client_Test/client.h
blob: 482c71c2f2b4be370957c213b7ca8aa990cff8c3 (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
// -*- c++ -*-
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO/tests/NestedUpCalls/MT_Client_Test
//
// = FILENAME
//    client.h
//
// = DESCRIPTION
//    Test for multithreaded client using one global ORB (and Reactor)
//
// = AUTHORS
//    Michael Kircher
//
// ============================================================================

#ifndef MT_CLIENT_H
#define MT_CLIENT_H

#include "ace/Get_Opt.h"
#include "ace/Argv_Type_Converter.h"

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

#include "ace/Task.h"
#include "ace/Thread_Manager.h"
#include "tao/ORB.h"
#include "MT_Client_TestC.h"

class MT_Client
{
  // = TITLE
  //    A simple client talking to one server
  //
  // = DESCRIPTION
  //    It is connecting to a server which holds the Object_A
  //    or using the "-m" switch to a server holding the MT_Object

public:
  MT_Client (void);
  ~MT_Client (void);
  // = Constructor and destructor.

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

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

private:
  int read_ior (char *filename);
  // reading the IOR of object A in

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

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

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

  char *object_key_;
  // Key of the object

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

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

  MT_Object_var mT_Object_var_;
  // pointer to the mt Object

  int client_number_;
  // This is used to choose the server...

  unsigned long iterations_;
  // number of loops

};

class MT_Client_Task : public ACE_Task<ACE_SYNCH>
{
  // = TITLE
  //    Wrapper for the MT_Client to be an extra thread
  //
  // = DESCRIPTION
  //    No big purpose, just wrapping
public:
  MT_Client_Task (int argc, char **argv, int client_number);

  virtual int svc (void);

private:
  MT_Client mT_Client_;
  int argc_;
  char **argv_;

  int client_number_;
  // To determine if we use the first or the second server.
};

#endif /* MT_CLIENT_H */