OpenWalnut
1.4.0
|
This is a property which encapsulates a given, fixed number of other properties. More...
#include <WPropertyStruct.h>
Public Types | |
typedef WPropertyStruct < BOOST_PP_ENUM_PARAMS(10, T) > | WPropertyStructType |
The type of this template instantiation. | |
typedef boost::shared_ptr < WPropertyStructType > | SPtr |
Convenience typedef for a boost::shared_ptr< WPropertyStructType > | |
typedef boost::shared_ptr < const WPropertyStructType > | ConstSPtr |
Convenience typedef for a boost::shared_ptr< const WPropertyStructType > | |
typedef WPropertyStructHelper::AsVector < BOOST_PP_ENUM_PARAMS(10, T) > ::type | TypeVector |
The boost mpl vector for all the types specified. | |
typedef WPropertyStructHelper::SequenceToTuple < TypeVector >::type | TupleType |
The type vector as a boost tuple. | |
Public Member Functions | |
WPropertyStruct (std::string name, std::string description) | |
Create an empty named property. | |
WPropertyStruct (const WPropertyStructType &from) | |
Copy constructor. | |
virtual | ~WPropertyStruct () |
Destructor. | |
template<int N> | |
boost::mpl::at< TypeVector, boost::mpl::size_t< N > >::type | getProperty () |
Get the N'th property in the struct. | |
template<int N> | |
boost::mpl::at< TypeVector, boost::mpl::size_t< N > >::type::element_type::ConstSPtr | getProperty () const |
Get the N'th property in the struct. | |
const WPropertyBase::SPtr & | getProperty (size_t n) const |
Returns the property with the given number, but only as base type. | |
WPropertyBase::SPtr | getProperty (size_t n) |
Returns the property with the given number, but only as base type. | |
size_t | size () const |
The size of the WPropertyStruct. | |
virtual WPropertyBase::SPtr | clone () |
This method clones a property and returns the clone. | |
virtual PROPERTY_TYPE | getType () const |
Gets the real WPropertyVariable type of this instance. | |
virtual bool | setAsString (std::string value) |
This methods allows properties to be set by a string value. | |
virtual std::string | getAsString () |
Returns the current value as a string. | |
virtual bool | set (boost::shared_ptr< WPropertyBase > value, bool recommendedOnly=false) |
Sets the value from the specified property to this one. | |
Static Private Attributes | |
static const size_t | m_size = boost::mpl::size< TypeVector >::value |
How many elements are in this WPropertyStruct? | |
Friends | |
class | WPropertyStructTest |
This is a property which encapsulates a given, fixed number of other properties.
You can specify up to 10 properties. This can be seen similar to the "struct" in the C++ language. A WPropertyStruct can basically seen as WPropertyGroup, but is different in a certain way: it is fixed size (defined on compile time), it allows getting each property with their correct type and provides the appearance as if this property is only ONE object and not a group of multiple objects.
T0 | first type. Mandatory. |
T1 | additional type. Optional. |
T2 | additional type. Optional. |
T3 | additional type. Optional. |
T4 | additional type. Optional. |
T5 | additional type. Optional. |
T6 | additional type. Optional. |
T7 | additional type. Optional. |
T8 | additional type. Optional. |
T9 | additional type. Optional. |
Definition at line 199 of file WPropertyStruct.h.
typedef boost::shared_ptr< const WPropertyStructType > WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::ConstSPtr |
Convenience typedef for a boost::shared_ptr< const WPropertyStructType >
Reimplemented from WPropertyGroupBase.
Definition at line 216 of file WPropertyStruct.h.
typedef boost::shared_ptr< WPropertyStructType > WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::SPtr |
Convenience typedef for a boost::shared_ptr< WPropertyStructType >
Reimplemented from WPropertyGroupBase.
Definition at line 211 of file WPropertyStruct.h.
typedef WPropertyStructHelper::SequenceToTuple< TypeVector >::type WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::TupleType |
The type vector as a boost tuple.
Definition at line 226 of file WPropertyStruct.h.
typedef WPropertyStructHelper::AsVector< BOOST_PP_ENUM_PARAMS( 10, T ) >::type WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::TypeVector |
The boost mpl vector for all the types specified.
Definition at line 221 of file WPropertyStruct.h.
typedef WPropertyStruct< BOOST_PP_ENUM_PARAMS( 10, T ) > WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::WPropertyStructType |
The type of this template instantiation.
Definition at line 206 of file WPropertyStruct.h.
WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::WPropertyStruct | ( | std::string | name, |
std::string | description | ||
) | [inline] |
Create an empty named property.
name | the name of the property |
description | the description of the property |
Definition at line 234 of file WPropertyStruct.h.
References WPropertyGroupBase::PropertyCreatorAndGroupAdder< PropertyType >::createAndAdd().
WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::WPropertyStruct | ( | const WPropertyStructType & | from | ) | [inline, explicit] |
Copy constructor.
Creates a deep copy of this property. As boost::signals2 and condition variables are non-copyable, new instances get created. The subscriptions to a signal are LOST as well as all listeners to a condition.
from | the instance to copy. |
Definition at line 256 of file WPropertyStruct.h.
virtual WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::~WPropertyStruct | ( | ) | [inline, virtual] |
Destructor.
Definition at line 265 of file WPropertyStruct.h.
virtual WPropertyBase::SPtr WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::clone | ( | ) | [inline, virtual] |
This method clones a property and returns the clone.
It does a deep copy and, in contrast to a copy constructor, creates property with the correct type without explicitly requiring the user to specify it. It creates a NEW change condition and change signal. This means, alls subscribed signal handlers are NOT copied.
Implements WPropertyBase.
Definition at line 351 of file WPropertyStruct.h.
virtual std::string WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::getAsString | ( | ) | [inline, virtual] |
Returns the current value as a string.
This is useful for debugging or project files. It is not implemented as << operator, since the << should also print min/max constraints and so on. This simply is the value.
Implements WPropertyBase.
Definition at line 403 of file WPropertyStruct.h.
References WSharedObject< T >::getReadTicket(), WPropertyGroupBase::m_properties, and WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::size().
boost::mpl::at< TypeVector, boost::mpl::size_t< N > >::type WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::getProperty | ( | ) | [inline] |
Get the N'th property in the struct.
N | the number of the property to get. |
Definition at line 278 of file WPropertyStruct.h.
Referenced by WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::getProperty().
boost::mpl::at< TypeVector, boost::mpl::size_t< N > >::type::element_type::ConstSPtr WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::getProperty | ( | ) | const [inline] |
Get the N'th property in the struct.
N | the number of the property to get. |
Definition at line 292 of file WPropertyStruct.h.
References WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::getProperty().
const WPropertyBase::SPtr& WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::getProperty | ( | size_t | n | ) | const [inline] |
Returns the property with the given number, but only as base type.
The advantage is that the property number can be specified during runtime.
n | the number of the property |
Definition at line 306 of file WPropertyStruct.h.
References WSharedObject< T >::getReadTicket(), and WPropertyGroupBase::m_properties.
WPropertyBase::SPtr WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::getProperty | ( | size_t | n | ) | [inline] |
Returns the property with the given number, but only as base type.
The advantage is that the property number can be specified during runtime.
n | the number of the property |
Definition at line 321 of file WPropertyStruct.h.
References WSharedObject< T >::getReadTicket(), and WPropertyGroupBase::m_properties.
virtual PROPERTY_TYPE WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::getType | ( | ) | const [inline, virtual] |
Gets the real WPropertyVariable type of this instance.
Reimplemented from WPropertyBase.
Definition at line 362 of file WPropertyStruct.h.
virtual bool WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::set | ( | boost::shared_ptr< WPropertyBase > | value, |
bool | recommendedOnly = false |
||
) | [inline, virtual] |
Sets the value from the specified property to this one.
This is especially useful to copy a value without explicitly casting/knowing the dynamic type of the property.
value | the new value. |
recommendedOnly | if true, property types which support recommended values apply the given value as recommendation. |
Implements WPropertyBase.
Definition at line 428 of file WPropertyStruct.h.
References WSharedObject< T >::getReadTicket(), WPropertyGroupBase::m_properties, and WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::size().
virtual bool WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::setAsString | ( | std::string | value | ) | [inline, virtual] |
This methods allows properties to be set by a string value.
This is especially useful when a property is only available as string and the real type of the property is unknown. This is a shortcut for casting the property and then setting the lexically casted value.
value | the new value to set. |
Implements WPropertyBase.
Definition at line 375 of file WPropertyStruct.h.
References WSharedObject< T >::getReadTicket(), WPropertyGroupBase::m_properties, WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::size(), and string_utils::tokenize().
size_t WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::size | ( | ) | const [inline] |
The size of the WPropertyStruct.
This returns the number of properties encapsulated.
Definition at line 333 of file WPropertyStruct.h.
References WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::m_size.
Referenced by WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::getAsString(), WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::set(), and WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::setAsString().
const size_t WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::m_size = boost::mpl::size< TypeVector >::value [static, private] |
How many elements are in this WPropertyStruct?
Definition at line 456 of file WPropertyStruct.h.
Referenced by WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::size().