summaryrefslogtreecommitdiff
path: root/TAO/examples/Callback_Quoter/Notifier_Input_Handler.h
blob: f1ca12c921ef05a581eafff2f158d29e744d160f (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
/* -*- C++ -*- */
//=============================================================================
/**
 *  @file    Notifier_Input_Handler.h
 *
 *  Definition of the Callback_Quoter Notifier_Input_Handler class.
 *
 *  @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
 */
//=============================================================================


#ifndef SUPPLIER_INPUT_HANDLER_H
#define SUPPLIER_INPUT_HANDLER_H

#include "Notifier_i.h"
#include "NotifierS.h"
#include "ace/Event_Handler.h"
#include "tao/Utils/ORB_Manager.h"
#include "orbsvcs/CosNamingS.h"
#include "orbsvcs/Naming/Naming_Client.h"

/**
 * @class Notifier_Input_Handler
 *
 * @brief The class defines the callback quoter Notifier initialization
 * and run methods.
 *
 * This class handles initialization tasks, as well, such as
 * setting up the Orb manager and registers the Notifier servant
 * object.
 */
class Notifier_Input_Handler : public ACE_Event_Handler
{
public:
  // = Initialization and termination methods.
  /// Constructor.
  Notifier_Input_Handler (void);

  /// Destructor.
  ~Notifier_Input_Handler (void);

  /// Initialize the Notifier who plays the role of the server here.
  int init (int argc,
            ACE_TCHAR *argv[]);

  /// Run the ORB.
  int run (void);

  /// Handle the user input.
   virtual int handle_input (ACE_HANDLE);

private:

  /// The tao orb manager object.
  TAO_ORB_Manager orb_manager_;

  /// Parses the command line arguments.
  int parse_args (void);

  /// Initialises the name server and registers the Notifier object
  /// name with the name server.
  int init_naming_service (void);

  /// File where the IOR of the Notifier object is stored.
  FILE *ior_output_file_;

  /// Number of command line arguments.
  int argc_;

  /// The command line arguments.
  ACE_TCHAR **argv_;

  /// Naming context for the naming service.
  CosNaming::NamingContext_var naming_context_;

  /// helper class for getting access to Naming Service.
  TAO_Naming_Client naming_server_;

  /// The servant object registered with the orb.
  Notifier_i notifier_i_;

  /// This specifies whether the naming service is to be used.
  int using_naming_service_;
};

#endif /* NOTIFIER_INPUT_HANDLER_H */