Om  1.0.0
A universal framework for multimedia simulation
Classes | Public Member Functions | List of all members
om::lang::Any Class Reference

A class that is able to store and retrieve a value of any arbitrary type in an opaque manner. More...

#include <omAny.h>

Public Member Functions

 Any ()
 Create an Any object that has a NULL value. More...
 
template<typename T >
 Any (const T &value)
 Create an Any object that stores a copy of the specified templated type. More...
 
 Any (const Any &other)
 Make a deep copy of the specified Any object, copying its internal value. More...
 
Anyoperator= (const Any &other)
 Copy the value from another Any object into this Any, replacing the current value. More...
 
 ~Any ()
 Destroy an Any object and deallocate its internal storage. More...
 
template<typename T >
Bool getValue (T &output) const
 Access this Any's value and place it in the output parameter. More...
 
template<typename T >
void setValue (const T &newValue)
 Set this Any object to have a new value. More...
 
template<typename T >
T * getPointer ()
 Return a pointer to the value stored by this Any object. More...
 
template<typename T >
const T * getPointer () const
 Return a const pointer to the value stored by this Any object. More...
 
Bool operator== (const Any &other) const
 Compare this Any object to another for equality. More...
 
Bool operator!= (const Any &other) const
 Compare this Any object to another for inequality. More...
 
Bool isNull () const
 Return whether or not this Any object's internal value is NULL. More...
 
Bool isSet () const
 Get whether or not this Any object's internal value is not NULL. More...
 

Detailed Description

A class that is able to store and retrieve a value of any arbitrary type in an opaque manner.

Constructor & Destructor Documentation

om::lang::Any::Any ( )
inline

Create an Any object that has a NULL value.

template<typename T >
om::lang::Any::Any ( const T &  value)
inline

Create an Any object that stores a copy of the specified templated type.

om::lang::Any::Any ( const Any other)
inline

Make a deep copy of the specified Any object, copying its internal value.

om::lang::Any::~Any ( )
inline

Destroy an Any object and deallocate its internal storage.

Member Function Documentation

Any& om::lang::Any::operator= ( const Any other)
inline

Copy the value from another Any object into this Any, replacing the current value.

template<typename T >
Bool om::lang::Any::getValue ( T &  output) const
inline

Access this Any's value and place it in the output parameter.

If the Any object has a NULL value, or if the value's type does not match that of the output parameter, FALSE is returned and no value is retrieved. Otherwise, the method succeeds and TRUE is returned.

template<typename T >
void om::lang::Any::setValue ( const T &  newValue)
inline

Set this Any object to have a new value.

template<typename T >
T* om::lang::Any::getPointer ( )
inline

Return a pointer to the value stored by this Any object.

If the specified template type is not the same as the stored value, NULL is returned.

template<typename T >
const T* om::lang::Any::getPointer ( ) const
inline

Return a const pointer to the value stored by this Any object.

If the specified template type is not the same as the stored value, NULL is returned.

Bool om::lang::Any::operator== ( const Any other) const
inline

Compare this Any object to another for equality.

If this Any object has the same opaque type and has an equal value, the method returns TRUE. Otherwise, the method returns FALSE indicating that the objects are not equal.

Bool om::lang::Any::operator!= ( const Any other) const
inline

Compare this Any object to another for inequality.

If this Any object has a different opaque type or has an unequal value, the method returns FALSE. Otherwise, the method returns TRUE indicating that the objects are equal.

Bool om::lang::Any::isNull ( ) const
inline

Return whether or not this Any object's internal value is NULL.

Bool om::lang::Any::isSet ( ) const
inline

Get whether or not this Any object's internal value is not NULL.


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