oasys::Timer Class Reference

#include <Timer.h>

Inheritance diagram for oasys::Timer:

dtn::ContactManager::LinkAvailabilityTimer dtn::CustodyTimer dtn::ExpirationTimer dtn::ProphetAckAgeTimer dtn::ProphetTableAgeTimer dtn::Registration::ExpirationTimer oasys::BerkeleyDBStore::DeadlockTimer oasys::QueuingTimer oasys::RateEstimator

List of all members.


Detailed Description

A Timer class.

Provides methods for scheduling timers. Derived classes must override the pure virtual timeout() method.

Definition at line 164 of file Timer.h.


Public Member Functions

 Timer ()
virtual ~Timer ()
void schedule_at (struct timeval *when)
void schedule_in (int milliseconds)
void schedule_immediate ()
bool cancel ()
bool pending ()
bool cancelled ()
struct timeval when ()
virtual void timeout (const struct timeval &now)=0

Protected Types

enum  cancel_flags_t { NO_DELETE = 0, DELETE_ON_CANCEL = 1 }
 Enum type for cancel flags related to memory management. More...

Protected Attributes

struct timeval when_
 When the timer should fire.
bool pending_
 Is the timer currently pending.
bool cancelled_
 Is this timer cancelled.
cancel_flags_t cancel_flags_
 Should we keep the timer around or delete it when the cancelled timer bubbles to the top.

Friends

class TimerSystem
class TimerCompare

Member Enumeration Documentation

enum oasys::Timer::cancel_flags_t [protected]

Enum type for cancel flags related to memory management.

Enumerator:
NO_DELETE 
DELETE_ON_CANCEL 

Definition at line 222 of file Timer.h.


Constructor & Destructor Documentation

oasys::Timer::Timer (  )  [inline]

Definition at line 166 of file Timer.h.

virtual oasys::Timer::~Timer (  )  [inline, virtual]

Definition at line 173 of file Timer.h.

References pending_.


Member Function Documentation

void oasys::Timer::schedule_at ( struct timeval *  when  )  [inline]

Definition at line 181 of file Timer.h.

Referenced by dtn::BundleDaemon::add_to_pending(), dtn::CustodyTimer::CustodyTimer(), dtn::Registration::init_expiration_timer(), dtn::ProphetAckAgeTimer::reschedule(), and dtn::ProphetTableAgeTimer::reschedule().

void oasys::Timer::schedule_in ( int  milliseconds  )  [inline]

Definition at line 186 of file Timer.h.

Referenced by dtn::ContactManager::handle_link_unavailable(), oasys::RateEstimator::RateEstimator(), oasys::BerkeleyDBStore::DeadlockTimer::reschedule(), and oasys::RateEstimator::timeout().

void oasys::Timer::schedule_immediate (  )  [inline]

Definition at line 190 of file Timer.h.

bool oasys::Timer::cancel (  )  [inline]

Definition at line 195 of file Timer.h.

Referenced by dtn::Registration::cleanup_expiration_timer(), dtn::BundleDaemon::delete_from_pending(), dtn::ContactManager::handle_link_available(), dtn::ProphetController::shutdown(), and oasys::BerkeleyDBStore::~BerkeleyDBStore().

bool oasys::Timer::pending (  )  [inline]

Definition at line 200 of file Timer.h.

References pending_.

Referenced by dtn::BundleDaemon::handle_custody_timeout().

bool oasys::Timer::cancelled (  )  [inline]

Definition at line 205 of file Timer.h.

References cancelled_.

Referenced by dtn::BundleDaemon::handle_custody_timeout().

struct timeval oasys::Timer::when (  )  [inline, read]

Definition at line 210 of file Timer.h.

References when_.

virtual void oasys::Timer::timeout ( const struct timeval &  now  )  [pure virtual]

Implemented in oasys::BerkeleyDBStore::DeadlockTimer, dtn::CustodyTimer, dtn::ExpirationTimer, dtn::ContactManager::LinkAvailabilityTimer, dtn::Registration::ExpirationTimer, dtn::ProphetTableAgeTimer, and dtn::ProphetAckAgeTimer.


Friends And Related Function Documentation

friend class TimerSystem [friend]

Definition at line 218 of file Timer.h.

friend class TimerCompare [friend]

Definition at line 219 of file Timer.h.


Member Data Documentation

struct timeval oasys::Timer::when_ [read, protected]

When the timer should fire.

Definition at line 227 of file Timer.h.

Referenced by oasys::TimerCompare::operator()(), oasys::TimerSystem::run_expired_timers(), oasys::TimerSystem::schedule_at(), and when().

bool oasys::Timer::pending_ [protected]

Is the timer currently pending.

Definition at line 228 of file Timer.h.

Referenced by oasys::TimerSystem::cancel(), pending(), oasys::TimerSystem::schedule_at(), ~Timer(), and oasys::TimerSystem::~TimerSystem().

bool oasys::Timer::cancelled_ [protected]

Is this timer cancelled.

Definition at line 229 of file Timer.h.

Referenced by oasys::TimerSystem::cancel(), cancelled(), and oasys::TimerSystem::schedule_at().

cancel_flags_t oasys::Timer::cancel_flags_ [protected]

Should we keep the timer around or delete it when the cancelled timer bubbles to the top.

Definition at line 230 of file Timer.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 8 08:36:26 2007 for DTN Reference Implementation by  doxygen 1.5.3