Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / Kokyu / Kokyu_dsrt.h
blobe96d66197221f15503e7441a895d23314a068ded
1 /* -*- C++ -*- */
2 /**
3 * @file Kokyu_dsrt.h
5 * @author Venkita Subramonian (venkita@cs.wustl.edu)
6 */
8 #ifndef KOKYU_DSRT_H
9 #define KOKYU_DSRT_H
10 #include /**/ "ace/pre.h"
11 #include "ace/Copy_Disabled.h"
13 #include "kokyu_export.h"
14 #include "Kokyu_defs.h"
15 #include <memory>
17 namespace Kokyu
19 template <class DSRT_Scheduler_Traits> class DSRT_Dispatcher_Impl;
21 /**
22 * @class DSRT_Dispatcher
24 * @brief Interface class for dynamic scheduling of threads
26 * The responsibility of this class is to forward all methods to
27 * its delegation/implementation class, e.g.,
28 * @c Default_DSRT_Dispatcher_Impl. This class follows the pImpl idiom
29 * or the bridge pattern to separate the implementation from the interface.
30 * DSRT_Dispatcher is the class that users will be using to achieve
31 * dynamic scheduling of threads.
33 template <class DSRT_Scheduler_Traits>
34 class DSRT_Dispatcher : private ACE_Copy_Disabled
36 public:
37 typedef typename DSRT_Scheduler_Traits::Guid_t Guid_t;
38 typedef typename DSRT_Scheduler_Traits::QoSDescriptor_t DSRT_QoSDescriptor;
40 // = Scheduling methods.
42 /// Schedule a thread dynamically based on the qos info supplied.
43 int schedule (Guid_t guid, const DSRT_QoSDescriptor&);
45 /// Update the schedule for a thread. This could alter the current schedule.
46 int update_schedule (Guid_t guid, const DSRT_QoSDescriptor&);
48 /// Inform the scheduler that the caller thread is about to
49 /// block. This could alter the current schedule.
50 int update_schedule (Guid_t guid, Kokyu::Block_Flag_t flag);
52 /// Cancel the schedule for a thread. This could alter the current schedule.
53 int cancel_schedule (Guid_t guid);
55 /// Supply this interface with an appropriate implementation.
56 void implementation (DSRT_Dispatcher_Impl<DSRT_Scheduler_Traits>*);
58 // = Termination methods.
60 /// Shut down the dispatcher. The dispatcher will stop processing requests.
61 int shutdown ();
63 /// Non virtual destructor. Read as <b><i>this class not available
64 /// for inheritance<i></b>.
65 ~DSRT_Dispatcher ();
67 private:
68 /// Auto ptr to the implementation. Implementation will be created on the
69 /// heap and deleted automatically when the dispatcher object is destructed.
70 std::unique_ptr<DSRT_Dispatcher_Impl<DSRT_Scheduler_Traits> > dispatcher_impl_;
74 /**
75 * @class DSRT_Dispatcher_Factory
77 * @brief Factory class to create one of the dispatcher interface
78 * objects - for events or DSRT threads.
80 * Factory class creates a dispatcher or DSRT dispatcher and configures
81 * the interface object with the appropriate implementation.
84 template <class DSRT_Scheduler_Traits>
85 class DSRT_Dispatcher_Factory : private ACE_Copy_Disabled
87 public:
88 typedef std::unique_ptr<DSRT_Dispatcher<DSRT_Scheduler_Traits> > DSRT_Dispatcher_Auto_Ptr;
90 /**
91 * Create a dispatcher for dynamic dispatching of threads.
92 * This will be used to dynamic scheduling of distributable threads for
93 * DSRTCORBA. The caller is responsible for freeing the memory.
95 * @param config Configuration information for the DSRT dispatcher.
97 * @return pointer to the DSRT dispatcher.
99 static DSRT_Dispatcher<DSRT_Scheduler_Traits>* create_DSRT_dispatcher (const DSRT_ConfigInfo&);
103 * @class MIF_Sched_Strategy
105 * @brief Strategy class implementing Maximum Importance First
106 * reordering strategy.
109 template <class QoSDesc>
110 class MIF_Comparator
112 public:
113 typedef typename QoSDesc::Importance_t Importance_t;
115 int operator ()(const QoSDesc& qos1,
116 const QoSDesc& qos2);
120 * @class Fixed_Priority_Sched_Strategy
122 * @brief Strategy class implementing Fixed Priority reordering
123 * strategy.
126 template <class QoSDesc>
127 class Fixed_Priority_Comparator
129 public:
130 typedef typename QoSDesc::Priority_t Priority_t;
132 int operator ()(const QoSDesc& qos1,
133 const QoSDesc& qos2);
137 * @class MUF_Sched_Strategy
139 * @brief Strategy class implementing Maximum Urgency First
140 * reordering strategy.
143 template <class QoSDesc>
144 class MUF_Comparator
146 public:
147 typedef typename QoSDesc::Criticality_t Criticality_t;
148 typedef typename QoSDesc::Time_t Time_t;
150 int operator ()(const QoSDesc& qos1,
151 const QoSDesc& qos2);
154 } //end of namespace
156 #if defined (__ACE_INLINE__)
157 #include "Kokyu_dsrt.inl"
158 #endif /* __ACE_INLINE__ */
160 #include "Kokyu_dsrt.cpp"
162 #include /**/ "ace/post.h"
163 #endif /* KOKYU_DSRT_H */