Quantum++  v0.8.2
C++11 quantum computing library
qpp::Timer Class Reference

Chronometer. More...

#include <classes/timer.h>

Inheritance diagram for qpp::Timer:
Collaboration diagram for qpp::Timer:

Public Member Functions

 Timer () noexcept
 Constructs an instance with the current time as the starting point. More...
 
void tic () noexcept
 Resets the chronometer. More...
 
const Timertoc () noexcept
 Stops the chronometer. More...
 
double seconds () const noexcept
 Time passed in seconds. More...
 
 Timer (const Timer &)=default
 Default copy constructor. More...
 
 Timer (Timer &&)=default
 Default move constructor. More...
 
Timeroperator= (const Timer &)=default
 Default copy assignment operator. More...
 
Timeroperator= (Timer &&)=default
 Default move assignment operator. More...
 
virtual ~Timer ()=default
 Default virtual destructor. More...
 
- Public Member Functions inherited from qpp::IDisplay
 IDisplay ()=default
 Default constructor. More...
 
 IDisplay (const IDisplay &)=default
 Default copy constructor. More...
 
 IDisplay (IDisplay &&)=default
 Default move constructor. More...
 
IDisplayoperator= (const IDisplay &)=default
 Default copy assignment operator. More...
 
IDisplayoperator= (IDisplay &&)=default
 Default move assignment operator. More...
 
virtual ~IDisplay ()=default
 Default virtual destructor. More...
 

Protected Attributes

std::chrono::steady_clock::time_point _start
 
std::chrono::steady_clock::time_point _end
 

Private Member Functions

std::ostream & display (std::ostream &os) const override
 qpp::IDisplay::display() override More...
 

Detailed Description

Chronometer.

Uses a std::chrono::steady_clock. It is not affected by wall clock changes during runtime.

Constructor & Destructor Documentation

qpp::Timer::Timer ( )
inlinenoexcept

Constructs an instance with the current time as the starting point.

qpp::Timer::Timer ( const Timer )
default

Default copy constructor.

qpp::Timer::Timer ( Timer &&  )
default

Default move constructor.

virtual qpp::Timer::~Timer ( )
virtualdefault

Default virtual destructor.

Member Function Documentation

std::ostream& qpp::Timer::display ( std::ostream &  os) const
inlineoverrideprivatevirtual

qpp::IDisplay::display() override

Parameters
osOutput stream
Returns
Writes to the output stream the number of seconds that passed between the instantiation/reset and invocation of qpp::Timer::toc().

Implements qpp::IDisplay.

Timer& qpp::Timer::operator= ( const Timer )
default

Default copy assignment operator.

Timer& qpp::Timer::operator= ( Timer &&  )
default

Default move assignment operator.

double qpp::Timer::seconds ( ) const
inlinenoexcept

Time passed in seconds.

Returns
Number of seconds that passed between the instantiation/reset and invocation of qpp::Timer::toc()
void qpp::Timer::tic ( )
inlinenoexcept

Resets the chronometer.

Resets the starting/ending point to the current time

const Timer& qpp::Timer::toc ( )
inlinenoexcept

Stops the chronometer.

Set the current time as the ending point

Returns
Current instance

Member Data Documentation

std::chrono::steady_clock::time_point qpp::Timer::_end
protected
std::chrono::steady_clock::time_point qpp::Timer::_start
protected

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