ChimeraTK-DeviceAccess 03.20.00
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ChimeraTK::VersionNumber Class Reference

Class for generating and holding version numbers without exposing a numeric representation. More...

#include <VersionNumber.h>

Public Member Functions

 VersionNumber ()
 Default constructor: Generate new unique version number with current time as time stamp.
 
 VersionNumber (const VersionNumber &other)=default
 Copy constructor.
 
VersionNumberoperator= (const VersionNumber &other)=default
 Copy the full state of another VersionNumber object.
 
 VersionNumber (std::chrono::system_clock::time_point timestamp)
 Generate new unique version number with a given time stamp.
 
 VersionNumber (std::nullptr_t)
 Create null version number, which is guaranteed to be smaller than all version numbers generated with the default constructor.
 
std::chrono::time_point< std::chrono::system_clock > getTime () const
 Return the time stamp associated with this version number.
 
bool operator== (const VersionNumber &other) const
 Comparison operators.
 
bool operator!= (const VersionNumber &other) const
 
bool operator> (const VersionNumber &other) const
 
bool operator< (const VersionNumber &other) const
 
bool operator>= (const VersionNumber &other) const
 
bool operator<= (const VersionNumber &other) const
 
 operator std::string () const
 Conversion into a human readable std::string to allow e.g.
 

Friends

template<class T , class CharT >
struct std::formatter
 
std::ostream & operator<< (std::ostream &stream, const VersionNumber &version)
 Stream operator passing the human readable representation to an ostream.
 

Detailed Description

Class for generating and holding version numbers without exposing a numeric representation.

Version numbers are used to resolve competing updates that are applied to the same process variable. For example, it they can help in breaking an infinite update loop that might occur when two process variables are related and update each other.

They are also used to determine the order of updates made to different process variables.

Definition at line 24 of file VersionNumber.h.

Constructor & Destructor Documentation

◆ VersionNumber() [1/4]

ChimeraTK::VersionNumber::VersionNumber ( )
inline

Default constructor: Generate new unique version number with current time as time stamp.

Definition at line 29 of file VersionNumber.h.

◆ VersionNumber() [2/4]

ChimeraTK::VersionNumber::VersionNumber ( const VersionNumber other)
default

Copy constructor.

◆ VersionNumber() [3/4]

ChimeraTK::VersionNumber::VersionNumber ( std::chrono::system_clock::time_point  timestamp)
inlineexplicit

Generate new unique version number with a given time stamp.

Definition at line 103 of file VersionNumber.h.

◆ VersionNumber() [4/4]

ChimeraTK::VersionNumber::VersionNumber ( std::nullptr_t  )
inlineexplicit

Create null version number, which is guaranteed to be smaller than all version numbers generated with the default constructor.

This should be used to initialse version numbers which are never actually used for data transfers (e.g. at application start). The argument is a dummy argument to distinguish the contructor signature.

Definition at line 46 of file VersionNumber.h.

Member Function Documentation

◆ getTime()

std::chrono::time_point< std::chrono::system_clock > ChimeraTK::VersionNumber::getTime ( ) const
inline

Return the time stamp associated with this version number.

Definition at line 49 of file VersionNumber.h.

◆ operator std::string()

ChimeraTK::VersionNumber::operator std::string ( ) const
explicit

Conversion into a human readable std::string to allow e.g.

printing the version number on screen. Do not try to parse the string in any way, the exact format is unspecified.

Definition at line 14 of file VersionNumber.cc.

◆ operator!=()

bool ChimeraTK::VersionNumber::operator!= ( const VersionNumber other) const
inline

Definition at line 58 of file VersionNumber.h.

◆ operator<()

bool ChimeraTK::VersionNumber::operator< ( const VersionNumber other) const
inline

Definition at line 60 of file VersionNumber.h.

◆ operator<=()

bool ChimeraTK::VersionNumber::operator<= ( const VersionNumber other) const
inline

Definition at line 62 of file VersionNumber.h.

◆ operator=()

VersionNumber & ChimeraTK::VersionNumber::operator= ( const VersionNumber other)
default

Copy the full state of another VersionNumber object.

◆ operator==()

bool ChimeraTK::VersionNumber::operator== ( const VersionNumber other) const
inline

Comparison operators.

Compare version number only, since they are ordered in time and atomically generated, so the result is logically as expected. The time stamp is not precise and not atomically generated, so comparing it would not be precise.

Definition at line 57 of file VersionNumber.h.

◆ operator>()

bool ChimeraTK::VersionNumber::operator> ( const VersionNumber other) const
inline

Definition at line 59 of file VersionNumber.h.

◆ operator>=()

bool ChimeraTK::VersionNumber::operator>= ( const VersionNumber other) const
inline

Definition at line 61 of file VersionNumber.h.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  stream,
const VersionNumber version 
)
friend

Stream operator passing the human readable representation to an ostream.

Definition at line 20 of file VersionNumber.cc.

◆ std::formatter

template<class T , class CharT >
friend struct std::formatter
friend

Definition at line 98 of file VersionNumber.h.


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