OpenDDS  Snapshot(2023/04/28-20:55)
ReactorSynchStrategy.h
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #ifndef OPENDDS_DCPS_TRANSPORT_FRAMEWORK_REACTORSYNCHSTRATEGY_H
9 #define OPENDDS_DCPS_TRANSPORT_FRAMEWORK_REACTORSYNCHSTRATEGY_H
10 
11 #include "dds/DCPS/dcps_export.h"
12 #include "ThreadSynchStrategy.h"
13 
15 class ACE_Reactor;
17 
19 
20 namespace OpenDDS { namespace DCPS {
21 
22 class TransportSendStrategy;
23 
24 /**
25  * @class ReactorSynchStrategy
26  *
27  * @brief strategy to construct ReactorSynch implementations of ThreadSynch.
28  *
29  * This class is used as a factory for ReactorSynch objects that can be
30  * used to scheduled queued output for processing on a reactor. The
31  * initial implementation will share the Transport reactor for all of the
32  * sending and receiving processing to be performed. If the reactor is
33  * upgraded to a thread pool reactor, then this processing can be split
34  * between those threads using the default leader-follower dispatching.
35  *
36  * The usage idiom for ThreadSynchStrategy ensures that his object will
37  * have valid raw pointer values during its lifetime.
38  */
40 public:
41 
42  /// Construct with strategy, reactor, and handle to configure the
43  /// ReactorSynch with.
45  ACE_Reactor* reactor);
46 
47  virtual ~ReactorSynchStrategy();
48 
49  virtual ThreadSynch* create_synch_object(
50  ThreadSynchResource* synch_resource,
51  long priority = 0,
52  long scheduler = 0);
53 
54  private:
55  /// Raw pointer to the strategy. This is the strategy that contains
56  /// the TreadSynch (which will receive this pointer) so the lifetime
57  /// is assured.
59 
60  /// Raw pointer to reactor. This is ok since the strategy will pass
61  /// the pointer on to the ReactorSynch, which is guaranteed to span
62  /// the lifetime of both the strategy and the reactor.
64 };
65 
66 }} // end namespace OpenDDS::DCPS
67 
69 
70 #if defined (__ACE_INLINE__)
71 #include "ReactorSynchStrategy.inl"
72 #endif /* __ACE_INLINE__ */
73 
74 #endif /* OPENDDS_DCPS_REACTORSYNCHSTRATEGY_H */
#define ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#define OpenDDS_Dcps_Export
Definition: dcps_export.h:24
#define ACE_END_VERSIONED_NAMESPACE_DECL
strategy to construct ReactorSynch implementations of ThreadSynch.
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28