CARMA C++
NotificationConsumer.h
1 
2 // $Id: NotificationConsumer.h,v 1.13 2013/01/08 05:07:32 abeard Exp $
3 
4 #ifndef NOTIFICATIONCONSUMER_H
5 #define NOTIFICATIONCONSUMER_H
6 
7 #include <orbsvcs/CosNotifyChannelAdminC.h>
8 #include <orbsvcs/CosNotifyCommS.h>
9 
10 namespace carma {
11  namespace util {
12 
13  class Orb;
14 
25  virtual public POA_CosNotifyComm::StructuredPushConsumer
26  {
27 
28  public:
29 
50  NotificationConsumer(Orb* localOrb,
51  const std::string channelName,
52  const std::string consumerName);
53 
55 
56  // IDL to C++ mapping
57 
62  virtual void push_structured_event(const CosNotification::StructuredEvent &event)
63  throw(CosEventComm::Disconnected, CORBA::SystemException);
64 
71  throw(CORBA::SystemException);
72 
73  virtual void offer_change(const CosNotification::EventTypeSeq&,
74  const CosNotification::EventTypeSeq&)
75  throw(CosNotifyComm::InvalidEventType, CORBA::SystemException);
76 
77  virtual PortableServer::POA_ptr _default_POA();
78 
86  virtual void run();
87 
93  bool isActive();
94 
100  void deactivateConsumer();
101 
102  protected:
103 
104  Orb* localOrb_;
105  std::string localOrbName_;
106 
107  CORBA::ORB_var orb_; // The ORB.
108  PortableServer::POA_var poa_; // My POA.
109  CosNotifyChannelAdmin::StructuredProxyPushSupplier_var proxyPushSupplier_;
110  const std::string channelName_;
111  const std::string consumerName_;
112 
122  void setProxyPushSupplier ();
123 
124  private:
125 
129  void activatePoa();
130 
131  bool isActive_;
132 
133  }; // End class NotificationConsumer
134 
135  } // End namespace util
136 } // End namespace carma
137 
138 #endif // eventconsumer_h
virtual void run()
Blocking call that activates the callback for collecting events from the notification server...
NotificationConsumer(Orb *localOrb, const std::string channelName, const std::string consumerName)
Constructor for Notification Consumer - creates ORB internally.
bool isActive()
Method to test whether consumer is active.
virtual void push_structured_event(const CosNotification::StructuredEvent &event)
Callback function that is called by the notification server when notifications arrive for this consum...
void deactivateConsumer()
Method to deactivate an active consumer.
A base class that accepts named events from a Push supplier.
virtual void disconnect_structured_push_consumer()
Callback function that gets called by the notification server if it decides to disconnect the push co...
void setProxyPushSupplier()
create a proxy push supplier for our push consumer