summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/Multiple.h
blob: 928a91eae2ecca3874c0bde350757d6df9bc2f76 (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
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file   Multiple.h
 *
 *  @author Pradeep Gore <pradeep@cs.wustl.edu>
 *
 * This is a test class for the Cos Event Service.
 */
//=============================================================================


#ifndef COSECMULTIPLE_H
#define COSECMULTIPLE_H

#include "orbsvcs/Naming/Naming_Client.h"
#include "orbsvcs/Naming/Naming_Server.h"
#include "orbsvcs/CosNamingC.h"
#include "orbsvcs/CosEventChannelAdminC.h"

class Multiple
{
 public:
  // = TITLE
  //   class Multiple
  //
  // = DESCRIPTION
  //   Base class for suppliers and consumers to send/receive events
  //   via the Cos Event Service.
 public:
  // = Initialization and termination methods.
  /// Constructor.
  Multiple (void);

  /// Destructor.
  virtual ~Multiple (void);

  /// Calls parse_args, Starts up an ORB, gets hold of the Event Service.
  /// Returns 0 on success, -1 on error.
  int init (int argc, ACE_TCHAR *argv[]);

  /// Calls the ORB's <run> method.
  int runORB (void);

  /// Closes down the ORB and exits.
  void shutdown (void);

 protected:
  /// Parse the command line arguments.
  virtual int parse_args (int argc, ACE_TCHAR *argv []) = 0;

  /// Reference to a running Event Service.
  CosEventChannelAdmin::EventChannel_ptr cos_ec_;

  /// The name with which to locate the Event Service.
  const ACE_TCHAR *service_name_;

 private:
  /// initializes the ORB.
  /// Returns 0 on success, -1 on error.
  int init_ORB (int argc, ACE_TCHAR *argv[]);

  /// initializes the COS EC.
  /// Returns 0 on success, -1 on error.
  int init_CosEC (void);

  /// The ORB that we use.
  CORBA::ORB_var orb_;

  /// An instance of the name client used for resolving the factory
  /// objects.
  TAO_Naming_Client naming_client_;
};

#endif /* COSECMULTIPLE_H */