SyDEVS
v0.7
Simulation-based analysis of complex systems involving people, devices, physical elements, and dynamic environments.
|
A data type which identifies an item by combining an encapsulated integer-valued index with a dimension supplied by a template parameter. More...
#include <identity.h>
Public Member Functions | |
constexpr | identity () |
Constructs an invalid identity value. More... | |
constexpr | identity (int64 index) |
Constructs an identity value with the specified index . More... | |
constexpr | identity (const identity &)=default |
Copy constructor. More... | |
identity & | operator= (const identity &)=default |
Copy assignment. More... | |
identity (identity &&)=default | |
Move constructor. More... | |
identity & | operator= (identity &&)=default |
Move assignment. More... | |
~identity ()=default | |
Destructor. More... | |
constexpr bool | valid () const |
Returns true if the identity value is valid. More... | |
constexpr int64 | index () const |
Returns the internal index. More... | |
identity & | operator++ () |
Increments (prefix) the internal index. More... | |
identity | operator++ (int) |
Increments (postfix) the internal index. More... | |
identity & | operator-- () |
Decrements (prefix) the internal index. More... | |
identity | operator-- (int) |
Decrements (postfix) the internal index. More... | |
identity & | operator+= (int64 rhs) |
Adds rhs to the identity value. More... | |
identity & | operator-= (int64 rhs) |
Subtracts rhs from the identity value. More... | |
constexpr const identity | operator+ () const |
Returns a copy of the identity value. More... | |
constexpr const identity | operator+ (int64 rhs) const |
Returns a new identity value with rhs added. More... | |
constexpr const identity | operator- (int64 rhs) const |
Returns a new identity value with rhs subtracted. More... | |
constexpr bool | operator== (identity rhs) const |
Returns true if the identity value equals rhs . More... | |
constexpr bool | operator!= (identity rhs) const |
Returns true if the identity value does not equal rhs . More... | |
constexpr bool | operator< (identity rhs) const |
Returns true if the identity value is less than rhs . More... | |
constexpr bool | operator> (identity rhs) const |
Returns true if the identity value is greater than rhs . More... | |
constexpr bool | operator<= (identity rhs) const |
Returns true if the identity value is at most rhs . More... | |
constexpr bool | operator>= (identity rhs) const |
Returns true if the identity value is at least rhs . More... | |
Static Protected Attributes | |
static constexpr int64 | nan_int64 = std::numeric_limits<int64>::min() |
A data type which identifies an item by combining an encapsulated integer-valued index with a dimension supplied by a template parameter.
An identity
value is essentially a dimensioned integer, where the units are provided by the template parameter U
. An simple example of how to instantiate an identity
value is below.
A default-constructed identity
value is invalid. For these values, the valid
member function returns false
and the index
member function returns the most negative representable 64-bit signed integer. For valid identity
values, the class supports increment and decrement operations, as well as standard plus and minus operators that offset the encapsulated index by an integer.
|
constexpr |
Constructs an invalid identity
value.
|
explicitconstexpr |
Constructs an identity
value with the specified index
.
|
constexprdefault |
Copy constructor.
|
default |
Move constructor.
|
default |
Destructor.
|
constexpr |
Returns the internal index.
|
constexpr |
Returns true
if the identity
value does not equal rhs
.
|
constexpr |
Returns a copy of the identity
value.
|
constexpr |
Returns a new identity
value with rhs
added.
identity< U > & sydevs::identity< U >::operator++ |
Increments (prefix) the internal index.
identity< U > sydevs::identity< U >::operator++ | ( | int | ) |
Increments (postfix) the internal index.
identity< U > & sydevs::identity< U >::operator+= | ( | int64 | rhs | ) |
Adds rhs
to the identity
value.
|
constexpr |
Returns a new identity
value with rhs
subtracted.
identity< U > & sydevs::identity< U >::operator-- |
Decrements (prefix) the internal index.
identity< U > sydevs::identity< U >::operator-- | ( | int | ) |
Decrements (postfix) the internal index.
identity< U > & sydevs::identity< U >::operator-= | ( | int64 | rhs | ) |
Subtracts rhs
from the identity
value.
|
constexpr |
Returns true
if the identity
value is less than rhs
.
|
constexpr |
Returns true
if the identity
value is at most rhs
.
|
default |
Copy assignment.
|
default |
Move assignment.
|
constexpr |
Returns true
if the identity
value equals rhs
.
|
constexpr |
Returns true
if the identity
value is greater than rhs
.
|
constexpr |
Returns true
if the identity
value is at least rhs
.
|
constexpr |
Returns true
if the identity
value is valid.
|
staticconstexprprotected |