Public Member Functions | Private Attributes | List of all members
franka::Duration Class Reference

Represents a duration with millisecond resolution. More...

#include <duration.h>

Public Member Functions

 Duration () noexcept
 Creates a new Duration instance with zero milliseconds. More...
 
 Duration (uint64_t milliseconds) noexcept
 Creates a new Duration instance from the given number of milliseconds. More...
 
 Duration (std::chrono::duration< uint64_t, std::milli > duration) noexcept
 Creates a new Duration instance from an std::chrono::duration. More...
 
 Duration (const Duration &)=default
 Creates a copy of a Duration instance. More...
 
 operator std::chrono::duration< uint64_t, std::milli > () const noexcept
 Returns the stored duration as an std::chrono::duration. More...
 
Durationoperator= (const Duration &)=default
 Assigns the contents of one Duration to another. More...
 
uint64_t toMSec () const noexcept
 Returns the stored duration in $[ms]$. More...
 
double toSec () const noexcept
 Returns the stored duration in $[s]$. More...
 
Arithmetic operators
Duration operator+ (const Duration &rhs) const noexcept
 Performs addition. More...
 
Durationoperator+= (const Duration &rhs) noexcept
 Performs addition. More...
 
Duration operator- (const Duration &rhs) const noexcept
 Performs subtraction. More...
 
Durationoperator-= (const Duration &rhs) noexcept
 Performs subtraction. More...
 
Duration operator* (uint64_t rhs) const noexcept
 Performs multiplication. More...
 
Durationoperator*= (uint64_t rhs) noexcept
 Performs multiplication. More...
 
uint64_t operator/ (const Duration &rhs) const noexcept
 Performs division. More...
 
Duration operator/ (uint64_t rhs) const noexcept
 Performs division. More...
 
Durationoperator/= (uint64_t rhs) noexcept
 Performs division. More...
 
Duration operator% (const Duration &rhs) const noexcept
 Performs the modulo operation. More...
 
Duration operator% (uint64_t rhs) const noexcept
 Performs the modulo operation. More...
 
Durationoperator%= (const Duration &rhs) noexcept
 Performs the modulo operation. More...
 
Durationoperator%= (uint64_t rhs) noexcept
 Performs the modulo operation. More...
 
Comparison operators
bool operator== (const Duration &rhs) const noexcept
 Compares two durations for equality. More...
 
bool operator!= (const Duration &rhs) const noexcept
 Compares two durations for inequality. More...
 
bool operator< (const Duration &rhs) const noexcept
 Compares two durations. More...
 
bool operator<= (const Duration &rhs) const noexcept
 Compares two durations. More...
 
bool operator> (const Duration &rhs) const noexcept
 Compares two durations. More...
 
bool operator>= (const Duration &rhs) const noexcept
 Compares two durations. More...
 

Private Attributes

std::chrono::duration< uint64_t, std::milli > duration_
 

Detailed Description

Represents a duration with millisecond resolution.

Definition at line 19 of file duration.h.

Constructor & Destructor Documentation

franka::Duration::Duration ( )
noexcept

Creates a new Duration instance with zero milliseconds.

franka::Duration::Duration ( uint64_t  milliseconds)
explicitnoexcept

Creates a new Duration instance from the given number of milliseconds.

Parameters
[in]millisecondsNumber of milliseconds.
franka::Duration::Duration ( std::chrono::duration< uint64_t, std::milli >  duration)
noexcept

Creates a new Duration instance from an std::chrono::duration.

Parameters
[in]durationDuration.
franka::Duration::Duration ( const Duration )
default

Creates a copy of a Duration instance.

Member Function Documentation

franka::Duration::operator std::chrono::duration< uint64_t, std::milli > ( ) const
noexcept

Returns the stored duration as an std::chrono::duration.

Returns
Duration as std::chrono::duration.
bool franka::Duration::operator!= ( const Duration rhs) const
noexcept

Compares two durations for inequality.

Parameters
[in]rhsRight-hand side of the comparison.
Returns
True if the duration are not equal, false otherwise.
Duration franka::Duration::operator% ( const Duration rhs) const
noexcept

