Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / QoS / QoS_Decorator.h
blob4b578cec30fea8086a73f9029a5d875d38732c1a
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file QoS_Decorator.h
7 * @author Vishal Kachroo <vishal@cs.wustl.edu>
8 */
9 //=============================================================================
12 #ifndef QOS_DECORATOR_H
13 #define QOS_DECORATOR_H
14 #include /**/ "ace/pre.h"
16 #include "ace/Reactor.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/INET_Addr.h"
23 #include "ace/Event_Handler.h"
24 #include "SOCK_Dgram_Mcast_QoS.h"
25 #include "ACE_QoS_Export.h"
27 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
29 /**
30 * @class ACE_QoS_Decorator_Base
32 * @brief This class is the Decorator Pattern Base class for decorating
33 * ACE_Event_Handler.
35 * It simply forwards the requests for get_handle (),
36 * handle_input () and handle_qos () to its event_handler_
37 * component. Concrete decorators for ACE_Event_Handler will use
38 * this class to access the basic event handler functionality and
39 * decorate that by their own implementation.
41 class ACE_QoS_Export ACE_QoS_Decorator_Base : public ACE_Event_Handler
43 public:
44 // Initialization and termination methods.
45 /// Constructor.
46 ACE_QoS_Decorator_Base ();
48 /// Constructor.
49 ACE_QoS_Decorator_Base (ACE_Event_Handler *event_handler);
51 /// Destructor.
52 ~ACE_QoS_Decorator_Base ();
54 /// Forwards the request to its event_handler_ component.
55 virtual ACE_HANDLE get_handle () const;
57 /// Forwards the request to its event_handler_ component.
58 virtual int handle_input (ACE_HANDLE fd);
60 /// Forwards the request to its event_handler_ component.
61 virtual int handle_qos (ACE_HANDLE fd);
63 private:
64 /// The event handler that is decorated by this class.
65 ACE_Event_Handler *event_handler_;
68 /**
69 * @class ACE_QoS_Event_Handler
71 * @brief This Handler is registered with the Reactor for QoS events.
73 * Concrete QoS decorator uses this class to receive QoS events
74 * for RAPI. It hides the application from knowing that it is
75 * receiving QoS events on a different socket so the application
76 * doesnt have to be designed differently for RAPI and GQoS.
78 class ACE_QoS_Export ACE_QoS_Event_Handler : public ACE_Event_Handler
80 /// Destructor.
81 ~ACE_QoS_Event_Handler ();
83 /// Returns the RAPI file descriptor for receiving QoS events.
84 virtual ACE_HANDLE get_handle () const;
86 /// Calls the base class handle_input ().
87 virtual int handle_input (ACE_HANDLE fd);
89 /// Sets the QoS session.
90 void qos_session (ACE_QoS_Session *qos_session);
92 friend class ACE_QoS_Decorator;
94 private:
95 /// Constructor is private because only ACE_QoS_Decorator should
96 /// create this object.
97 ACE_QoS_Event_Handler ();
99 /// The QoS Decorator passes in its base for this handler to use.
100 ACE_QoS_Event_Handler (ACE_QoS_Decorator_Base *decorator_base);
102 /// Used to get to the RAPI file descriptor for QoS Events.
103 ACE_QoS_Session *qos_session_;
105 /// Requests on the class are forwarded to this base class;
106 ACE_QoS_Decorator_Base *decorator_base_;
110 * @class ACE_QoS_Decorator
112 * @brief Concrete QoS Decorator.
114 * Decorates the ACE_Event_Handler to additionally handle QoS
115 * events uniformly for different QoS mechanisms like RAPI and
116 * GQoS.
118 class ACE_QoS_Export ACE_QoS_Decorator : public ACE_QoS_Decorator_Base
120 public:
121 // Initialization and termination methods.
122 /// Constructor.
123 ACE_QoS_Decorator ();
125 /// Constructor.
126 ACE_QoS_Decorator (ACE_Event_Handler *event_handler,
127 ACE_QoS_Session *qos_session,
128 ACE_Reactor *reactor = ACE_Reactor::instance ());
130 /// Destructor.
131 ~ACE_QoS_Decorator ();
133 /// Calls the base class get_handle ().
134 virtual ACE_HANDLE get_handle () const;
136 /// Calls the base class handle_input ().
137 virtual int handle_input (ACE_HANDLE fd);
139 /// Calls the base class handle_qos ().
140 virtual int handle_qos (ACE_HANDLE fd);
142 /// This method registers the QoS Event Handler with the Reactor
143 /// to receive RAPI events.
144 int init ();
146 private:
147 /// Requests on the class are forwarded to this base class;
148 ACE_QoS_Decorator_Base *decorator_base_;
150 /// Handles the QoS events and in that sense decorates the usual
151 /// ACE_Event_Handler.
152 ACE_QoS_Event_Handler *qos_event_handler_;
154 /// Passed to the ACE_QoS_Event_Handler for retrieving the RAPI
155 /// session specific information like rapi_fd.
156 ACE_QoS_Session *qos_session_;
158 /// If the application wants to use an instance of Reactor other
159 /// than the Singleton one.
160 ACE_Reactor *reactor_;
163 ACE_END_VERSIONED_NAMESPACE_DECL
165 #include /**/ "ace/post.h"
166 #endif /* QOS_DECORATOR_H */