summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Event/Basic/Observer.h
blob: 297a4096ae5914a173a3966b4c6d8832f30b2ae4 (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
/* -*- C++ -*- */
// $Id$
//
// ============================================================================
//
// = LIBRARY
//   ORBSVCS Real-time Event Channel testsuite
//
// = FILENAME
//   Observer
//
// = AUTHOR
//   Carlos O'Ryan (coryan@cs.wustl.edu)
//
// ============================================================================

#ifndef EC_OBSERVER_H
#define EC_OBSERVER_H

#include "Driver.h"
#include "orbsvcs/Event/EC_Gateway.h"

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

class EC_Observer;

class EC_Master
{
  // = TITLE
  //   Run multiple events channels
  //
  // = DESCRIPTION
  //   This test runs multiple event channels, all connected using
  //   gateways.
  //
public:
  EC_Master (void);

  virtual ~EC_Master (void);

  virtual int run (int argc, char* argv[]);
  // Execute the test.

  virtual void initialize_orb_and_poa (int& argc, char* argv[],
                                       CORBA::Environment& env);
  // Obtain the orb and the poa pointers

  int channel_count (void) const;
  EC_Observer* channel (int i) const;
  // Accessors

private:
  int parse_args (int &argc, char *argv []);

private:
  ACE_RANDR_TYPE seed_;
  // The seed

  int n_channels_;
  EC_Observer** channels_;
  // The driver programs

  CORBA::ORB_var orb_;
  // The ORB

  PortableServer::POA_var root_poa_;
  // The Root POA
};

class EC_Observer : public EC_Driver
{
  //
  // = TITLE
  //   Test the EC observers
  //
  // = DESCRIPTION
  //
public:
  EC_Observer (EC_Master *master,
               ACE_RANDR_TYPE seed,
               CORBA::ORB_ptr orb,
               PortableServer::POA_ptr root_poa,
               int id);
  // Constructor

  // = The EC_Driver methods
  virtual void initialize_orb_and_poa (int& argc, char* argv[],
                                       CORBA::Environment& env);
  virtual int parse_args (int& argc, char* argv[]);
  virtual void print_args (void) const;
  virtual void print_usage (void);
  // add some command line args to enable/disable observerions

  void execute_test (CORBA::Environment& ACE_TRY_ENV);
  // Run the suppliers, using the <thread_manager> parameter

  void dump_results (void);
  void connect_consumer (
    RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin,
    int i,
    CORBA::Environment &ACE_TRY_ENV);
  void consumer_push (void*,
                      const RtecEventComm::EventSet&,
                      CORBA::Environment& ACE_TRY_ENV);

private:
  EC_Master *master_;
  ACE_RANDR_TYPE seed_;
  int id_;

  TAO_EC_Gateway_IIOP *gwys_;
};

#endif /* EC_OBSERVER_H */