ScheduleOutputHandler.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef OPENDDS_SCHEDULEOUTPUTHANDER_H
00009 #define OPENDDS_SCHEDULEOUTPUTHANDER_H
00010 
00011 #include <ace/Reactor.h>
00012 #include <ace/Event_Handler.h>
00013 #include "dds/DCPS/PoolAllocationBase.h"
00014 
00015 namespace OpenDDS { namespace DCPS {
00016 
00017 class TransportSendStrategy;
00018 
00019 /**
00020  * @class ScheduleOutputHandler
00021  *
00022  * @brief event handler used to enable and disable output processing.
00023  *
00024  * This class implements a simple notification handler that is used to
00025  * schedule or cancel output processing for queued data according to the
00026  * current mode state of the TransportSendStrategy.  If the send strategy
00027  * is queueing data, then the reactor is enabled to process on output
00028  * events.  Otherwise the output processing callbacks are cancelled.
00029  */
00030 class ScheduleOutputHandler : public ACE_Event_Handler, public PoolAllocationBase {
00031   public:
00032     /// Construct with the reactor and strategy.
00033     ScheduleOutputHandler( TransportSendStrategy* strategy,
00034                            ACE_Reactor* reactor);
00035 
00036     /// @{ @name ACE_Event_Handler methods
00037 
00038     /// modify the reactor mask for the handle.
00039     virtual int handle_exception( ACE_HANDLE);
00040 
00041     /// @}
00042 
00043     /// Update output processing in the reactor.
00044     void schedule_output();
00045 
00046   private:
00047     /// Strategy sending data to be scheduled (or not).
00048     TransportSendStrategy* strategy_;
00049 
00050     /// Cache the state that we have set the reactor into.
00051     enum HandlerState { Disabled, Enabled };
00052     HandlerState state_;
00053 };
00054 
00055 }} // End of namespace OpenDDS::DCPS
00056 
00057 #if defined (__ACE_INLINE__)
00058 #include "ScheduleOutputHandler.inl"
00059 #endif /* __ACE_INLINE__ */
00060 
00061 #endif /* OPENDDS_SCHEDULEOUTPUTHANDER_H */

Generated on Fri Feb 12 20:05:26 2016 for OpenDDS by  doxygen 1.4.7