ACE_Sched_Priority_Iterator Class Reference

An iterator over the OS-defined scheduling priorities. More...

#include <Sched_Params.h>

List of all members.

Public Member Functions

 ACE_Sched_Priority_Iterator (const ACE_Sched_Params::Policy &policy, int scope=ACE_SCOPE_THREAD)
 ~ACE_Sched_Priority_Iterator (void)
 Default dtor.

int more (void) const
 Check if there are more priorities.

int priority (void) const
 Return the current priority.

void next (void)
const ACE_Sched_Params::Policypolicy (void) const
 Accessor for the scheduling policy over which we are iterating.

int scope (void) const
 Accessor for the scheduling.

Private Attributes

ACE_Sched_Params::Policy policy_
int scope_
int priority_
 The current priority.

int done_

Detailed Description

An iterator over the OS-defined scheduling priorities.

The order of priorities (numeric value vs. importance) is OS dependant, it can be the case that the priorities are not even contigous. This class permits iteration over priorities using the iterator pattern.

Definition at line 181 of file Sched_Params.h.

Constructor & Destructor Documentation

ACE_INLINE ACE_Sched_Priority_Iterator::ACE_Sched_Priority_Iterator const ACE_Sched_Params::Policy policy,
int  scope = ACE_SCOPE_THREAD

Initialize the iterator, the arguments define the scheduling policy and scope for the priorities (see ACE_Sched_Param).

Definition at line 101 of file Sched_Params.inl.

References ACE_Sched_Params::Policy, ACE_Sched_Params::priority_min(), and scope().

00103  : policy_ (policy),
00104    scope_ (scope),
00105    priority_ (0),
00106    done_ (0)
00107 {
00108   priority_ = ACE_Sched_Params::priority_min (this->policy (), this->scope ());
00109 }

ACE_INLINE ACE_Sched_Priority_Iterator::~ACE_Sched_Priority_Iterator void   ) 

Default dtor.

Definition at line 112 of file Sched_Params.inl.

00113 {
00114 }

Member Function Documentation

ACE_INLINE int ACE_Sched_Priority_Iterator::more void   )  const

Check if there are more priorities.

Definition at line 117 of file Sched_Params.inl.

References done_.

00118 {
00119   return !this->done_;
00120 }

ACE_INLINE void ACE_Sched_Priority_Iterator::next void   ) 

Move to the next priority. The iteration is from lowest to highest importance.

Definition at line 129 of file Sched_Params.inl.

References done_, ACE_Sched_Params::next_priority(), priority(), and scope().

00130 {
00131   if (this->done_)
00132     return;
00134   int old_priority = this->priority_;
00135   priority_ = ACE_Sched_Params::next_priority (this->policy (),
00136                                                this->priority (),
00137                                                this->scope ());
00138   this->done_ = old_priority == priority_;
00139 }

ACE_INLINE const ACE_Sched_Params::Policy & ACE_Sched_Priority_Iterator::policy void   )  const

Accessor for the scheduling policy over which we are iterating.

Definition at line 89 of file Sched_Params.inl.

00090 {
00091   return this->policy_;
00092 }

ACE_INLINE int ACE_Sched_Priority_Iterator::priority void   )  const

Return the current priority.

Definition at line 123 of file Sched_Params.inl.

Referenced by next().

00124 {
00125   return this->priority_;
00126 }

ACE_INLINE int ACE_Sched_Priority_Iterator::scope void   )  const

Accessor for the scheduling.

Definition at line 95 of file Sched_Params.inl.

Referenced by ACE_Sched_Priority_Iterator(), and next().

00096 {
00097   return this->scope_;
00098 }

Member Data Documentation

int ACE_Sched_Priority_Iterator::done_ [private]

This is set to 1 when there are no more priorities. Cannot easily compare against the highest priority on platforms were priorities are non-contigous or descending.

Definition at line 222 of file Sched_Params.h.

Referenced by more(), and next().

ACE_Sched_Params::Policy ACE_Sched_Priority_Iterator::policy_ [private]

The Scheduling policy (FIFO, RR, etc.) and scheduling scope (PROCESS, SYSTEM) we are iterating on.

Definition at line 211 of file Sched_Params.h.

int ACE_Sched_Priority_Iterator::priority_ [private]

The current priority.

Definition at line 215 of file Sched_Params.h.

int ACE_Sched_Priority_Iterator::scope_ [private]

Definition at line 212 of file Sched_Params.h.

The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:28:27 2006 for ACE by doxygen 1.3.6