summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/EC_Config/ECConfig.h
blob: cef06505ecc5ae605c59eb5ae8e911cf0c66cfda (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
126
127
/* -*- C++ -*- */
// $Id$
//
// ============================================================================
//
// = FILENAME
//   ECConfig
//
// = AUTHOR
//   Bryan Thrall (thrall@cse.wustl.edu)
//
// ============================================================================

#ifndef ECCONFIG_H
#define ECCONFIG_H

#include "ace/Array.h"
#include "ace/Synch.h"
#include "orbsvcs/RtecSchedulerS.h" //for POA_RtecScheduler
#include "orbsvcs/RtecSchedulerC.h"
#include "orbsvcs/RtecEventChannelAdminC.h"
#include "orbsvcs/Event/EC_Event_Channel.h"

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

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

namespace TestConfig {

typedef ACE_Array<RtecEventChannelAdmin::ProxyPushConsumer_var> ProxyList;
typedef ACE_Array<RtecScheduler::handle_t> ConfigList;
typedef ACE_Array<RtecEventComm::EventSourceID> SupplierIDList;

typedef ACE_Array<Consumer*> ConsumerList;
typedef ACE_Array<Supplier*> SupplierList;

template <class SCHED_STRAT>
class ECConfig : public Test_Config {
public:
  ECConfig (void);

  virtual ~ECConfig (void);

  virtual int configure (TCFG_SET_WPTR configs);
  //does not take ownership of the Test_Config_Set but
  //needs to use the test_config_t in that set until
  //the ECConfig goes out of scope

  virtual int run (void);
  //If we try to distinguish between final-push and final-receipt,
  //that might be tracked in the Consumer (which would be easy as long
  //as filtering and correlation isn't used -- in that case, there
  //might be more than one receiver of an event, so you might get
  //multiple receipt-notices). There could also be a race-condition
  //problem between the various threads when reporting the receipt of
  //events.

protected:
  virtual int initEC (void);

  virtual int connectConsumers (void);

  virtual int connectSuppliers (void);

  virtual void reset (void);
  //

private:

  void print_RT_Infos (ACE_Array<RtecScheduler::handle_t> cfg_set);

  Test_Config_Set testcfgs;
  //copy of the currently configured Test_Config_Set
  //using the same test_config_t objects

  CORBA::ORB_var orb;

  PortableServer::POA_var poa;

  PortableServer::POAManager_var poa_manager;

  RtecEventChannelAdmin::EventChannel_var event_channel;

  RtecScheduler::Scheduler_var scheduler;
  /*
  ACE_Strong_Bound_Ptr<TAO_EC_Event_Channel,ACE_Null_Mutex> ec_impl;

  ACE_Strong_Bound_Ptr<POA_RtecScheduler::Scheduler,ACE_Null_Mutex> sched_impl;
  */
  TAO_EC_Event_Channel *ec_impl;

  POA_RtecScheduler::Scheduler *sched_impl;

  ProxyList consumer_proxys;
  //proxy objects for pushing events to consumers

  ConfigList supplier_cfgs;
  //RT_Infos generated by configure() for suppliers.

  ConfigList consumer_cfgs;
  //RT_Infos generated by configure() for consumers.

  SupplierIDList supplier_ids;
  //IDs of the suppliers

  ConsumerList consumers;

  SupplierList suppliers;

  int configured; //boolean
};

} /* namespace TestConfig */

#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ECConfig.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("ECConfig.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */

#endif /* ECCONFIG_H */