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

// ============================================================================
//
// = LIBRARY
//    TAO/tests/NestedUpCalls/MT_Client_Test
//
// = FILENAME
//    local_server.h
//
// = DESCRIPTION
//     This class implements a simple server for the
//     Nested Upcalls - MT Client test
//
// = AUTHORS
//    Michael Kircher
//
// ============================================================================

#ifndef MT_CLIENT_TEST_MT_SERVER_H
#define MT_CLIENT_TEST_MT_SERVER_H

#include "MT_Object_i.h"

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

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

TAO_BEGIN_VERSIONED_NAMESPACE_DECL
class TAO_ORB_Manager;
TAO_END_VERSIONED_NAMESPACE_DECL

class MT_Server
{
  // = TITLE
  //   This is the server for the mt_object
  //
  // = DESCRIPTION
  //   See the README file for more information.

public:

  MT_Server ();
  // Default constructor

  ~MT_Server (void);
  // Destructor

  int init (int argc,
            char **argv,
            TAO_ORB_Manager* orb_manager_ptr);
  // Initialize the MT_Server state - parsing arguments and ...

  int run (void);
  // Run the orb

  int run_ORB_briefly (void);
  // Just run it briefly

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

  int parse_args (void);
  // Parses the commandline arguments.

  char *object_key_;
  // Key of the object

  FILE* ior_output_file_;
  // File to output the IOR of the object A.

  TAO_ORB_Manager* orb_manager_ptr_;
  // The ORB manager

  MT_Object_i mT_Object_i_;
  // Implementation object

  MT_Object_var mT_Object_var_;
  // reference for the distant MT Object

  int argc_;
  // Number of commandline arguments.

  char **argv_;
  // commandline arguments.

  unsigned int iterations_;
  // number of times the server should call to the disted MT OBject

  CORBA::String_var str_;
  // IOR of our servant.
};


class MT_Server_Task : public ACE_Task<ACE_SYNCH>
{
  // = TITLE
  //    Wrapper for the MT_Server to be an extra thread
  //
  // = DESCRIPTION
  //    No big purpose, just wrapping
public:
  MT_Server_Task (ACE_Thread_Manager* thr_mgr_ptr,
                  int argc,
                  char **argv,
                  TAO_ORB_Manager* orb_manager_ptr);

  virtual int svc (void);

private:
  MT_Server mT_Server_;
  int argc_;
  char **argv_;
  TAO_ORB_Manager* orb_manager_ptr_;
};


#endif /* MT_CLIENT_TEST_MT_SERVER_H */