ChimeraTK-DeviceAccess
03.18.00
|
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... | |
VersionNumber & | operator= (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... | |
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.
|
inline |
Default constructor: Generate new unique version number with current time as time stamp.
Definition at line 28 of file VersionNumber.h.
|
default |
Copy constructor.
|
inlineexplicit |
Generate new unique version number with a given time stamp.
Definition at line 99 of file VersionNumber.h.
|
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.
|
inline |
Return the time stamp associated with this version number.
Definition at line 48 of file VersionNumber.h.
|
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.
|
inline |
Definition at line 57 of file VersionNumber.h.
|
inline |
Definition at line 59 of file VersionNumber.h.
|
inline |
Definition at line 61 of file VersionNumber.h.
|
default |
Copy the full state of another VersionNumber object.
|
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.
|
inline |
Definition at line 58 of file VersionNumber.h.
|
inline |
Definition at line 60 of file VersionNumber.h.
|
friend |
Stream operator passing the human readable representation to an ostream.
Definition at line 20 of file VersionNumber.cc.