smats  0.0.1
Satisfability Modulo Arithmetic Theories Symbols
Loading...
Searching...
No Matches
smats::TimerGuard Class Reference

#include <timer.h>

Public Member Functions

 TimerGuard (Timer *timer, bool enabled, bool start_timer=true)
 
 TimerGuard (const TimerGuard &)=delete
 
 TimerGuard (TimerGuard &&)=delete
 
TimerGuardoperator= (const TimerGuard &)=delete
 
TimerGuardoperator= (TimerGuard &&)=delete
 
 ~TimerGuard ()
 
void pause ()
 
void resume ()
 

Private Attributes

Timer *const timer_
 The timer to be guarded.
 
const bool enabled_ {false}
 Whether the timer is enabled.
 

Detailed Description

Wrap a timer object and pauses it when the guard object is destructed.

Constructor & Destructor Documentation

◆ TimerGuard()

smats::TimerGuard::TimerGuard ( Timer * timer,
bool enabled,
bool start_timer = true )

Construct a timer guard object.

If enabled is false or timer is a nullptr, this class does not do anything. If start_timer is true, starts the timer in the constructor. Otherwise, it does not start it and a user has to call resume() to start it.

Parameters
timerthe timer to be guarded
enabledwhether the timer is enabled and will run
start_timerwhether the timer should be started as soon as the guard is created

◆ ~TimerGuard()

smats::TimerGuard::~TimerGuard ( )

When the timer guard object is destructed, it pauses the embedded timer object. If the timer is not enabled, this function does nothing.

Member Function Documentation

◆ pause()

void smats::TimerGuard::pause ( )

Pause the guarded timer object

◆ resume()

void smats::TimerGuard::resume ( )

Resume the guarded timer object


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