ConstDataPtr Class Reference

#include <datatypebase.h>

Inheritance diagram for ConstDataPtr:

Detailed Description

ConstDataPtr contains type info and a pointer to an arbitrary generic const object. The type of the object is only known at run-time.

Classes

class  Wrapper
 
class  Wrapper< T, typename std::enable_if< GetCollectionKind< T >::value==COLLECTION_KIND::ARRAY >::type >
 

Public Member Functions

 ConstDataPtr ()=default
 
 ConstDataPtr (const Data &value)
 
 ConstDataPtr (const DataType &typeInfo, const Generic *dataPtr)
 
template<typename T >
 ConstDataPtr (const T &value)
 
Bool IsEmpty () const
 
Bool IsPopulated () const
 
const DataTypeGetType () const
 
DataType && ResetType ()
 
const Generic * PrivateGetPtr () const
 
void Set (const DataType &typeInfo, const Generic *dataPtr)
 
template<typename T >
void Set (const T &value)
 
void Set (const Data &value)
 
void Set (Data &value)
 
void Set (Data &&value)
 
const Generic * GetPtr (const DataType &type) const
 
template<typename T >
const T * GetPtr () const
 
template<typename T >
Result< typename std::conditional< STD_IS_REPLACEMENT(same, T, Data)||(GetCollectionKind< T >::value==COLLECTION_KIND::ARRAY), T, typename ByValueParam< T >::type >::type > Get () const
 
template<typename T >
ByValueParam< T >::type GetOrDefault () const
 
template<typename T >
MAXON_ATTRIBUTE_FORCE_INLINE ByValueParam< T >::type GetOrNull () const
 
template<typename T >
ByValueParam< T >::type Get (const T &defaultValue) const
 
COMPARERESULT Compare (const ConstDataPtr &c) const
 
COMPARERESULT Compare (const Data &c) const
 
HashInt GetHashCode () const
 
UniqueHash GetUniqueHashCode () const
 
Bool operator== (const ConstDataPtr &c) const
 
Bool operator== (const Data &c) const
 
Bool operator!= (const ConstDataPtr &c) const
 
Bool operator!= (const Data &other) const
 
Bool operator< (const ConstDataPtr &c) const
 
Bool operator<= (const ConstDataPtr &c) const
 
Bool operator> (const ConstDataPtr &c) const
 
Bool operator>= (const ConstDataPtr &c) const
 
String ToString (const FormatStatement *formatStatement=nullptr) const
 
template<>
Result< void > Get () const
 
template<>
Result< DataGet () const
 

Static Public Member Functions

static MAXON_ATTRIBUTE_FORCE_INLINE const ConstDataPtrDefaultValue ()
 

Protected Member Functions

template<typename T >
Result< typename ByValueParam< T >::type > GetImpl (OverloadRank0) const
 
template<typename T >
std::enable_if< GetCollectionKind< T >::value==COLLECTION_KIND::ARRAY, Result< T > >::type GetImpl (OverloadRank1) const
 

Protected Attributes

DataType _typeInfo
 
const Generic * _dataPtr
 

Friends

struct ViewIteratorMember
 
class ContainerViewTypeImpl
 

Constructor & Destructor Documentation

◆ ConstDataPtr() [1/4]

ConstDataPtr ( )
default

◆ ConstDataPtr() [2/4]

ConstDataPtr ( const Data value)
explicit

◆ ConstDataPtr() [3/4]

ConstDataPtr ( const DataType typeInfo,
const Generic *  dataPtr 
)

◆ ConstDataPtr() [4/4]

ConstDataPtr ( const T &  value)
explicit

Member Function Documentation

◆ IsEmpty()

Bool IsEmpty ( ) const

◆ IsPopulated()

Bool IsPopulated ( ) const

◆ GetType()

const DataType& GetType ( ) const

◆ ResetType()

DataType&& ResetType ( )

◆ PrivateGetPtr()

const Generic* PrivateGetPtr ( ) const

◆ Set() [1/4]

