summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Notify/lib/Driver.h
blob: f909a8ed2a0265b8d205b5cf3d9596371b79f6f9 (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/* -*- C++ -*- */
/**
 *  @file Driver.h
 *
 *  $Id$
 *
 *  @author Pradeep Gore <pradeep@oomworks.com>
 *
 *
 */

#ifndef TAO_Notify_Tests_DRIVER_H
#define TAO_Notify_Tests_DRIVER_H
#include /**/ "ace/pre.h"

#include "notify_test_export.h"

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

#include "ace/Service_Config.h"
#include "ace/Task.h"

#include "tao/ORB.h"

#include "Driver_Base.h"

class TAO_Notify_Tests_Command_Builder;
class TAO_Notify_Tests_Activation_Manager;

/**
 * @class TAO_Notify_Tests_Worker
 *
 * @brief A Task to execute commands asynchronously.
 *
 */
class TAO_Notify_Tests_Worker : public ACE_Task_Base
{
  // = TITLE
  //   Run a server thread
  //
  // = DESCRIPTION
  //   Use the ACE_Task_Base class to run server threads
  //
public:
  TAO_Notify_Tests_Worker (void);
  // ctor

  /// Set the command builder.
  void command_builder (TAO_Notify_Tests_Command_Builder* cmd_builder);

  virtual int svc (void);
  // The thread entry point.

  void shutdown (void);

private:
  /// The command builder
  TAO_Notify_Tests_Command_Builder* cmd_builder_;
};



class TAO_Notify_Tests_ORB_Run_Worker : public ACE_Task_Base
{
  // = TITLE
  //   Run a server thread
  //
  // = DESCRIPTION
  //   Use the ACE_Task_Base class to run server threads
  //
public:
  TAO_Notify_Tests_ORB_Run_Worker (void);
  // ctor

  void orb (CORBA::ORB_ptr orb);

  /// Srt the run period.
  void run_period (ACE_Time_Value run_period);

  virtual int svc (void);
  // The thread entry point.

private:
  /// The orb
  CORBA::ORB_var orb_;

  /// ORB Run Period.
  ACE_Time_Value run_period_;
};


/**
 * @class TAO_Notify_Tests_Driver
 *
 * @brief A default Application Starter.
 *
 */
class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Driver : public TAO_Notify_Tests_Driver_Base
{
public:
  /// Constuctor
  TAO_Notify_Tests_Driver (void);

  /// Destructor
  ~TAO_Notify_Tests_Driver ();

  /// Init
  int init (int argc, char *argv[] ACE_ENV_ARG_DECL);

  /// Execute the commands.
  void run (ACE_ENV_SINGLE_ARG_DECL);

  /// Shutdown
  virtual void shutdown (void);

protected:
  /// Parse command line parameters.
  int parse_args (int argc, char *argv[]);

  /// The command builder
  TAO_Notify_Tests_Command_Builder* cmd_builder_;

  /// Manage activation of periodic suppliers and consumers.
  TAO_Notify_Tests_Activation_Manager* activation_manager_;

  /// Thread in which to run commands.
  TAO_Notify_Tests_Worker worker_;

  /// Thread in which to run the orb.
  TAO_Notify_Tests_ORB_Run_Worker orb_run_worker_;

  /// The ORB we run.
  CORBA::ORB_var orb_;

  /// ORB Run Period.
  ACE_Time_Value run_period_;

  /// The file for output
  ACE_CString ior_output_file_;

  /// The file for input
  ACE_CString ior_input_file_;

  /// Set to skip the check for multiple priority levels.
  int skip_priority_levels_check_;
};

#include /**/ "ace/post.h"
#endif /* TAO_Notify_Tests_DRIVER_H */