UHD 003.001.000
Public Member Functions

wax::obj Class Reference

#include <wax.hpp>

Inheritance diagram for wax::obj:
uhd::device

List of all members.

Public Member Functions

 obj (void)
 obj (const obj &o)
template<class T >
 obj (const T &o)
virtual ~obj (void)
obj operator[] (const obj &key)
objoperator= (const obj &val)
obj get_link (void) const
const std::type_info & type (void) const
template<class T >
as (void) const

Detailed Description

WAX object base class:

A wax obj has two major purposes: 1) to act as a polymorphic container, just like boost any 2) to provide a nested set/get properties interface

Internally, the polymorphic container is handled by a boost any. For properties, a subclass should override the set and get methods. For property nesting, wax obj subclasses return special links to other wax obj subclasses, and the api handles the magic.


Constructor & Destructor Documentation

wax::obj::obj ( void  )

Default constructor: The contents will be empty.

wax::obj::obj ( const obj o)

Copy constructor: The contents will be cloned.

Parameters:
oanother wax::obj
template<class T >
wax::obj::obj ( const T &  o) [inline]

Templated any type constructor: The contents can be anything. Uses the boost::any to handle the magic.

Parameters:
oan object of any type
virtual wax::obj::~obj ( void  ) [virtual]

Destructor.


Member Function Documentation

template<class T >
T wax::obj::as ( void  ) const [inline]

Cast this obj into the desired type. Usage: myobj.as<type>()

Returns:
an object of the desired type
Exceptions:
wax::bad_castwhen the cast fails
obj wax::obj::get_link ( void  ) const

Get a link in the chain: When a wax obj returns another wax obj as part of a get call, the return value should be set to the result of this method. Doing so will ensure chain-ability of the returned object.

Returns:
an obj containing a valid link to a wax obj
obj& wax::obj::operator= ( const obj val)

The assignment operator: This operator allows for assignment of new contents. In the special case where this obj contains a proxy, the value will be set to the proxy's property reference.

Parameters:
valthe new value to assign to the wax obj
Returns:
a reference to this obj (*this)
obj wax::obj::operator[] ( const obj key)

The chaining operator: This operator allows access objs with properties. A call to the [] operator will return a new proxy obj. The proxy object is an obj with special proxy contents. Assignment and casting can be used on this special object to access the property referenced by the obj key.

Parameters:
keya key to identify a property within this obj
Returns:
a special wax obj that proxies the obj and key
const std::type_info& wax::obj::type ( void  ) const

Get the type of the contents of this obj.

Returns:
a reference to the type_info

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines