3 //=============================================================================
7 * Class interface for the implementation of the distributed
8 * event notification mechanism.
10 * @author Douglas C. Schmidt (d.schmidt@vanderbilt.edu) and Pradeep Gore <pradeep@cs.wustl.edu>
12 //=============================================================================
15 #ifndef _EVENT_COMM_I_H
16 #define _EVENT_COMM_I_H
18 #include "ace/Map_Manager.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "ace/Synch.h"
25 #include "ace/SString.h"
26 #include "Event_CommS.h"
27 #include "ace/Reactor.h"
28 #include "ace/Null_Mutex.h"
31 * @class ShutdownCallback
33 * @brief Helper callback class to shutdown the application.
35 class ShutdownCallback
39 virtual ~ShutdownCallback (void);
41 /// This method is to be called to shutdown the application.
42 virtual void close (void) = 0;
48 * @brief Defines the implementation class for event <Consumers>.
50 class Consumer_i
: public POA_Event_Comm::Consumer
59 /// set the <ACE_Reactor> to use when quitting.
60 void set_reactor (ACE_Reactor
*reactor
);
62 /// Pass the <event> to the <Consumer>.
63 virtual void push (const Event_Comm::Event
& event
);
65 virtual void disconnect (const char * reason
);
67 // Disconnect the <Consumer> from the <Notifier>, giving it the
70 /// Set the Shutdown callback.
71 void set (ShutdownCallback
*_shutdown
);
74 /// The callback to shutdown the consumer application.
75 ShutdownCallback
*shutdown
;
84 * @brief Defines the implementation class for event <Notifiers>.
86 class Notifier_i
: public POA_Event_Comm::Notifier
92 // Default max number of Event_Comm::Consumers.
95 /// Initialize a Notifier_i object with the specified size hint.
96 Notifier_i (size_t size_hint
= Notifier_i::DEFAULT_SIZE
);
98 /// Disconnect all the receivers, giving them the <reason>.
99 virtual void disconnect (const char *reason
);
101 /// Send the <event> to all the consumers who have subscribed and who
102 /// match the filtering criteria.
103 virtual void push (const Event_Comm::Event
&event
);
105 /// Subscribe the <Consumer> to receive events that match
106 /// <filtering_criteria> applied by the <Notifier>.
107 virtual void subscribe (Event_Comm::Consumer_ptr Consumer
,
108 const char * filtering_criteria
);
110 /// Unsubscribe the <Consumer>.
111 void unsubscribe (Event_Comm::Consumer
*consumer
,
112 const char *filtering_criteria
);
115 typedef ACE_Map_Manager
<Event_Comm::Consumer_ptr
, Consumer_Entry
*, ACE_Null_Mutex
>
117 typedef ACE_Map_Iterator
<Event_Comm::Consumer_ptr
, Consumer_Entry
*, ACE_Null_Mutex
>
119 typedef ACE_Map_Entry
<Event_Comm::Consumer_ptr
, Consumer_Entry
*>
122 /// Table that maps a <Event_Comm::Consumer *> to a <Consumer_Entry *>.
126 #endif /* _EVENT_COMM_I_H */