summaryrefslogtreecommitdiff
path: root/TAO/tests/ORB_Local_Config/Two_DLL_ORB/ORB_DLL.h
blob: 7bb3eb4318ad7f48f8629184de326e2b8b5bc086 (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
// -*- C++ -*-

//=============================================================================
/**
 * @file ORB_DLL.h
 *
 * @author Iliyan Jeliazkov <iliyan@ociweb.com>
 */
//=============================================================================

#ifndef SERVICE_CONFIG_ORB_DLL_H
#define SERVICE_CONFIG_ORB_DLL_H

#include /**/ "ace/pre.h"

#include "ORB_DLL_Export.h"

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

#include "ace/Task.h"
#include "ace/ARGV.h"
#include "ace/String_Base.h"
#include "tao/ORB.h"

///
class Abstract_Worker
{
public:
  Abstract_Worker (const ACE_TCHAR *ior);
  virtual ~Abstract_Worker (void);
  virtual int test_main (int argc,
                    ACE_TCHAR *argv[]) = 0;
  virtual const ACE_TCHAR * kind (void) const = 0;
protected:
  ACE_TString ior_file_;
};

/**
 * A server kind of test
 */
class Server_Worker : public Abstract_Worker
{
public:
  Server_Worker ();
  ~Server_Worker (void);
  int test_main (int argc, ACE_TCHAR *argv[]);
  const ACE_TCHAR * kind (void) const;

private:
  int parse_args (int argc, ACE_TCHAR *argv[]);
};

/**
 * A client kind of test
 */
class Client_Worker : public Abstract_Worker
{
public:
  Client_Worker ();
  ~Client_Worker (void);
  int test_main (int argc, ACE_TCHAR *argv[]);
  const ACE_TCHAR * kind (void) const;

private:
  int parse_args (int argc, ACE_TCHAR *argv[]);
};

/**
 * @class Service_Config_ORB_DLL
 *
 * @brief The Service_Config_ORB_DLL that is instantiated when the
 *        client-side test module/library is dynamically loaded.
 */
class Service_Config_ORB_DLL_Export Service_Config_ORB_DLL
  : public ACE_Task_Base
{
public:

  /// Constructor.
  Service_Config_ORB_DLL (void);
  ~Service_Config_ORB_DLL (void);

  /// Initializes object when dynamic linking occurs.
  virtual int init (int argc, ACE_TCHAR *argv[]);

  /// Run by a daemon thread.
  /**
   * Each thread will invoke the Service Configurator via this
   * method unless the object is the "FINAL" object.
   */
  virtual int svc (void);

private:
  signed char is_server_;
  ACE_Auto_Ptr<Abstract_Worker> worker_;
  ACE_Auto_Ptr<ACE_ARGV> argv_;
};

ACE_FACTORY_DECLARE (Service_Config_ORB_DLL, Service_Config_ORB_DLL)

#include /**/ "ace/post.h"

#endif  /* SERVICE_CONFIG_ORB_DLL_H */