void Set ( const DataType typeInfo,
const Generic *  dataPtr 
)

◆ Set() [2/4]

void Set ( const Data value)

◆ Set() [3/4]

void Set ( Data value)

◆ Set() [4/4]

void Set ( Data &&  value)

◆ GetPtr() [1/2]

const Generic* GetPtr ( const DataType type) const

◆ GetPtr() [2/2]

const T* GetPtr ( ) const

◆ Get() [1/3]

Result<typename std::conditional<STD_IS_REPLACEMENT(same, T, Data) || (GetCollectionKind<T>::value == COLLECTION_KIND::ARRAY), T, typename ByValueParam<T>::type>::type> Get ( ) const

Returns the value of type T of this Data. if <void> or <Data> is given the result value is not a reference.

Template Parameters
TThe expected type of the value.
Returns
The value stored in this Data, or an error if this Data doesn't store a value of type T.

◆ GetOrDefault()

ByValueParam<T>::type GetOrDefault ( ) const

◆ GetOrNull()

MAXON_ATTRIBUTE_FORCE_INLINE ByValueParam<T>::type GetOrNull ( ) const

◆ Get() [2/3]

ByValueParam<T>::type Get ( const T &  defaultValue) const

◆ Compare() [1/2]

COMPARERESULT Compare ( const ConstDataPtr c) const

Compares this object to a ConstDataPtr.

Parameters
[in]cOther object.
Returns
See COMPARERESULT.

◆ Compare() [2/2]

COMPARERESULT Compare ( const Data c) const

Compares this instance to c and returns the comparison result.

This largely does not support type abstraction, i.e., you cannot compare an int with a float and expect a result such as GREATER or EQUAL in a mathematical sense. When both entities are not of the same type, ObjectInterface reference entities are treated as greater than all other types. When both entities are not ObjectInterface types, the entities will be sorted by their type id.

Parameters
[in]cOther object.
Returns
See COMPARERESULT.

◆ GetHashCode()

HashInt GetHashCode ( ) const

Returns the hash code of the wrapped value. If the value's type doesn't provide a hash code function, this function returns DefaultHasher::EMPTY_HASH.

◆ GetUniqueHashCode()

UniqueHash GetUniqueHashCode ( ) const

Returns the hash code of the wrapped value. If the value's type doesn't provide a hash code function, this function returns a default-constructed UniqueHash.

◆ operator==() [1/2]

Bool operator== ( const ConstDataPtr c) const

◆ operator==() [2/2]

Bool operator== ( const Data c) const

◆ operator!=() [1/2]

Bool operator!= ( const ConstDataPtr c) const

◆ operator!=() [2/2]

Bool operator!= ( const Data other) const

◆ operator<()

Bool operator< ( const ConstDataPtr c) const

◆ operator<=()

Bool operator<= ( const ConstDataPtr c) const

◆ operator>()

Bool operator> ( const ConstDataPtr c) const

◆ operator>=()

Bool operator>= ( const ConstDataPtr c) const

◆ DefaultValue()

static MAXON_ATTRIBUTE_FORCE_INLINE const ConstDataPtr& DefaultValue ( )
static

◆ ToString()

String ToString ( const FormatStatement formatStatement = nullptr) const

◆ GetImpl() [1/2]

Result<typename ByValueParam<T>::type> GetImpl ( OverloadRank0  ) const
protected

◆ GetImpl() [2/2]

std::enable_if< GetCollectionKind< T >::value==COLLECTION_KIND::ARRAY, Result< T > >::type GetImpl ( OverloadRank1  ) const
protected

◆ Get() [3/3]

Result<Data> Get ( ) const

Friends And Related Function Documentation

◆ ViewIteratorMember

friend struct ViewIteratorMember
friend

◆ ContainerViewTypeImpl

friend class ContainerViewTypeImpl
friend

Member Data Documentation

◆ _typeInfo

DataType _typeInfo
protected

◆ _dataPtr

const Generic* _dataPtr
protected