summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Notify/lib/Driver.h
blob: b072303d173777d0c9a589d6ba9a5e7b0e946af9 (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
/* -*- C++ -*- */
/**
 *  @file Driver.h
 *
 *  $Id$
 *
 *  @author Pradeep Gore <pradeep@oomworks.com>
 *
 *
 */

#ifndef TAO_NS_DRIVER_H
#define TAO_NS_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/corba.h"
#include "Driver_Base.h"

class TAO_NS_Command_Builder;
class TAO_NS_Activation_Manager;

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

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

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

  void shutdown (void);

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

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

  /// Destructor
  ~TAO_NS_Driver ();

  /// Init
  int init (int argc, ACE_TCHAR *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_NS_Command_Builder* cmd_builder_;

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

  /// Thread in which to run commands.
  TAO_NS_Worker 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_;
};

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