ReactorSynchStrategy.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_DCPS_REACTORSYNCHSTRATEGY_H
00009 #define OPENDDS_DCPS_REACTORSYNCHSTRATEGY_H
00010 
00011 #include "dds/DCPS/dcps_export.h"
00012 #include "ThreadSynchStrategy.h"
00013 
00014 #include <ace/Reactor.h>
00015 
00016 namespace OpenDDS { namespace DCPS {
00017 
00018 class TransportSendStrategy;
00019 
00020 /**
00021  * @class ReactorSynchStrategy
00022  *
00023  * @brief strategy to construct ReactorSynch implementations of ThreadSynch.
00024  *
00025  * This class is used as a factory for ReactorSynch objects that can be
00026  * used to scheduled queued output for processing on a reactor.  The
00027  * initial implementation will share the Transport reactor for all of the
00028  * sending and receiving processing to be performed.  If the reactor is
00029  * upgraded to a thread pool reactor, then this processing can be split
00030  * between those threads using the default leader-follower dispatching.
00031  *
00032  * The usage idiom for ThreadSynchStrategy ensures that his object will
00033  * have valid raw pointer values during its lifetime.
00034  */
00035 class OpenDDS_Dcps_Export ReactorSynchStrategy : public ThreadSynchStrategy {
00036 public:
00037 
00038   /// Construct with strategy, reactor, and handle to configure the
00039   /// ReactorSynch with.
00040   ReactorSynchStrategy( TransportSendStrategy* strategy,
00041                         ACE_Reactor* reactor);
00042 
00043   virtual ~ReactorSynchStrategy();
00044 
00045   virtual ThreadSynch* create_synch_object(
00046     ThreadSynchResource* synch_resource,
00047     long                 priority = 0,
00048     int                  scheduler = 0);
00049 
00050   private:
00051     /// Raw pointer to the strategy.  This is the strategy that contains
00052     /// the TreadSynch (which will receive this pointer) so the lifetime
00053     /// is assured.
00054     TransportSendStrategy* strategy_;
00055 
00056     /// Raw pointer to reactor.  This is ok since the strategy will pass
00057     /// the pointer on to the ReactorSynch, which is guaranteed to span
00058     /// the lifetime of both the strategy and the reactor.
00059     ACE_Reactor* reactor_;
00060 };
00061 
00062 }} // end namespace OpenDDS::DCPS
00063 
00064 #if defined (__ACE_INLINE__)
00065 #include "ReactorSynchStrategy.inl"
00066 #endif /* __ACE_INLINE__ */
00067 
00068 #endif  /* OPENDDS_DCPS_REACTORSYNCHSTRATEGY_H */
00069 

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