CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
OdRxValue Class Reference

#include <RxValue.h>

Public Member Functions

 OdRxValue () throw ()
 
 OdRxValue (const OdRxValue &rhs) throw ()
 
 OdRxValue (const OdRxValueType &type, const OdRxValue &value) throw ()
 
const OdRxValueoperator= (const OdRxValue &rhs) throw ()
 
 ~OdRxValue () throw ()
 
const OdRxValueTypetype () const throw ()
 
bool isEmpty () const throw ()
 
bool isVaries () const throw ()
 
OdString toString (OdRxValueType::StringFormat format=OdRxValueType::kStringFormatGlobal) const throw ()
 
bool operator== (const OdRxValue &value) const throw ()
 
bool operator!= (const OdRxValue &value) const throw ()
 
const OdAnsiString typePath () const
 
template<typename ValueType >
 OdRxValue (const ValueType &value) throw ()
 
template<typename ValueType >
OdRxValueoperator= (const ValueType &rhs) throw ()
 
const OdRxEnumTaggetEnumTag () const throw ()
 
size_t serializeOut (void *pBytes, size_t &maxBytesToWrite) const
 
size_t serializeIn (const void *pBytes, size_t maxBytesToRead)
 
template<typename ValueType >
void operator<< (const ValueType &val)
 
template<typename ValueType >
bool operator>> (ValueType &val) const
 
template<>
 OdRxValue (const OdChar *const &) throw ()
 
template<>
 OdRxValue (const char *const &) throw ()
 

Static Public Member Functions

static const OdRxValueempty () throw ()
 
static const OdRxValuevaries () throw ()
 
static const OdRxValueunbox (const OdRxObject *pO) throw ()
 
static OdRxValueunbox (OdRxObject *pO) throw ()
 

Friends

template<typename ValueType >
ValueType * rxvalue_cast (OdRxValue *value) throw ()
 
template<typename ValueType >
ValueType * rxenum_cast (OdRxValue *value) throw ()
 
template<typename ValueType >
const ValueType * rxvalue_cast (const OdRxValue *value) throw ()
 
template<typename ValueType >
const ValueType * rxenum_cast (const OdRxValue *value) throw ()
 

Detailed Description

<group OdRx_Classes>

Generic variant type. Can contain any C++ type. Contained type is described by OdRxValueType.

Definition at line 88 of file RxValue.h.

Constructor & Destructor Documentation

◆ OdRxValue() [1/6]

OdRxValue::OdRxValue ( )
throw (
)
inline

Default constructor. Creates an OdRxValue instance.

Definition at line 94 of file RxValue.h.

◆ OdRxValue() [2/6]

OdRxValue::OdRxValue ( const OdRxValue rhs)
throw (
)
inline

Copy constructor for objects of the OdRxValue class. Clones an existing instance of the OdRxValue class.

Parameters
rhs[in] Object of the OdRxValue class to be cloned.

Definition at line 105 of file RxValue.h.

◆ OdRxValue() [3/6]

OdRxValue::OdRxValue ( const OdRxValueType type,
const OdRxValue value 
)
throw (
)
inline

Constructor for objects of the OdRxValue class. Creates an OdRxValue object with the specified type and value. Source value should be compatible with the target type, e.g. enumeration can be constructed from integer (like reinterpret_cast<> for underlying C++ type).

Parameters
type[in] Value type of the object to be created.
value[in] Value to be assigned to the created object.

Definition at line 119 of file RxValue.h.

◆ ~OdRxValue()

OdRxValue::~OdRxValue ( )
throw (
)
inline

Destroys objects of the OdRxValue class.

Definition at line 171 of file RxValue.h.

◆ OdRxValue() [4/6]

template<typename ValueType >
OdRxValue::OdRxValue ( const ValueType &  value)
throw (
)
inline

This constructor can be used for blittable (POD) types. For non-blittable types specialization should be declared.

Parameters
value[in] Value type for the constructed value object.

