LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
okapi::AbstractTimer Class Referenceabstract

#include <abstractTimer.hpp>

Inheritance diagram for okapi::AbstractTimer:
okapi::Timer

Public Member Functions

 AbstractTimer (QTime ifirstCalled)
 A Timer base class which implements its methods in terms of millis().
 
virtual ~AbstractTimer ()
 
virtual QTime millis () const =0
 Returns the current time in units of QTime.
 
virtual QTime getDt ()
 Returns the time passed in ms since the previous call of this function.
 
virtual QTime readDt () const
 Returns the time passed in ms since the previous call of getDt().
 
virtual QTime getStartingTime () const
 Returns the time the timer was first constructed.
 
virtual QTime getDtFromStart () const
 Returns the time since the timer was first constructed.
 
virtual void placeMark ()
 Place a time marker.
 
virtual QTime clearMark ()
 Clears the marker.
 
virtual void placeHardMark ()
 Place a hard time marker.
 
virtual QTime clearHardMark ()
 Clears the hard marker.
 
virtual QTime getDtFromMark () const
 Returns the time since the time marker.
 
virtual QTime getDtFromHardMark () const
 Returns the time since the hard time marker.
 
virtual bool repeat (QTime time)
 Returns true when the input time period has passed, then resets.
 
virtual bool repeat (QFrequency frequency)
 Returns true when the input time period has passed, then resets.
 

Protected Attributes

QTime firstCalled
 
QTime lastCalled
 
QTime mark
 
QTime hardMark
 
QTime repeatMark
 

Detailed Description

Definition at line 12 of file abstractTimer.hpp.

Constructor & Destructor Documentation

◆ AbstractTimer()

okapi::AbstractTimer::AbstractTimer ( QTime  ifirstCalled)
explicit

A Timer base class which implements its methods in terms of millis().

Parameters
ifirstCalledthe current time

◆ ~AbstractTimer()

virtual okapi::AbstractTimer::~AbstractTimer ( )
virtual

Member Function Documentation

◆ clearHardMark()

virtual QTime okapi::AbstractTimer::clearHardMark ( )
virtual

Clears the hard marker.

Returns
The old hard marker

◆ clearMark()

virtual QTime okapi::AbstractTimer::clearMark ( )
virtual

Clears the marker.

Returns
The old marker

◆ getDt()

virtual QTime okapi::AbstractTimer::getDt ( )
virtual

Returns the time passed in ms since the previous call of this function.

Returns
The time passed in ms since the previous call of this function

◆ getDtFromHardMark()

virtual QTime okapi::AbstractTimer::getDtFromHardMark ( ) const
virtual

Returns the time since the hard time marker.

Returns 0_ms if there is no hard marker set.

Returns
The time since the hard time marker

◆ getDtFromMark()

virtual QTime okapi::AbstractTimer::getDtFromMark ( ) const
virtual

Returns the time since the time marker.

Returns 0_ms if there is no marker.

Returns
The time since the time marker

◆ getDtFromStart()

virtual QTime okapi::AbstractTimer::getDtFromStart ( ) const
virtual

Returns the time since the timer was first constructed.

Returns
The time since the timer was first constructed

◆ getStartingTime()

virtual QTime okapi::AbstractTimer::getStartingTime ( ) const
virtual

Returns the time the timer was first constructed.

Returns
The time the timer was first constructed

◆ millis()

virtual QTime okapi::AbstractTimer::millis ( ) const
pure virtual

Returns the current time in units of QTime.

Returns
the current time

Implemented in okapi::Timer.

◆ placeHardMark()

virtual void okapi::AbstractTimer::placeHardMark ( )
virtual

Place a hard time marker.

Placing another hard marker will not overwrite the previous one; instead, call clearHardMark() and then place another.

◆ placeMark()

virtual void okapi::AbstractTimer::placeMark ( )
virtual

Place a time marker.

Placing another marker will overwrite the previous one.

◆ readDt()

virtual QTime okapi::AbstractTimer::readDt ( ) const
virtual

Returns the time passed in ms since the previous call of getDt().

Does not change the time recorded by getDt().

Returns
The time passed in ms since the previous call of getDt()

◆ repeat() [1/2]

virtual bool okapi::AbstractTimer::repeat ( QFrequency  frequency)
virtual

Returns true when the input time period has passed, then resets.

Meant to be used in loops to run an action every time period without blocking.

Parameters
frequencythe repeat frequency
Returns
true when the input time period has passed, false after reading true until the period has passed again

◆ repeat() [2/2]

virtual bool okapi::AbstractTimer::repeat ( QTime  time)
virtual

Returns true when the input time period has passed, then resets.

Meant to be used in loops to run an action every time period without blocking.

Parameters
timetime period
Returns
true when the input time period has passed, false after reading true until the period has passed again

Member Data Documentation

◆ firstCalled

QTime okapi::AbstractTimer::firstCalled
protected

Definition at line 119 of file abstractTimer.hpp.

◆ hardMark

QTime okapi::AbstractTimer::hardMark
protected

Definition at line 122 of file abstractTimer.hpp.

◆ lastCalled

QTime okapi::AbstractTimer::lastCalled
protected

Definition at line 120 of file abstractTimer.hpp.

◆ mark

QTime okapi::AbstractTimer::mark
protected

Definition at line 121 of file abstractTimer.hpp.

◆ repeatMark

QTime okapi::AbstractTimer::repeatMark
protected

Definition at line 123 of file abstractTimer.hpp.


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