summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECDriver.h
blob: 92b429d17118512efcbdbc4ea2ca438e0d24910c (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
// $Id$

//=============================================================================
/**
 *  @file    ECDriver.h
 *
 *  $Id$
 *
 *  @author Bryan Thrall <thrall@cse.wustl.edu>
 */
//=============================================================================


#ifndef ECDRIVER_H
#define ECDRIVER_H

#include "RtSchedEventChannelC.h"
#include "SyntaxTree.h"
#include "Kokyu_EC.h" // Reactor_Task

#include "ace/Reactor.h"
#include "tao/ORB.h"
#include "tao/PortableServer/PortableServer.h"

class Kokyu_EC; //forward decl

class ECDriver
{
public:
  typedef RtEventChannelAdmin::Time Time;

  ECDriver (void);

  virtual ~ECDriver (void);

  virtual int init(CORBA::ORB_var orb, PortableServer::POA_var poa);

  virtual void wait_for_start(Kokyu_EC* ec)
    ACE_THROW_SPEC ((ACEXML_SAXException)) = 0;

  void run(int argc = 0, char *argv[] = 0);

  virtual bool get_time_master (void) const = 0;
  virtual void set_time_master (bool tm) = 0;

  virtual void set_start_condition(StartCondition::TYPE type, Time starttime)
    ACE_THROW_SPEC ((ACEXML_SAXException)) = 0;
  virtual void set_stop_condition(StopCondition::TYPE type, long limit)
    ACE_THROW_SPEC ((ACEXML_SAXException)) = 0;

  /**
   * The Configurator_SyntaxHandler needs a reactor to schedule
   * Gateway initialization timeouts; the ECDriver must provide it
   * and run it.
   */
  virtual ACE_Reactor* reactor(void) = 0;
protected:
  virtual void run_i(int argc, char *argv[]) = 0;

  CORBA::ORB_var orb;
  PortableServer::POA_var poa;
  PortableServer::POAManager_var poa_manager;
};

class ECTestDriver : public ECDriver
{
public:
  ECTestDriver (void);

  virtual ~ECTestDriver (void);

  virtual int init(CORBA::ORB_var orb, PortableServer::POA_var poa);

  virtual bool get_time_master (void) const;
  virtual void set_time_master (bool tm);

  virtual void set_start_condition(StartCondition::TYPE type, Time time)
    ACE_THROW_SPEC ((ACEXML_SAXException));
  virtual void set_stop_condition(StopCondition::TYPE type, long limit)
    ACE_THROW_SPEC ((ACEXML_SAXException));

  virtual void wait_for_start(Kokyu_EC* ec)
    ACE_THROW_SPEC ((ACEXML_SAXException));

  virtual ACE_Reactor* reactor(void);
protected:
  virtual void run_i(int argc, char *argv[]);

  bool time_master;

  Reactor_Task rt;

  StartCondition::TYPE starttype;
  Time starttime;
  StopCondition::TYPE stoptype;
  long stoplimit;
};

#endif // ECDRIVER_H