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

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


#ifndef COSECBASIC_H
#define COSECBASIC_H

#include "Consumer.h"
#include "Supplier.h"

/**
 * @class Basic
 *
 * @brief class Basic
 *
 * Creates a CORBA Standard Event Channel (COSEC) implemented with
 * TAO's Real-time Event Channel (RtEC) and sends an event across.
 */
class Basic
{
public:
  /// Constructor.
  Basic (void);

  /// Destructor.
  ~Basic (void);

  /// Starts up an ORB and the CosEC.
  /// Returns 0 on success, -1 on error.
  void init (int argc, ACE_TCHAR *argv[]);

  /// Connects a consumer and a supplier to the CosEC and sends 1 event
  /// across.
  void run (void);

  /// Closes down the CosEC.
  void shutdown (void);

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

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

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

  /// The root poa.
  PortableServer::POA_var root_poa_;

  /// Reference to the CosEC returned after activating it in the ORB.
  CosEventChannelAdmin::EventChannel_var cos_ec_;

  /// The Cos Consumer that will receive the event.
  Consumer consumer_;

  /// The Cos Supplier that will supply the event.
  Supplier supplier_;
};

#endif /* COSECBASIC_H */