Wallaroo  0.8
Public Member Functions | List of all members
wallaroo::Attribute< T > Class Template Reference

#include <attribute.h>

Inheritance diagram for wallaroo::Attribute< T >:
wallaroo::DeserializableValue

Public Member Functions

 Attribute (const std::string &name, const RegToken &token)
 
virtual void Value (const std::string &v)
 
 operator T ()
 
 operator T () const
 
const char * c_str () const
 
Attributeoperator= (const Attribute &a)
 
Attributeoperator= (const T &v)
 
Attributeoperator++ ()
 
operator++ (int)
 
Attributeoperator-- ()
 
operator-- (int)
 
Attributeoperator+= (const T &rhs)
 
Attributeoperator-= (const T &rhs)
 
Attributeoperator*= (const T &rhs)
 
Attributeoperator/= (const T &rhs)
 
- Public Member Functions inherited from wallaroo::DeserializableValue
virtual ~DeserializableValue ()
 

Detailed Description

template<typename T>
class wallaroo::Attribute< T >

This is an attribute of a part. An attribute has a type T and you can set its value at runtime by code or from a configuration file.

You can put an Attribute inside your part and read its value and use it as if it were of type T.

Template Parameters
TThe type of the value contained

Constructor & Destructor Documentation

template<typename T>
wallaroo::Attribute< T >::Attribute ( const std::string &  name,
const RegToken token 
)
inline

Create a Attribute and register it to its part so that you can assign a value to it.

Parameters
namethe name of this attribute
tokenthe registration token. You get an instance by calling Part::RegistrationToken()

Member Function Documentation

template<typename T>
const char* wallaroo::Attribute< T >::c_str ( ) const
inline

Conversion to C style string. It is available only when T is a std::string.

Returns
the internal representation of the string as a C style const string
template<typename T>
wallaroo::Attribute< T >::operator T ( )
inline

Conversion operator to the internal type T. Retrieve the internal value. Non const version.

template<typename T>
wallaroo::Attribute< T >::operator T ( ) const
inline

Conversion operator to the internal type T. Retrieve the internal value. Const version.

template<typename T>
Attribute& wallaroo::Attribute< T >::operator*= ( const T &  rhs)
inline
template<typename T>
Attribute& wallaroo::Attribute< T >::operator++ ( )
inline
template<typename T>
T wallaroo::Attribute< T >::operator++ ( int  )
inline
template<typename T>
Attribute& wallaroo::Attribute< T >::operator+= ( const T &  rhs)
inline
template<typename T>
Attribute& wallaroo::Attribute< T >::operator-- ( )
inline
template<typename T>
T wallaroo::Attribute< T >::operator-- ( int  )
inline
template<typename T>
Attribute& wallaroo::Attribute< T >::operator-= ( const T &  rhs)
inline
template<typename T>
Attribute& wallaroo::Attribute< T >::operator/= ( const T &  rhs)
inline
template<typename T>
Attribute& wallaroo::Attribute< T >::operator= ( const Attribute< T > &  a)
inline
template<typename T>
Attribute& wallaroo::Attribute< T >::operator= ( const T &  v)
inline
template<typename T>
virtual void wallaroo::Attribute< T >::Value ( const std::string &  v)
inlinevirtual

Assign a value to the Attribute using a string as representation

Parameters
vthe string representation of the value
Exceptions
WrongTypeif v cannot be converted to T

Implements wallaroo::DeserializableValue.


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