ChimeraTK-DeviceAccess  03.18.00
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. More...
 
 VersionNumber (const VersionNumber &other)=default
 Copy constructor. More...
 
VersionNumberoperator= (const VersionNumber &other)=default
 Copy the full state of another VersionNumber object. More...
 
 VersionNumber (std::chrono::system_clock::time_point timestamp)
 Generate new unique version number with a given time stamp. More...
 
 VersionNumber (std::nullptr_t)
 Create null version number, which is guaranteed to be smaller than all version numbers generated with the default constructor. More...
 
std::chrono::time_point< std::chrono::system_clock > getTime () const
 Return the time stamp associated with this version number. More...
 
bool operator== (const VersionNumber &other) const
 Comparison operators. More...
 
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. More...
 

Friends

std::ostream & operator<< (std::ostream &stream, const VersionNumber &version)
 Stream operator passing the human readable representation to an ostream. More...
 

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 23 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 28 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 99 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 45 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 48 of file VersionNumber.h.

+ Here is the caller graph for this function:

◆ 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.

+ Here is the call graph for this function:

◆ operator!=()

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

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.

◆ 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 56 of file VersionNumber.h.

◆ 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.

Friends And Related Function 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.


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