summaryrefslogtreecommitdiff
path: root/TAO/examples/Callback_Quoter/Notifier_Input_Handler.h
blob: 6e126029194dd592782e4bb3db892235d9b3aa0d (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
/* -*- C++ -*- */
// $Id$
// ===========================================================
//
// = LIBRARY
//    TAO/examples/Callback_Quoter
//
// = FILENAME
//    Notifier_Input_Handler.h
//
// = DESCRIPTION
//    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 "tao/PortableServer/ORB_Manager.h"
#include "orbsvcs/orbsvcs/CosNamingS.h"
#include "orbsvcs/orbsvcs/Naming/Naming_Utils.h"

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

  ~Notifier_Input_Handler (void);
  // Destructor.

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

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

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

private:

  TAO_ORB_Manager orb_manager_;
  // The tao orb manager object.

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

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

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

  int argc_;
  // Number of command line arguments.

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

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

  TAO_Naming_Server naming_server_;
  // An instance of the name server, wherein the naming context
  // containg the factory of objects will be registered.

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

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

#endif /* NOTIFIER_INPUT_HANDLER_H */