schedulable Class Reference

A base class for objects that can be added into a scheduler for processing. More...

#include <schedulable.h>

Inheritance diagram for schedulable:

Inheritance graph
[legend]
Collaboration diagram for schedulable:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 schedulable (const scheduling_id &item_id, int actor_id, const periodicity &when_to_schedule)
 constructs a schedulable item whose id is "item_id".
virtual ~schedulable ()
 IMPLEMENT_CLASS_NAME ("schedulable")
const scheduling_iditem_id () const
 the scheduling id for this schedulable item.
int actor_id () const
 returns the parent that processes this type of schedule item.
virtual int weight () const
 provides an estimate of the size required for this schedule item.
virtual istring schedulable_text_form () const
 returns a textual description of the data in this object.
const heartbeatexpiration () const
 returns the state of the countdown to the item's expiration.
heartbeatexpiration ()
 sets the item's expiration characteristics.
const item_statisticsstats () const
 returns the record of this item's behavior.
item_statisticsstats ()
 sets the statistics for this object.
bool preprocessed () const
 used by the scheduler to track the status of this item.
void preprocessed (bool state)
 sets the status of this item.

Detailed Description

A base class for objects that can be added into a scheduler for processing.

This requires a description of the period for scheduling (if the object is to be repeatedly scheduled) and it needs to know the identity (id) of the schedule_actor that will process the object during its scheduling runs.

Note: this is a heavy-weight header; it should only be included inside implementation files (*.cpp).

Definition at line 50 of file schedulable.h.


Constructor & Destructor Documentation

schedulable::schedulable ( const scheduling_id item_id,
int  actor_id,
const periodicity when_to_schedule 
)

constructs a schedulable item whose id is "item_id".

it will be managed by the actor with "actor_id" and will be subject to the periodicity in "when_to_schedule".

Definition at line 23 of file schedulable.cpp.

schedulable::~schedulable (  )  [virtual]

Definition at line 33 of file schedulable.cpp.


Member Function Documentation

schedulable::IMPLEMENT_CLASS_NAME ( "schedulable"   ) 

const scheduling_id& schedulable::item_id (  )  const [inline]

the scheduling id for this schedulable item.

Definition at line 66 of file schedulable.h.

Referenced by scheduler::add().

int schedulable::actor_id (  )  const [inline]

returns the parent that processes this type of schedule item.

Definition at line 69 of file schedulable.h.

Referenced by scheduler::add(), scheduler::items_scheduled(), and scheduler::zap().

int schedulable::weight (  )  const [virtual]

provides an estimate of the size required for this schedule item.

the implementor should only need to consider those bytes that they store within their derived schedulable objects. if one doesn't override this, then the schedule's maximum weight parameter is ineffectual.

Definition at line 35 of file schedulable.cpp.

Referenced by scheduler::add(), and scheduler::zap().

istring schedulable::schedulable_text_form (  )  const [virtual]

returns a textual description of the data in this object.

Definition at line 37 of file schedulable.cpp.

References periodicity::per_text_form(), unique_id< uniquifier >::raw_id(), istring::SPRINTF, item_statistics::text_form(), and heartbeat::time_left().

const heartbeat& schedulable::expiration (  )  const [inline]

returns the state of the countdown to the item's expiration.

Definition at line 82 of file schedulable.h.

Referenced by scheduler::mark_dead().

heartbeat& schedulable::expiration (  )  [inline]

sets the item's expiration characteristics.

Definition at line 84 of file schedulable.h.

const item_statistics& schedulable::stats (  )  const [inline]

returns the record of this item's behavior.

Definition at line 87 of file schedulable.h.

Referenced by scheduler::add().

item_statistics& schedulable::stats (  )  [inline]

sets the statistics for this object.

Definition at line 89 of file schedulable.h.

bool schedulable::preprocessed (  )  const [inline]

used by the scheduler to track the status of this item.

Definition at line 92 of file schedulable.h.

void schedulable::preprocessed ( bool  state  )  [inline]

sets the status of this item.

Definition at line 94 of file schedulable.h.


The documentation for this class was generated from the following files:
Generated on Fri Oct 10 04:30:30 2008 for HOOPLE Libraries by  doxygen 1.5.1