/* -*- C++ -*- */ // $Id$ // ============================================================================ // // = LIBRARY // EventComm // // = FILENAME // Event_Comm_i.h // // = DESCRIPTION // Class interface for the implementation of the distributed // event notification mechanism. // // = AUTHOR // Douglas C. Schmidt (schmidt@cs.wustl.edu) and Pradeep Gore // // // ============================================================================ #ifndef _EVENT_COMM_I_H #define _EVENT_COMM_I_H #include "ace/Map_Manager.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Synch.h" #include "ace/SString.h" #include "Event_CommS.h" #include "ace/Reactor.h" #include "ace/Null_Mutex.h" class ShutdownCallback { // = TITLE // Helper callback class to shutdown the application. public: /// Destructor. virtual ~ShutdownCallback (void); virtual void close (void) = 0; // This method is to be called to shutdown the application. }; class Consumer_i : public POA_Event_Comm::Consumer { // = TITLE // Defines the implementation class for event . public: // = Initialization and termination methods. Consumer_i (void); // Constructor. ~Consumer_i (void); // Destructor. void set_reactor (ACE_Reactor *reactor); // set the to use when quitting. virtual void push (const Event_Comm::Event & event ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)); // Pass the to the . virtual void disconnect (const char * reason ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)); // Disconnect the from the , giving it the // . void set (ShutdownCallback *_shutdown); // Set the Shutdown callback. private: ShutdownCallback *shutdown; // The callback to shutdown the consumer application. }; // Forward reference. class Consumer_Entry; class Notifier_i : public POA_Event_Comm::Notifier { // = TITLE // Defines the implementation class for event . public: enum { DEFAULT_SIZE = 1024 // Default max number of Event_Comm::Consumers. }; Notifier_i (size_t size_hint = Notifier_i::DEFAULT_SIZE); // Initialize a Notifier_i object with the specified size hint. virtual void disconnect (const char *reason ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)); // Disconnect all the receivers, giving them the . virtual void push (const Event_Comm::Event &event ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)); // Send the to all the consumers who have subscribed and who // match the filtering criteria. virtual void subscribe (Event_Comm::Consumer_ptr Consumer, const char * filtering_criteria ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException, Event_Comm::Notifier::CannotSubscribe )); // Subscribe the to receive events that match // applied by the . void unsubscribe (Event_Comm::Consumer *consumer, const char *filtering_criteria ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException, Event_Comm::Notifier::CannotUnsubscribe )); // Unsubscribe the . private: typedef ACE_Map_Manager MAP_MANAGER; typedef ACE_Map_Iterator MAP_ITERATOR; typedef ACE_Map_Entry MAP_ENTRY; MAP_MANAGER map_; // Table that maps a to a . }; #endif /* _EVENT_COMM_I_H */