Definition at line 289 of file RxValue.h.

◆ OdRxValue() [5/6]

template<>
OdRxValue::OdRxValue ( const OdChar *const &  )
throw (
)

◆ OdRxValue() [6/6]

template<>
OdRxValue::OdRxValue ( const char *const &  )
throw (
)

Member Function Documentation

◆ empty()

static const OdRxValue & OdRxValue::empty ( )
throw (
)
static

Returns canonical empty value.

Returns
Canonical empty value.

◆ getEnumTag()

const OdRxEnumTag * OdRxValue::getEnumTag ( ) const
throw (
)

Gets the corresponding descriptor, if this value contains an enumeration item.

Returns
Enumeration item descriptor.

◆ isEmpty()

bool OdRxValue::isEmpty ( ) const
throw (
)
inline

Checks if the value is empty.

Returns
true if the value is empty; false otherwise.

Definition at line 198 of file RxValue.h.

◆ isVaries()

bool OdRxValue::isVaries ( ) const
throw (
)
inline

Checks whether the value is undefined. This is represented by assigning a special singleton value "varies".

Returns
true if the value is undefined; false otherwise.

Definition at line 215 of file RxValue.h.

◆ operator!=()

bool OdRxValue::operator!= ( const OdRxValue value) const
throw (
)
inline

Negative comparison operator.

Parameters
value[in] Value to compare with the current value.
Returns
true if values are not equal; false otherwise.

Definition at line 264 of file RxValue.h.

◆ operator<<()

template<typename ValueType >
void OdRxValue::operator<< ( const ValueType &  val)
inline

Assignment operator. Assigns a value from a C++ variable to this value.

Parameters
val[in] Value type of the corresponding C++ type to be assigned to this value.

Definition at line 433 of file RxValue.h.

◆ operator=() [1/2]

const OdRxValue & OdRxValue::operator= ( const OdRxValue rhs)
throw (
)
inline

Assignment operator.

Parameters
rhs[in] Value to be assigned.

Definition at line 129 of file RxValue.h.

◆ operator=() [2/2]

template<typename ValueType >
OdRxValue & OdRxValue::operator= ( const ValueType &  rhs)
throw (
)
inline

This assignment operator can be optionally specialized.

Parameters
rhs[in] Value type to be assigned to this value.
Returns
This value.

Definition at line 339 of file RxValue.h.

◆ operator==()

bool OdRxValue::operator== ( const OdRxValue value) const
throw (
)
inline

Comparison operator.

Parameters
value[in] Value to compare with the current value.
Returns
true if values are equal; false otherwise.

Definition at line 249 of file RxValue.h.

◆ operator>>()

template<typename ValueType >
bool OdRxValue::operator>> ( ValueType &  val) const
inline

Outputs this value to a C++ variable. Unlike rxvalue_cast<>, it takes into account type propagations supported by type().toValueType or OdRxValueType::Desc<ValueType>::value().fromValueType.

Parameters
val[out] Value type of the corresponding C++ type.
Returns
true if the operation was successful; false otherwise.

Definition at line 449 of file RxValue.h.

◆ serializeIn()

size_t OdRxValue::serializeIn ( const void pBytes,
size_t  maxBytesToRead 
)

Reads the value from the byte array.

Parameters
pBytes[out] Pointer to the byte array.
maxBytesToRead[in] Maximum number of the bytes to read.
Returns
Actual number of the bytes read.

◆ serializeOut()

size_t OdRxValue::serializeOut ( void pBytes,
size_t &  maxBytesToWrite 
) const

Stores the value in the byte array.

Parameters
pBytes[out] Pointer to the byte array.
maxBytesToWrite[in] Maximum number of the bytes to write.
Returns
Actual number of the bytes written.

◆ toString()

OdString OdRxValue::toString ( OdRxValueType::StringFormat  format = OdRxValueType::kStringFormatGlobal) const
throw (
)
inline

Converts the value to a string.