Performs the modulo operation.

Parameters
[in]rhsRight-hand side of the operation.
Returns
Result of the operation.
Duration franka::Duration::operator% ( uint64_t  rhs) const
noexcept

Performs the modulo operation.

Parameters
[in]rhsRight-hand side of the operation.
Returns
Result of the operation.
Duration& franka::Duration::operator%= ( const Duration rhs)
noexcept

Performs the modulo operation.

Parameters
[in]rhsRight-hand side of the operation.
Returns
This duration.
Duration& franka::Duration::operator%= ( uint64_t  rhs)
noexcept

Performs the modulo operation.

Parameters
[in]rhsRight-hand side of the operation.
Returns
This duration.
Duration franka::Duration::operator* ( uint64_t  rhs) const
noexcept

Performs multiplication.

Parameters
[in]rhsRight-hand side of the operation.
Returns
Result of the operation.
Duration& franka::Duration::operator*= ( uint64_t  rhs)
noexcept

Performs multiplication.

Parameters
[in]rhsRight-hand side of the operation.
Returns
This duration.
Duration franka::Duration::operator+ ( const Duration rhs) const
noexcept

Performs addition.

Parameters
[in]rhsRight-hand side of the operation.
Returns
Result of the operation.
Duration& franka::Duration::operator+= ( const Duration rhs)
noexcept

Performs addition.

Parameters
[in]rhsRight-hand side of the operation.
Returns
This duration.
Duration franka::Duration::operator- ( const Duration rhs) const
noexcept

Performs subtraction.

Parameters
[in]rhsRight-hand side of the operation.
Returns
Result of the operation.
Duration& franka::Duration::operator-= ( const Duration rhs)
noexcept

Performs subtraction.

Parameters
[in]rhsRight-hand side of the operation.
Returns
This duration.
uint64_t franka::Duration::operator/ ( const Duration rhs) const
noexcept

Performs division.

Parameters
[in]rhsRight-hand side of the operation.
Returns
Result of the operation.
Duration franka::Duration::operator/ ( uint64_t  rhs) const
noexcept

Performs division.

Parameters
[in]rhsRight-hand side of the operation.
Returns
Result of the operation.
Duration& franka::Duration::operator/= ( uint64_t  rhs)
noexcept

Performs division.

Parameters
[in]rhsRight-hand side of the operation.
Returns
This duration.
bool franka::Duration::operator< ( const Duration rhs) const
noexcept

Compares two durations.

Parameters
[in]rhsRight-hand side of the comparison.
Returns
True if this duration is shorter than rhs, false otherwise.
bool franka::Duration::operator<= ( const Duration rhs) const
noexcept

Compares two durations.

Parameters
[in]rhsRight-hand side of the comparison.
Returns
True if this duration is shorter than or equal to rhs, false otherwise.
Duration& franka::Duration::operator= ( const Duration )
default

Assigns the contents of one Duration to another.

Returns
Result of the operation.
bool franka::Duration::operator== ( const Duration rhs) const
noexcept

Compares two durations for equality.

Parameters
[in]rhsRight-hand side of the comparison.
Returns
True if the duration are equal, false otherwise.
bool franka::Duration::operator> ( const Duration rhs) const
noexcept

Compares two durations.

Parameters
[in]rhsRight-hand side of the comparison.
Returns
True if this duration is longer than rhs, false otherwise.
bool franka::Duration::operator>= ( const Duration rhs) const
noexcept

Compares two durations.

Parameters
[in]rhsRight-hand side of the comparison.
Returns
True if this duration is longer than or equal to rhs, false otherwise.
uint64_t franka::Duration::toMSec ( ) const
noexcept

Returns the stored duration in $[ms]$.

Returns
Duration in $[ms]$.
double franka::Duration::toSec ( ) const
noexcept

Returns the stored duration in $[s]$.

Returns
Duration in $[s]$.

Member Data Documentation

std::chrono::duration<uint64_t, std::milli> franka::Duration::duration_
private

Definition at line 252 of file duration.h.


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


libfranka
Author(s): Franka Emika GmbH
autogenerated on Tue Jul 9 2019 03:32:01