OMK::FrameScheduler Class Reference

the basic frame scheduler, where each scheduled object is queued on the appropriate frame for multifrequential execution More...

#include <OMKFrameScheduler.h>

Inheritance diagram for OMK::FrameScheduler:

Inheritance graph
[legend]
Collaboration diagram for OMK::FrameScheduler:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 FrameScheduler (unsigned int numberOfSteps)
 constructor, specifying the numeber of different simulation stpes in a simualtion cycle
virtual ~FrameScheduler ()
 destructor
virtual void addToScheduable (ReferenceObjectHandle *ref, unsigned int when)
 add an object to the list of scheduable objects
virtual void removeFromScheduable (ReferenceObjectHandle *ref)
 remove an object from the list of scheduable objects
virtual void schedule (ReferenceObjectHandle *ref)
 mark an object as active
virtual void unschedule (ReferenceObjectHandle *ref)
 mark an object as inactive
virtual void runStep (unsigned int which)
 run the scheduler for a certain simulation step

Protected Attributes

DoubleList ** Frames
 tha data strcuture associated to the scheduler

Detailed Description

the basic frame scheduler, where each scheduled object is queued on the appropriate frame for multifrequential execution

Definition at line 27 of file OMKFrameScheduler.h.


Constructor & Destructor Documentation

FrameScheduler::FrameScheduler ( unsigned int  numberOfSteps  ) 

constructor, specifying the numeber of different simulation stpes in a simualtion cycle

Definition at line 28 of file OMKFrameScheduler.cpp.

References OMK::Scheduler::_numberOfSteps, Frames, OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00028                                                          :
00029    Scheduler(numberOfSteps)
00030 {
00031    OMTRACEID( OMK_DEBUG_OMK_EXEC, "FrameScheduler::FrameScheduler ( " << numberOfSteps << " )" );
00032 
00033    Frames = new DoubleList *[_numberOfSteps];
00034    for(unsigned int i = 0 ; i < _numberOfSteps ; i++) 
00035    {
00036       Frames[i]=new DoubleList();
00037    }  
00038 }

FrameScheduler::~FrameScheduler (  )  [virtual]

destructor

Definition at line 40 of file OMKFrameScheduler.cpp.

References OMK::Scheduler::_numberOfSteps, and Frames.

00041 {
00042   if (Frames!=NULL) 
00043   {
00044     for(unsigned int i = 0 ; i <_numberOfSteps ; i ++) 
00045     {
00046       if(Frames[ i ]!=NULL) delete Frames[i];
00047     }
00048     delete [] Frames;
00049   }
00050 }


Member Function Documentation

void FrameScheduler::addToScheduable ( ReferenceObjectHandle ref,
unsigned int  when 
) [virtual]

add an object to the list of scheduable objects

Parameters:
ref the reference handler of the added object
when the index in the cycle of the simulation step where the object should be added

Implements OMK::Scheduler.

Definition at line 53 of file OMKFrameScheduler.cpp.

References Frames, OMK::SimulatedObject::getName(), OMK::ObjectHandle::getSimulatedObject(), OMK::DoubleList::insert(), OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00054 {
00055    OMTRACEID( OMK_DEBUG_OMK_EXEC, "FrameScheduler::addToScheduable( \"" << ref->getSimulatedObject().getName() << "\", "<<when<<" )" );
00056 
00057    Frames[when]->insert(ref) ;
00058 }

void FrameScheduler::removeFromScheduable ( ReferenceObjectHandle ref  )  [virtual]

remove an object from the list of scheduable objects

Implements OMK::Scheduler.

Definition at line 60 of file OMKFrameScheduler.cpp.

References OMK::Scheduler::_numberOfSteps, Frames, OMK::SimulatedObject::getName(), OMK::ObjectHandle::getSimulatedObject(), OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00061 {
00062    OMTRACEID( OMK_DEBUG_OMK_EXEC, "FrameScheduler::removeFromScheduable ( \"" << ref->getSimulatedObject().getName() << "\" )" ) ;
00063 
00064    for (unsigned int i = 0 ; i < _numberOfSteps ; i++ ) 
00065    {
00066       Frames[i] -> remove ( ref ) ;
00067    }
00068 }

void FrameScheduler::schedule ( ReferenceObjectHandle ref  )  [virtual]

mark an object as active

Implements OMK::Scheduler.

Definition at line 70 of file OMKFrameScheduler.cpp.

References OMK::Scheduler::_numberOfSteps, Frames, OMK::SimulatedObject::getName(), OMK::ObjectHandle::getSimulatedObject(), OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00071 {
00072    OMTRACEID( OMK_DEBUG_OMK_EXEC, "FrameScheduler::schedule( \"" << ref->getSimulatedObject().getName() << "\" )" ) ;
00073 
00074    for (unsigned int i = 0 ; i < _numberOfSteps ; i++ ) 
00075    {
00076       Frames[i] -> activate ( ref ) ;
00077    }
00078 }

void FrameScheduler::unschedule ( ReferenceObjectHandle ref  )  [virtual]

mark an object as inactive

Implements OMK::Scheduler.

Definition at line 80 of file OMKFrameScheduler.cpp.

References OMK::Scheduler::_numberOfSteps, Frames, OMK::SimulatedObject::getName(), OMK::ObjectHandle::getSimulatedObject(), OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00081 {
00082    OMTRACEID( OMK_DEBUG_OMK_EXEC, "FrameScheduler::unschedule \"" << ref->getSimulatedObject().getName() << "\" )" ) ;
00083 
00084    for (unsigned int i = 0 ; i < _numberOfSteps ; i++ ) 
00085    {
00086       Frames[i] -> suspend ( ref ) ;
00087    }
00088 }

void FrameScheduler::runStep ( unsigned int  which  )  [virtual]

run the scheduler for a certain simulation step

Parameters:
which the index in the cycle of the step to be run

Implements OMK::Scheduler.

Definition at line 91 of file OMKFrameScheduler.cpp.

References OMK::debugMsg(), Frames, OMK::ObjectHandle::getSimulatedObject(), OMK::DoubleListElement::listeElem, OMK::DoubleList::next(), OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00092 {
00093    OMTRACEID( OMK_DEBUG_OMK_EXEC, "FrameScheduler::runStep: Running step " << which ) ;
00094    DoubleListElement * pListe ;
00095    for( pListe = Frames [which]->begin () ;
00096               pListe != NULL ; 
00097               pListe = Frames[which]->next (pListe)) 
00098    {
00099      OMTRACEID( OMK_DEBUG_OMK_EXEC, "Calling compute of "<< OMK::debugMsg( &pListe->listeElem->getSimulatedObject() ) ) ;
00100       (*pListe).listeElem->compute () ;
00101       OMTRACEID( OMK_DEBUG_OMK_EXEC, "Compute of "<< OMK::debugMsg( &pListe->listeElem->getSimulatedObject() ) << " done" ) ;
00102    }
00103 
00104 }


Member Data Documentation

DoubleList* * OMK::FrameScheduler::Frames [protected]

tha data strcuture associated to the scheduler

Definition at line 60 of file OMKFrameScheduler.h.

Referenced by addToScheduable(), FrameScheduler(), removeFromScheduable(), runStep(), schedule(), unschedule(), and ~FrameScheduler().


logo OpenMask

Documentation generated on Mon Jun 9 11:46:02 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007