summaryrefslogtreecommitdiff
path: root/TAO/examples/Event_Comm/Notifier_Handler.h
blob: 0c4b9533c825fae4ab9f2c7bae2115220c3174d6 (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
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    Notifier_Handler.h
 *
 *  @author Douglas C. Schmidt (schmidt@cs.wustl.edu) and Pradeep Gore (pradeep@cs.wustl.edu)
 */
//=============================================================================


#ifndef _NOTIFIER_HANDLER_H
#define _NOTIFIER_HANDLER_H

#include "Event_Comm_i.h"

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

#include "orbsvcs/Naming/Naming_Client.h"
#include "orbsvcs/CosNamingC.h"

/**
 * @class Notifier_Handler
 *
 * @brief Holds the <Event_Comm::Notifier> object which is obtained from
 * the naming service.
 */
class Notifier_Handler
{
public:
  // = Initialization and termination methods.
  /// This constructor gets the notifier object from the Naming
  /// Service.
  Notifier_Handler (void);

  /// Destructor.
  virtual ~Notifier_Handler (void);

  /// Initialize the client communication endpoint with server.
  int init (int argc, ACE_TCHAR *argv[], ShutdownCallback* _shutdowncallback);

  // = Accessors.
  Event_Comm::Notifier *notifier (void);
  void notifier (Event_Comm::Notifier *);

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

  /// Close down the handler.
  int close (void);

  /// called to request application shutdown.
  void shutdown (void);

  /// returns the ORB's reactor.
  ACE_Reactor *reactor (void);

private:
  /// Remember our orb.
  CORBA::ORB_var orb_;

  /// Pointer to an <Event_Comm::Notifier> object.
  Event_Comm::Notifier *notifier_;

  /// An instance of the name client used for resolving the factory
  /// objects.
 TAO_Naming_Client naming_client_;

  /// The handler to shutdown the app.
  ShutdownCallback *shutdowncallback;
};

#define NOTIFIER_BIND_NAME "Notifier"

#endif /* _NOTIFIER_HANDLER_H */