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 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00016 
00017 namespace OpenDDS { namespace DCPS {
00018 
00019 class TransportSendStrategy;
00020 
00021 /**
00022  * @class ScheduleOutputHandler
00023  *
00024  * @brief event handler used to enable and disable output processing.
00025  *
00026  * This class implements a simple notification handler that is used to
00027  * schedule or cancel output processing for queued data according to the
00028  * current mode state of the TransportSendStrategy.  If the send strategy
00029  * is queueing data, then the reactor is enabled to process on output
00030  * events.  Otherwise the output processing callbacks are cancelled.
00031  */
00032 class ScheduleOutputHandler : public ACE_Event_Handler, public PoolAllocationBase {
00033   public:
00034     /// Construct with the reactor and strategy.
00035     ScheduleOutputHandler( TransportSendStrategy* strategy,
00036                            ACE_Reactor* reactor);
00037 
00038     /// @{ @name ACE_Event_Handler methods
00039 
00040     /// modify the reactor mask for the handle.
00041     virtual int handle_exception( ACE_HANDLE);
00042 
00043     /// @}
00044 
00045     /// Update output processing in the reactor.
00046     void schedule_output();
00047 
00048   private:
00049     /// Strategy sending data to be scheduled (or not).
00050     TransportSendStrategy* strategy_;
00051 
00052     /// Cache the state that we have set the reactor into.
00053     enum HandlerState { Disabled, Enabled };
00054     HandlerState state_;
00055 };
00056 
00057 }} // End of namespace OpenDDS::DCPS
00058 
00059 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00060 
00061 #if defined (__ACE_INLINE__)
00062 #include "ScheduleOutputHandler.inl"
00063 #endif /* __ACE_INLINE__ */
00064 
00065 #endif /* OPENDDS_SCHEDULEOUTPUTHANDER_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1