Merge pull request #2237 from DOCGroup/jwillemsen-patch-2-1
[ACE_TAO.git] / ACE / Kokyu / Kokyu_defs.h
blob1eaedcb803f001292d0742cc5ccca289a31a5ecc
1 /* -*- C++ -*- */
2 /**
3 * @file Kokyu_defs.h
5 * @author Venkita Subramonian (venkita@cs.wustl.edu)
6 */
8 #ifndef KOKYU_DEFS_H
9 #define KOKYU_DEFS_H
10 #include /**/ "ace/pre.h"
11 #include "ace/Containers_T.h"
12 #include "ace/Time_Value.h"
13 #include "ace/Message_Block.h"
14 #include "ace/Sched_Params.h"
15 #include "ace/Malloc_Allocator.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "kokyu_export.h"
23 namespace Kokyu
25 typedef long Priority_t;
26 typedef ACE_Time_Value Deadline_t; //absolute deadline
27 typedef ACE_Time_Value Execution_Time_t; //execution time
28 //typedef int Guid_t;
30 enum Dispatching_Type_t
31 // Defines the type of prioritization strategy
32 // to be used by a dispatching queue
34 FIFO_DISPATCHING,
35 DEADLINE_DISPATCHING,
36 LAXITY_DISPATCHING
39 enum Criticality_t
40 // Defines the criticality of the operation.
41 // For use with Dynamic Scheduler.
43 VERY_LOW_CRITICALITY,
44 LOW_CRITICALITY,
45 MEDIUM_CRITICALITY,
46 HIGH_CRITICALITY,
47 VERY_HIGH_CRITICALITY
50 enum Importance_t
51 // Defines the importance of the operation,
52 // which can be used by the RtecScheduler as a
53 // "tie-breaker" when other scheduling
54 // parameters are equal.
56 VERY_LOW_IMPORTANCE,
57 LOW_IMPORTANCE,
58 MEDIUM_IMPORTANCE,
59 HIGH_IMPORTANCE,
60 VERY_HIGH_IMPORTANCE
63 struct Kokyu_Export Reordering_Queue_Attributes
65 Reordering_Queue_Attributes ();
66 unsigned long static_bit_field_mask_;
67 unsigned long static_bit_field_shift_;
68 unsigned long dynamic_priority_max_;
69 unsigned long dynamic_priority_offset_;
72 struct Kokyu_Export ConfigInfo
74 Priority_t preemption_priority_;
76 // OS priority of the dispatching thread associated with the queue
77 Priority_t thread_priority_;
79 // type of dispatching queue
80 Dispatching_Type_t dispatching_type_;
82 //allocator to be used for dynamic memory allocation. If each
83 //thread gets its own memory pool, contention will be less
84 ACE_Allocator *allocator_;
86 Reordering_Queue_Attributes reordering_flags_;
88 ConfigInfo ();
91 typedef ACE_Array<ConfigInfo> ConfigInfoSet;
93 class Kokyu_Export Dispatcher_Attributes
95 public:
96 ConfigInfoSet config_info_set_;
97 int immediate_activation_;
99 public:
100 Dispatcher_Attributes ();
101 void sched_policy (int);
102 void sched_scope (int);
103 int thread_creation_flags () const;
105 private:
106 int sched_policy_;
107 int sched_scope_;
108 int base_thread_creation_flags_;
112 struct Kokyu_Export QoSDescriptor
114 Priority_t preemption_priority_;
115 Deadline_t deadline_;
116 Execution_Time_t execution_time_;
117 Importance_t importance_;
120 enum Block_Flag_t {BLOCK, UNBLOCK};
122 class Kokyu_Export Dispatch_Command
124 public:
125 Dispatch_Command(int dont_delete = 0,
126 ACE_Allocator *allocator = 0);
127 //dont_delete indicates whether this object needs to be deleted once processed.
128 //allocator indicates the ACE_Allocator, if any, from which this object was created.
129 //This same allocator has to be used for the deletion also
131 /// Command callback
132 virtual int execute () = 0;
134 int can_be_deleted () const;
136 void destroy ();
137 protected:
138 /// Destructor
139 // only inheritance is possible and object should be on heap,
140 // since object could be handed over to a different thread.
141 virtual ~Dispatch_Command ();
143 private:
144 int dont_delete_;
145 ACE_Allocator *allocator_;
146 //if this object has to be deleted, then delete it using the allocator
147 //if one is present.
150 enum DSRT_Sched_Type_t
152 DSRT_FP,
153 DSRT_MUF,
154 DSRT_MIF
157 enum DSRT_Dispatcher_Impl_t
159 DSRT_CV_BASED,
160 DSRT_OS_BASED
163 struct Kokyu_Export DSRT_ConfigInfo
165 //not used currently
166 DSRT_Sched_Type_t sched_strategy_;
168 ACE_Sched_Params::Policy sched_policy_;
169 int sched_scope_;
171 //type of implementation
172 DSRT_Dispatcher_Impl_t impl_type_;
174 DSRT_ConfigInfo ();
176 } //end of namespace
178 //to satisfy ACE_Array<ConfigInfo>
179 ACE_INLINE bool operator != (const Kokyu::ConfigInfo& lhs, const Kokyu::ConfigInfo& rhs);
181 #if defined (__ACE_INLINE__)
182 #include "Kokyu_defs.inl"
183 #endif /* __ACE_INLINE__ */
185 #include /**/ "ace/post.h"
186 #endif /* KOKYU_DEFS_H */