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

#include <UN_Types.h>

+ Inheritance diagram for UN_DataNumber:

Public Types

enum  ValueType : ValueIntType
 
using ValueIntType = exint
 

Public Member Functions

 UN_DataNumber (ValueType value=INVALID_NUMBER)
 
void setValue (ValueType value)
 Sets the numerical value of this number. More...
 
ValueType value () const
 Returns the numerical value of this number. More...
 
 operator ValueType () const
 
bool isValid () const
 Returns true if this data number is valid; false otherwise. More...
 
 operator bool () const
 Returns true if this data number is valid; false otherwise. More...
 
bool operator== (const UN_DataNumber &other) const
 Comparison operators. More...
 
bool operator!= (const UN_DataNumber &other) const
 Comparison operators. More...
 
bool operator< (const UN_DataNumber &other) const
 Comparison operators. More...
 
bool operator<= (const UN_DataNumber &other) const
 Comparison operators. More...
 
bool operator> (const UN_DataNumber &other) const
 Comparison operators. More...
 
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 25 of file UN_Types.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 40 of file UN_Types.h.

Member Enumeration Documentation

Definition at line 41 of file UN_Types.h.

Constructor & Destructor Documentation

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 52 of file UN_Types.h.

Member Function Documentation

bool UN_DataNumber::isValid ( ) const
inline

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

Definition at line 56 of file UN_Types.h.

UN_DataNumber::operator bool ( ) const
inlineexplicit

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

Definition at line 58 of file UN_Types.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 72 of file UN_Types.h.

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

Comparison operators.

Definition at line 78 of file UN_Types.h.

UN_DataNumber& UN_DataNumber::operator++ ( )
inline

Basic arithmetic operators.

Definition at line 91 of file UN_Types.h.

UN_DataNumber UN_DataNumber::operator++ ( int  )
inline

Basic arithmetic operators.

Definition at line 96 of file UN_Types.h.

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

Comparison operators.

Definition at line 80 of file UN_Types.h.

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

Comparison operators.

Definition at line 82 of file UN_Types.h.

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

Comparison operators.

Definition at line 76 of file UN_Types.h.

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

Comparison operators.

Definition at line 84 of file UN_Types.h.

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

Comparison operators.

Definition at line 86 of file UN_Types.h.

void UN_DataNumber::setValue ( ValueType  value)
inline

Sets the numerical value of this number.

Definition at line 63 of file UN_Types.h.

ValueType UN_DataNumber::value ( ) const
inline

Returns the numerical value of this number.

Definition at line 67 of file UN_Types.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 105 of file UN_Types.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 47 of file UN_Types.h.


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