DESERT 4.0.0
CsmaAloha::AlohaTimer Class Reference

#include <uw-csma-aloha.h>

Inheritance diagram for CsmaAloha::AlohaTimer:
Inheritance graph
Collaboration diagram for CsmaAloha::AlohaTimer:
Collaboration graph

Public Member Functions

 AlohaTimer (CsmaAloha *m)
 
virtual ~AlohaTimer ()=default
 
virtual void freeze ()
 
virtual void unFreeze ()
 
virtual void stop ()
 
virtual void schedule (double val)
 
bool isIdle ()
 
bool isRunning ()
 
bool isExpired ()
 
bool isFrozen ()
 
bool isActive ()
 
void resetCounter ()
 
void incrCounter ()
 
int getCounter () const
 
double getDuration () const
 

Protected Attributes

double start_time
 
double left_duration
 
int counter
 
CsmaAloha *CSMA_TIMER_STATUS timer_status
 

Detailed Description

Class that describes the timers in the node

Constructor & Destructor Documentation

◆ AlohaTimer()

CsmaAloha::AlohaTimer::AlohaTimer ( CsmaAloha m)
inline

Constructor of the AlohaTimer class

Parameters
CsmaAloha*a pointer to an object of type CsmaAloha*

◆ ~AlohaTimer()

virtual CsmaAloha::AlohaTimer::~AlohaTimer ( )
virtualdefault

Destructor of the AlohaTimer class

Member Function Documentation

◆ freeze()

virtual void CsmaAloha::AlohaTimer::freeze ( )
inlinevirtual

◆ getCounter()

int CsmaAloha::AlohaTimer::getCounter ( ) const
inline

Returns the counter of the timer

Returns
the value of the counter of the timer

References counter.

◆ getDuration()

double CsmaAloha::AlohaTimer::getDuration ( ) const
inline

Returns the left duration of the timer

Returns
left duration of the timer

References left_duration.

◆ incrCounter()

void CsmaAloha::AlohaTimer::incrCounter ( )
inline

Increments the counter of the timer

References counter.

◆ isActive()

bool CsmaAloha::AlohaTimer::isActive ( )
inline

Checks if the timer is ACTIVE

Returns
true or false

References CsmaAloha::CSMA_FROZEN, CsmaAloha::CSMA_RUNNING, and timer_status.

◆ isExpired()

bool CsmaAloha::AlohaTimer::isExpired ( )
inline

Checks if the timer is EXPIRED

Returns
true or false

References CsmaAloha::CSMA_EXPIRED, and timer_status.

◆ isFrozen()

bool CsmaAloha::AlohaTimer::isFrozen ( )
inline

Checks if the timer is FROZEN

Returns
true or false

References CsmaAloha::CSMA_FROZEN, and timer_status.

◆ isIdle()

bool CsmaAloha::AlohaTimer::isIdle ( )
inline

checks if the timer is IDLE

Returns
bool true or false

References CsmaAloha::CSMA_IDLE, and timer_status.

◆ isRunning()

bool CsmaAloha::AlohaTimer::isRunning ( )
inline

checks if the timer is RUNNING

Returns
true or false

References CsmaAloha::CSMA_RUNNING, and timer_status.

◆ resetCounter()

void CsmaAloha::AlohaTimer::resetCounter ( )
inline

Resets the counter of the timer

◆ schedule()

virtual void CsmaAloha::AlohaTimer::schedule ( double  val)
inlinevirtual

schedule a timer

Parameters
doublethe duration of the timer

References CsmaAloha::CSMA_RUNNING, left_duration, start_time, and timer_status.

◆ stop()

virtual void CsmaAloha::AlohaTimer::stop ( )
inlinevirtual

stops the timer

References CsmaAloha::CSMA_IDLE, and timer_status.

◆ unFreeze()

virtual void CsmaAloha::AlohaTimer::unFreeze ( )
inlinevirtual

unFreezes is used to resume the timer starting from the point where it was freezed

References CsmaAloha::CSMA_FROZEN, CsmaAloha::CSMA_RUNNING, left_duration, start_time, and timer_status.

Member Data Documentation

◆ counter

int CsmaAloha::AlohaTimer::counter
protected

counter of the timer

Referenced by getCounter(), and incrCounter().

◆ left_duration

double CsmaAloha::AlohaTimer::left_duration
protected

Left duration of the timer

Referenced by freeze(), getDuration(), schedule(), and unFreeze().

◆ start_time

double CsmaAloha::AlohaTimer::start_time
protected

Start Time of the timer

Referenced by freeze(), schedule(), and unFreeze().

◆ timer_status

CsmaAloha* CSMA_TIMER_STATUS CsmaAloha::AlohaTimer::timer_status
protected

The documentation for this class was generated from the following file: