Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / examples / Event_Comm / Event_Comm_i.h
blob19037ec172c70bddf22cb81aa79061cba67db1ce
1 //=============================================================================
2 /**
3 * @file Event_Comm_i.h
5 * Class interface for the implementation of the distributed
6 * event notification mechanism.
8 * @author Douglas C. Schmidt (d.schmidt@vanderbilt.edu) and Pradeep Gore <pradeep@cs.wustl.edu>
9 */
10 //=============================================================================
12 #ifndef _EVENT_COMM_I_H
13 #define _EVENT_COMM_I_H
15 #include "ace/Map_Manager.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "ace/Synch.h"
22 #include "ace/SString.h"
23 #include "Event_CommS.h"
24 #include "ace/Reactor.h"
25 #include "ace/Null_Mutex.h"
27 /**
28 * @class ShutdownCallback
30 * @brief Helper callback class to shutdown the application.
32 class ShutdownCallback
34 public:
35 /// Destructor.
36 virtual ~ShutdownCallback ();
38 /// This method is to be called to shutdown the application.
39 virtual void close () = 0;
42 /**
43 * @class Consumer_i
45 * @brief Defines the implementation class for event <Consumers>.
47 class Consumer_i : public POA_Event_Comm::Consumer
49 public:
50 /// Constructor.
51 Consumer_i ();
53 /// Destructor.
54 ~Consumer_i ();
56 /// set the ACE_Reactor to use when quitting.
57 void set_reactor (ACE_Reactor *reactor);
59 /// Pass the q event to the <Consumer>.
60 virtual void push (const Event_Comm::Event & event);
62 // Disconnect the <Consumer> from the <Notifier>, giving it the
63 // @a reason.
64 virtual void disconnect (const char * reason);
66 /// Set the Shutdown callback.
67 void set (ShutdownCallback *_shutdown);
69 private:
70 /// The callback to shutdown the consumer application.
71 ShutdownCallback *shutdown;
74 // Forward reference.
75 class Consumer_Entry;
77 /**
78 * @class Notifier_i
80 * @brief Defines the implementation class for event <Notifiers>.
82 class Notifier_i : public POA_Event_Comm::Notifier
84 public:
85 enum
87 DEFAULT_SIZE = 1024
88 // Default max number of Event_Comm::Consumers.
91 /// Initialize a Notifier_i object with the specified size hint.
92 Notifier_i (size_t size_hint = Notifier_i::DEFAULT_SIZE);
94 /// Disconnect all the receivers, giving them the @a reason.
95 virtual void disconnect (const char *reason);
97 /// Send the @a event to all the consumers who have subscribed and who
98 /// match the filtering criteria.
99 virtual void push (const Event_Comm::Event &event);
101 /// Subscribe the @a consumer to receive events that match
102 /// @a filtering_criteria applied by the <Notifier>.
103 virtual void subscribe (Event_Comm::Consumer_ptr Consumer,
104 const char * filtering_criteria);
106 /// Unsubscribe the @a Consumer.
107 void unsubscribe (Event_Comm::Consumer *consumer,
108 const char *filtering_criteria);
110 private:
111 typedef ACE_Map_Manager <Event_Comm::Consumer_ptr, Consumer_Entry *, ACE_Null_Mutex>
112 MAP_MANAGER;
113 typedef ACE_Map_Iterator <Event_Comm::Consumer_ptr, Consumer_Entry *, ACE_Null_Mutex>
114 MAP_ITERATOR;
115 typedef ACE_Map_Entry <Event_Comm::Consumer_ptr, Consumer_Entry *>
116 MAP_ENTRY;
118 /// Table that maps a <Event_Comm::Consumer *> to a <Consumer_Entry *>.
119 MAP_MANAGER map_;
122 #endif /* _EVENT_COMM_I_H */