Parameters
format[in] Defines the format of the resulting string.
Returns
Converted value.
Remarks
Mostly for debug purposes.

Definition at line 236 of file RxValue.h.

◆ type()

const OdRxValueType & OdRxValue::type ( ) const
throw (
)
inline

Gets the metaclass describing the C++ type of the stored value.

Returns
Metaclass describing the C++ type of the stored value.

Definition at line 187 of file RxValue.h.

◆ typePath()

const OdAnsiString OdRxValue::typePath ( ) const
inline

Retreives an ANSI string in format of path that elaborates the sense of value of the value type. Can be interpreted additionally when working with RxValue.

Returns
ANSI string with clarification of value sense.

Definition at line 277 of file RxValue.h.

◆ unbox() [1/2]

static const OdRxValue * OdRxValue::unbox ( const OdRxObject pO)
throw (
)
static

Unwraps RxValue contained in OdRxBoxedValue.

Parameters
pO[in] OdRxBoxedValue to be unboxed.
Returns
Unwrapped value.

◆ unbox() [2/2]

static OdRxValue * OdRxValue::unbox ( OdRxObject pO)
throw (
)
static

Unwraps RxValue contained in OdRxBoxedValue.

Parameters
pO[in] OdRxBoxedValue to be unboxed.
Returns
Unwrapped value.

◆ varies()

static const OdRxValue & OdRxValue::varies ( )
throw (
)
static

Returns singleton, representing undefined value.

Returns
Singleton, representing undefined value.

Friends And Related Function Documentation

◆ rxenum_cast [1/2]

template<typename ValueType >
const ValueType * rxenum_cast ( const OdRxValue value)
throw (
)
friend

Constant correct safe cast for enumerations. Returns non-null only if ValueType is contained in this value.

Parameters
value[in] Value to be casted.
Returns
Value type if it is contained in value; NULL otherwise.

Const correct safe cast for enumerations. Returns non-NULL only if ValueType is contained in this value.

Parameters
value[in] Enumeration value which to cast a value type from.
Returns
Value type if ValueType is contained in the specified enumeration value. NULL otherwise.

Definition at line 370 of file RxValue.h.

◆ rxenum_cast [2/2]

template<typename ValueType >
ValueType * rxenum_cast ( OdRxValue value)
throw (
)
friend

Safe cast for enumerations. Returns non-null only if ValueType is contained in this value.

Parameters
value[in] Value to be casted.
Returns
Value type if it is contained in value; NULL otherwise.

Safe cast for enumerations. Returns non-NULL only if ValueType is contained in this value.

Parameters
value[in] Enumeration value which to cast a value type from.
Returns
Value type if ValueType is contained in the specified enumeration value. NULL otherwise.

Definition at line 322 of file RxValue.h.

◆ rxvalue_cast [1/2]

template<typename ValueType >
const ValueType * rxvalue_cast ( const OdRxValue value)
throw (
)
friend

Constant correct safe cast version. Returns non-null only if ValueType is contained in this value.

Parameters
value[in] Value to be casted.
Returns
Value type if it is contained in value; NULL otherwise.

Const correct safe cast. Returns non-NULL only if ValueType is contained in this value.

Parameters
value[in] Value which to cast a value type from.
Returns
Value type if ValueType is contained in the specified value. NULL otherwise.

Definition at line 355 of file RxValue.h.

◆ rxvalue_cast [2/2]

template<typename ValueType >
ValueType * rxvalue_cast ( OdRxValue value)
throw (
)
friend

Safe cast to the contained C++ type. Returns non-null only if ValueType is contained in this value.

Parameters
value[in] Value to be casted.
Returns
Value type if it is contained in value; NULL otherwise.

Safe cast. Returns non-NULL only if ValueType is contained in this value.

Parameters
value[in] Value which to cast a value type from.
Returns
Value type if ValueType is contained in the specified value. NULL otherwise.

Definition at line 307 of file RxValue.h.


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