OpenWalnut
1.5.0dev
|
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. More... | |
typedef std::shared_ptr< WPropertyStructType > | SPtr |
Convenience typedef for a std::shared_ptr< WPropertyStructType > More... | |
typedef std::shared_ptr< const WPropertyStructType > | ConstSPtr |
Convenience typedef for a std::shared_ptr< const WPropertyStructType > More... | |
typedef WPropertyStructHelper::AsVector< BOOST_PP_ENUM_PARAMS(10, T) >::type | TypeVector |
The boost mpl vector for all the types specified. More... | |
typedef WPropertyStructHelper::SequenceToTuple< TypeVector >::type | TupleType |
The type vector as a boost tuple. More... | |
Public Types inherited from WPropertyGroupBase | |
typedef std::vector< std::shared_ptr< WPropertyBase > > | PropertyContainerType |
For shortening: a type defining a shared vector of WSubject pointers. More... | |
typedef WSharedSequenceContainer< PropertyContainerType > | PropertySharedContainerType |
The alias for a shared container. More... | |
typedef PropertyContainerType::const_iterator | PropertyConstIterator |
The const iterator type of the container. More... | |
typedef PropertyContainerType::iterator | PropertyIterator |
The iterator type of the container. More... | |
typedef std::shared_ptr< WPropertyGroupBase > | SPtr |
Convenience typedef for a std::shared_ptr< WPropertyGroupBase >. More... | |
typedef std::shared_ptr< const WPropertyGroupBase > | ConstSPtr |
Convenience typedef for a std::shared_ptr< const WPropertyGroupBase >. More... | |
typedef boost::function< void(std::string, std::string)> | PropertyStringVisitor |
The visitor type used to visit properties as strings. More... | |
Public Types inherited from WPropertyBase | |
typedef std::shared_ptr< WPropertyBase > | SPtr |
Convenience typedef for a std::shared_ptr< WPropertyBase > More... | |
typedef std::shared_ptr< const WPropertyBase > | ConstSPtr |
Convenience typedef for a std::shared_ptr< const WPropertyBase > More... | |
typedef boost::function< void(std::shared_ptr< WPropertyBase >)> | PropertyChangeNotifierType |
Signal signature emitted during set operations. More... | |
Public Member Functions | |
WPropertyStruct (std::string name, std::string description) | |
Create an empty named property. More... | |
WPropertyStruct (const WPropertyStructType &from) | |
Copy constructor. More... | |
virtual | ~WPropertyStruct () |
Destructor. More... | |
template<int N> | |
boost::mpl::at< TypeVector, boost::mpl::size_t< N > >::type | getProperty () |
Get the N'th property in the struct. More... | |
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. More... | |
const WPropertyBase::SPtr & | getProperty (size_t n) const |
Returns the property with the given number, but only as base type. More... | |
WPropertyBase::SPtr | getProperty (size_t n) |
Returns the property with the given number, but only as base type. More... | |
size_t | size () const |
The size of the WPropertyStruct. More... | |
virtual WPropertyBase::SPtr | clone () |
This method clones a property and returns the clone. More... | |
virtual PROPERTY_TYPE | getType () const |
Gets the real WPropertyVariable type of this instance. More... | |
virtual bool | setAsString (std::string value) |
This methods allows properties to be set by a string value. More... | |
virtual std::string | getAsString () |
Returns the current value as a string. More... | |
virtual bool | set (std::shared_ptr< WPropertyBase > value, bool recommendedOnly=false) |
Sets the value from the specified property to this one. More... | |
Public Member Functions inherited from WPropertyGroupBase | |
WPropertyGroupBase (std::string name, std::string description) | |
Constructor. More... | |
WPropertyGroupBase (const WPropertyGroupBase &from) | |
Copy constructor. More... | |
virtual | ~WPropertyGroupBase () |
Destructor. More... | |
virtual bool | existsProperty (std::string name) |
Helper function that finds a property by its name. More... | |
virtual std::shared_ptr< WPropertyBase > | getProperty (std::string name) |
Function searches the property. More... | |
virtual PropertySharedContainerType::ReadTicket | getProperties () const |
Returns a read ticket for read-access to the list of properties. More... | |
virtual PropertySharedContainerType::ReadTicket | getReadTicket () const |
Returns an read ticket for the properties. More... | |
virtual std::shared_ptr< WPropertyBase > | findProperty (std::string name) const |
Searches the property with a given name. More... | |
virtual void | visitAsString (PropertyStringVisitor visitor, std::string pathPrefix="") const |
Visit all leafs in the property three that aren't empty groups. More... | |
bool | autoHideEmpty () const |
Checks whether the property group should be hidden if it is empty. More... | |
void | setAutoHideEmpty (bool autoHide=true) |
Should the property group be hidden automatically if it is empty? By default, this is true. More... | |
Public Member Functions inherited from WPropertyBase | |
WPropertyBase (std::string name, std::string description) | |
Create an empty named property. More... | |
WPropertyBase (const WPropertyBase &from) | |
Copy constructor. More... | |
virtual | ~WPropertyBase () |
Destructor. More... | |
std::string | getName () const |
Gets the name of the class. More... | |
std::string | getDescription () const |
Gets the description of the property. More... | |
bool | isHidden () const |
Determines whether the property is hidden or not. More... | |
void | setHidden (bool hidden=true) |
Sets the property hidden. More... | |
virtual PROPERTY_PURPOSE | getPurpose () const |
Gets the purpose of a property. More... | |
virtual void | setPurpose (PROPERTY_PURPOSE purpose) |
Sets the purpose of the property. More... | |
template<typename T > | |
bool | set (const T &value) |
Shortcut to set a property with a given value. More... | |
virtual std::shared_ptr< WCondition > | getUpdateCondition () const |
This method returns a condition which gets fired whenever the property changes somehow. More... | |
WPropInt | toPropInt () |
Helper converts this instance to its native type. More... | |
WPropDouble | toPropDouble () |
Helper converts this instance to its native type. More... | |
WPropBool | toPropBool () |
Helper converts this instance to its native type. More... | |
WPropString | toPropString () |
Helper converts this instance to its native type. More... | |
WPropFilename | toPropFilename () |
Helper converts this instance to its native type. More... | |
WPropSelection | toPropSelection () |
Helper converts this instance to its native type. More... | |
WPropColor | toPropColor () |
Helper converts this instance to its native type. More... | |
WPropPosition | toPropPosition () |
Helper converts this instance to its native type. More... | |
WPropTrigger | toPropTrigger () |
Helper converts this instance to its native type. More... | |
WPropMatrix4X4 | toPropMatrix4X4 () |
Helper converts this instance to its native type. More... | |
WPropTransferFunction | toPropTransferFunction () |
Helper converts this instance to its native type. More... | |
WPropGroup | toPropGroup () |
Helper converts this instance to its native type. More... | |
WPropInterval | toPropInterval () |
Helper converts this instance to its native type. More... | |
std::shared_ptr< WPropertyGroupBase > | toPropGroupBase () |
Convert the property to a WPropertyGroupBase. More... | |
template<typename T > | |
std::shared_ptr< WPropertyVariable< T > > | toPropertyVariable () |
Helper converts this instance to an arbitrary type. More... | |
Static Private Attributes | |
static const size_t | m_size = boost::mpl::size< TypeVector >::value |
How many elements are in this WPropertyStruct? More... | |
Friends | |
class | WPropertyStructTest |
Access for test class. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from WPropertyGroupBase | |
static const std::string | separator = "/" |
The separator used to separate groups and subgroups. More... | |
Protected Types inherited from WPropertyBase | |
typedef boost::signals2::signal< void(std::shared_ptr< WPropertyBase >)> | PropertyChangeSignalType |
Signal used for firing change signals. More... | |
Protected Member Functions inherited from WPropertyGroupBase | |
virtual std::shared_ptr< WPropertyBase > | findProperty (const WPropertyGroupBase *const props, std::string name) const |
Helping function to find a property inside a specific group. More... | |
bool | propNamePredicate (std::shared_ptr< WPropertyBase > prop1, std::shared_ptr< WPropertyBase > prop2) const |
Compares the names of two properties and returns true if they are equal. More... | |
void | addArbitraryProperty (WPropertyBase::SPtr prop) |
Insert the specified property into the list. More... | |
Protected Member Functions inherited from WPropertyBase | |
virtual void | updateType () |
Calculates the type of the property. More... | |
Protected Attributes inherited from WPropertyGroupBase | |
PropertySharedContainerType | m_properties |
The set of proerties. More... | |
Protected Attributes inherited from WPropertyBase | |
std::string | m_name |
Name of the property. More... | |
std::string | m_description |
Description of the property. More... | |
bool | m_hidden |
Flag denoting whether the property is hidden or not. More... | |
PROPERTY_TYPE | m_type |
Type of the PropertyVariable instance. More... | |
PROPERTY_PURPOSE | m_purpose |
The purpose of this property. More... | |
PropertyChangeSignalType | signal_PropertyChange |
Signal getting fired whenever the property changes. More... | |
std::shared_ptr< WConditionSet > | m_updateCondition |
Condition notified whenever something changes. More... | |
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 198 of file WPropertyStruct.h.
typedef std::shared_ptr< const WPropertyStructType > WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::ConstSPtr |
Convenience typedef for a std::shared_ptr< const WPropertyStructType >
Definition at line 215 of file WPropertyStruct.h.
typedef std::shared_ptr< WPropertyStructType > WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::SPtr |
Convenience typedef for a std::shared_ptr< WPropertyStructType >
Definition at line 210 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 225 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 220 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 205 of file WPropertyStruct.h.
|
inline |
Create an empty named property.
name | the name of the property |
description | the description of the property |
Definition at line 233 of file WPropertyStruct.h.
References WPropertyGroupBase::PropertyCreatorAndGroupAdder< PropertyType >::createAndAdd().
|
inlineexplicit |
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 255 of file WPropertyStruct.h.
|
inlinevirtual |
Destructor.
Definition at line 264 of file WPropertyStruct.h.
|
inlinevirtual |
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 350 of file WPropertyStruct.h.
|
inlinevirtual |
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 402 of file WPropertyStruct.h.
References WSharedObject< T >::getReadTicket(), WPropertyGroupBase::m_properties, and WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::size().
|
inline |
Get the N'th property in the struct.
N | the number of the property to get. |
Definition at line 277 of file WPropertyStruct.h.
Referenced by 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 291 of file WPropertyStruct.h.
References WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::getProperty().
|
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 320 of file WPropertyStruct.h.
References WSharedObject< T >::getReadTicket(), and WPropertyGroupBase::m_properties.
|
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 305 of file WPropertyStruct.h.
References WSharedObject< T >::getReadTicket(), and WPropertyGroupBase::m_properties.
|
inlinevirtual |
Gets the real WPropertyVariable type of this instance.
Reimplemented from WPropertyBase.
Definition at line 361 of file WPropertyStruct.h.
|
inlinevirtual |
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 427 of file WPropertyStruct.h.
References WSharedObject< T >::getReadTicket(), WPropertyGroupBase::m_properties, and WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::size().
|
inlinevirtual |
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 374 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().
|
inline |
The size of the WPropertyStruct.
This returns the number of properties encapsulated.
Definition at line 332 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().
|
friend |
Access for test class.
Definition at line 200 of file WPropertyStruct.h.
|
staticprivate |
How many elements are in this WPropertyStruct?
Definition at line 455 of file WPropertyStruct.h.
Referenced by WPropertyStruct< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::size().