HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UN_DataNumber Class Reference

#include <UN_Include.h>

+ Inheritance diagram for UN_DataNumber:

Public Types

enum  ValueType : ValueIntType
 
using ValueIntType = exint
 

Public Member Functions

constexpr UN_DataNumber (ValueType value=INVALID_NUMBER)
 
void setValue (ValueType value)
 Sets the numerical value of this number. More...
 
constexpr ValueType value () const
 Returns the numerical value of this number. More...
 
 operator ValueType () const
 
constexpr exint exintValue () const
 Returns an exint value of this number. More...
 
constexpr bool isValid () const
 Returns true if this data number is valid; false otherwise. More...
 
constexpr operator bool () const
 Returns true if this data number is valid; false otherwise. More...
 
constexpr bool operator== (const UN_DataNumber &other) const
 Comparison operators. More...
 
constexpr bool operator!= (const UN_DataNumber &other) const
 Comparison operators. More...
 
constexpr bool operator< (const UN_DataNumber &other) const
 Comparison operators. More...
 
constexpr bool operator<= (const UN_DataNumber &other) const
 Comparison operators. More...
 
constexpr bool operator> (const UN_DataNumber &other) const
 Comparison operators. More...
 
constexpr bool operator>= (const UN_DataNumber &other) const
 Comparison operators. More...
 
UN_DataNumberoperator++ ()
 Basic arithmetic operators. More...
 
UN_DataNumber operator++ (int)
 Basic arithmetic operators. More...
 

Static Public Attributes

static constexpr ValueType INVALID_NUMBER = ValueType(-1)
 

Friends

size_t hash_value (const UN_DataNumber &data_number)
 Hash function for use of UN_DataNumber as a key in the UT_Map class. More...
 

Detailed Description

Definition at line 26 of file UN_Include.h.

Member Typedef Documentation

A numerical value for indexing into data containers and for unique IDs to validate of data objects.

An enum class ValueType and UN_DataNumber should be interchangeable. UN_DataNumber really just provides methods to operate on it and the ability to "derive" from it. In particular, it should be possible to implicitly cast ValueType to UN_DataNumber class type. It should be possible to implicitly cast this UN_DataNumber class type to ValueType since it is an enum class, and therefore not implicitly castable to other types such as exint or int (and therefore deemed "safe" without the risk of data narrowing).

Definition at line 41 of file UN_Include.h.

Member Enumeration Documentation

Definition at line 42 of file UN_Include.h.

Constructor & Destructor Documentation

constexpr UN_DataNumber::UN_DataNumber ( ValueType  value = INVALID_NUMBER)
inline

A constructor for the data number. Note, this is not an explicit constructor to allow asting from ValueType to UN_DataNumber. See comment for ValueType definition.

Definition at line 53 of file UN_Include.h.

Member Function Documentation

constexpr exint UN_DataNumber::exintValue ( ) const
inline

Returns an exint value of this number.

Definition at line 77 of file UN_Include.h.

constexpr bool UN_DataNumber::isValid ( ) const
inline

Returns true if this data number is valid; false otherwise.

Definition at line 57 of file UN_Include.h.

constexpr UN_DataNumber::operator bool ( ) const
inlineexplicit

Returns true if this data number is valid; false otherwise.

Definition at line 59 of file UN_Include.h.

UN_DataNumber::operator ValueType ( ) const
inline

Implicit cast to ValueType since it is an enum class. See the comment for ValueType definition.

Definition at line 73 of file UN_Include.h.

constexpr bool UN_DataNumber::operator!= ( const UN_DataNumber other) const
inline

Comparison operators.

Definition at line 88 of file UN_Include.h.

UN_DataNumber& UN_DataNumber::operator++ ( )
inline

Basic arithmetic operators.

Definition at line 101 of file UN_Include.h.

UN_DataNumber UN_DataNumber::operator++ ( int  )
inline

Basic arithmetic operators.

Definition at line 106 of file UN_Include.h.

constexpr bool UN_DataNumber::operator< ( const UN_DataNumber other) const
inline

Comparison operators.

Definition at line 90 of file UN_Include.h.

constexpr bool UN_DataNumber::operator<= ( const UN_DataNumber other) const
inline

Comparison operators.

Definition at line 92 of file UN_Include.h.

constexpr bool UN_DataNumber::operator== ( const UN_DataNumber other) const
inline

Comparison operators.

Definition at line 86 of file UN_Include.h.

constexpr bool UN_DataNumber::operator> ( const UN_DataNumber other) const
inline

Comparison operators.

Definition at line 94 of file UN_Include.h.

constexpr bool UN_DataNumber::operator>= ( const UN_DataNumber other) const
inline

Comparison operators.

Definition at line 96 of file UN_Include.h.

void UN_DataNumber::setValue ( ValueType  value)
inline

Sets the numerical value of this number.

Definition at line 64 of file UN_Include.h.

constexpr ValueType UN_DataNumber::value ( ) const
inline

Returns the numerical value of this number.

Definition at line 68 of file UN_Include.h.

Friends And Related Function Documentation

size_t hash_value ( const UN_DataNumber data_number)
friend

Hash function for use of UN_DataNumber as a key in the UT_Map class.

Definition at line 115 of file UN_Include.h.

Member Data Documentation

constexpr ValueType UN_DataNumber::INVALID_NUMBER = ValueType(-1)
static

A numerical value for an invalid data object number. It is used in initialization to denote a non-existent, invalid, or an unknown data object. The value of -1 is consistent in its use as an index into data arrays.

Definition at line 48 of file UN_Include.h.


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