oasys::Timer Class Reference

#include <Timer.h>

Inheritance diagram for oasys::Timer:

dtn::ContactManager::LinkAvailabilityTimer dtn::CustodyTimer dtn::ExpirationTimer 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 184 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 ()
timeval when ()
virtual void timeout (const struct timeval &now)=0

Protected Types

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

Protected Attributes

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 242 of file Timer.h.


Constructor & Destructor Documentation

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

Definition at line 186 of file Timer.h.

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

Definition at line 193 of file Timer.h.

References pending_.


Member Function Documentation

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

Definition at line 215 of file Timer.h.

Referenced by dtn::Registration::cleanup_expiration_timer(), dtn::BundleDaemon::delete_from_pending(), and dtn::ContactManager::handle_link_available().

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

Definition at line 225 of file Timer.h.

References cancelled_.

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

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

Definition at line 220 of file Timer.h.

References pending_.

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

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

Definition at line 201 of file Timer.h.

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

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

Definition at line 210 of file Timer.h.

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

Definition at line 206 of file Timer.h.

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

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

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

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

Definition at line 230 of file Timer.h.

References when_.


Friends And Related Function Documentation

friend class TimerCompare [friend]

Definition at line 239 of file Timer.h.

friend class TimerSystem [friend]

Definition at line 238 of file Timer.h.


Member Data Documentation

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 250 of file Timer.h.

bool oasys::Timer::cancelled_ [protected]

Is this timer cancelled.

Definition at line 249 of file Timer.h.

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

bool oasys::Timer::pending_ [protected]

Is the timer currently pending.

Definition at line 248 of file Timer.h.

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

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

When the timer should fire.

Definition at line 247 of file Timer.h.

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


The documentation for this class was generated from the following file:
Generated on Thu Aug 31 21:06:07 2006 for DTN Reference Implementation by  doxygen 1.4.7