OpenWalnut  1.4.0
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
WItemSelectionItemTyped< T > Class Template Reference

A derivation of WItemSelection which can store a value of any type. More...

#include <WItemSelectionItemTyped.h>

+ Inheritance diagram for WItemSelectionItemTyped< T >:

List of all members.

Public Types

typedef boost::shared_ptr
< WItemSelectionItemTyped< T > > 
SPtr
 Abbreviation for a shared pointer.
typedef boost::shared_ptr
< const
WItemSelectionItemTyped< T > > 
ConstSPtr
 Abbreviation for a const shared pointer.
typedef T ValueType
 The type of the value stored in here.

Public Member Functions

 WItemSelectionItemTyped (T value, std::string name, std::string description="", const char **icon=NULL)
 Constructs a new item with the specified values.
virtual ~WItemSelectionItemTyped ()
 Destruction.
const T getValue () const
 Returns the value.
getValue ()
 Returns the value.
void setValue (T value)
 Sets a new value, which is associated with this item.

Static Public Member Functions

static SPtr create (T value, std::string name, std::string description="", const char **icon=NULL)
 Create a instance of the item.

Private Attributes

m_value
 Value which is stored by this item.

Detailed Description

template<typename T>
class WItemSelectionItemTyped< T >

A derivation of WItemSelection which can store a value of any type.

Notes:
you can specify a reference type too. When using MyType& as type in this class, you can avoid unnecessary copy operations.
Template Parameters:
thetype to encapsulate

Definition at line 43 of file WItemSelectionItemTyped.h.


Member Typedef Documentation

template<typename T >
typedef boost::shared_ptr< const WItemSelectionItemTyped< T > > WItemSelectionItemTyped< T >::ConstSPtr

Abbreviation for a const shared pointer.

Reimplemented from WItemSelectionItem.

Definition at line 54 of file WItemSelectionItemTyped.h.

template<typename T >
typedef boost::shared_ptr< WItemSelectionItemTyped< T > > WItemSelectionItemTyped< T >::SPtr

Abbreviation for a shared pointer.

Reimplemented from WItemSelectionItem.

Definition at line 49 of file WItemSelectionItemTyped.h.

template<typename T >
typedef T WItemSelectionItemTyped< T >::ValueType

The type of the value stored in here.

Definition at line 59 of file WItemSelectionItemTyped.h.


Constructor & Destructor Documentation

template<typename T >
WItemSelectionItemTyped< T >::WItemSelectionItemTyped ( value,
std::string  name,
std::string  description = "",
const char **  icon = NULL 
) [inline]

Constructs a new item with the specified values.

Parameters:
valueValue which is stored by the item.
nameName of item.
descriptionDescription, can be empty.
iconIcon, can be NULL.

Definition at line 69 of file WItemSelectionItemTyped.h.

template<typename T >
virtual WItemSelectionItemTyped< T >::~WItemSelectionItemTyped ( ) [inline, virtual]

Destruction.

Does NOT delete the icon!

Definition at line 78 of file WItemSelectionItemTyped.h.


Member Function Documentation

template<typename T >
static SPtr WItemSelectionItemTyped< T >::create ( value,
std::string  name,
std::string  description = "",
const char **  icon = NULL 
) [inline, static]

Create a instance of the item.

This shortens the rather long call which would be needed to create a shared pointer of this class.

Parameters:
valuethe value to store in the instance
namethe name of item
descriptionDescription of the item. Can be empty.
iconthe icon of the item. Can be NULL.
Returns:
a new instance pointer

Definition at line 92 of file WItemSelectionItemTyped.h.

template<typename T >
const T WItemSelectionItemTyped< T >::getValue ( ) const [inline]

Returns the value.

This const version is especially useful when using reference types for T.

Returns:
Value which is stored.

Definition at line 102 of file WItemSelectionItemTyped.h.

References WItemSelectionItemTyped< T >::m_value.

template<typename T >
T WItemSelectionItemTyped< T >::getValue ( ) [inline]

Returns the value.

Returns:
Value which is stored.

Definition at line 112 of file WItemSelectionItemTyped.h.

References WItemSelectionItemTyped< T >::m_value.

template<typename T >
void WItemSelectionItemTyped< T >::setValue ( value) [inline]

Sets a new value, which is associated with this item.

Parameters:
valuenew value which should be stored by this item.

Definition at line 122 of file WItemSelectionItemTyped.h.

References WItemSelectionItemTyped< T >::m_value.


Member Data Documentation

template<typename T >
T WItemSelectionItemTyped< T >::m_value [private]

Value which is stored by this item.

Definition at line 131 of file WItemSelectionItemTyped.h.

Referenced by WItemSelectionItemTyped< T >::getValue(), and WItemSelectionItemTyped< T >::setValue().


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