OpenWalnut  1.5.0dev
Public Types | Public Member Functions | List of all members
WPropertyList< T > Class Template Reference

This is a dynamic property list. More...

#include <WPropertyList.h>

+ Inheritance diagram for WPropertyList< T >:
+ Collaboration diagram for WPropertyList< T >:

Public Types

typedef T ValueType
 The type of property to store in this list. More...
 
typedef WPropertyList< ValueTypeWPropertyListType
 Abbreviation for this template with the current value type. More...
 
typedef std::shared_ptr< WPropertyList< ValueType > > SPtr
 Convenience typedef for a std::shared_ptr< WPropertyList >. More...
 
typedef std::shared_ptr< const WPropertyList< ValueType > > ConstSPtr
 Convenience typedef for a std::shared_ptr< const WPropertyList >. 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< PropertyContainerTypePropertySharedContainerType
 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< WPropertyGroupBaseSPtr
 Convenience typedef for a std::shared_ptr< WPropertyGroupBase >. More...
 
typedef std::shared_ptr< const WPropertyGroupBaseConstSPtr
 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< WPropertyBaseSPtr
 Convenience typedef for a std::shared_ptr< WPropertyBase > More...
 
typedef std::shared_ptr< const WPropertyBaseConstSPtr
 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

 WPropertyList (std::string name, std::string description)
 Create an empty named property. More...
 
 WPropertyList (const WPropertyListType &from)
 Copy constructor. More...
 
virtual ~WPropertyList ()
 Destructor. 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)
 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< WPropertyBasegetProperty (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< WPropertyBasefindProperty (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< WConditiongetUpdateCondition () const
 This method returns a condition which gets fired whenever the property changes somehow. More...
 
virtual bool set (std::shared_ptr< WPropertyBase > value, bool recommendedOnly=false)=0
 Sets the value from the specified property to this one. 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< WPropertyGroupBasetoPropGroupBase ()
 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...
 

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< WPropertyBasefindProperty (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< WConditionSetm_updateCondition
 Condition notified whenever something changes. More...
 

Detailed Description

template<typename T>
class WPropertyList< T >

This is a dynamic property list.

With its help, users can dynamically add items.

Template Parameters
TThis is a property type. The list will then contain several of these properties.

Definition at line 41 of file WPropertyList.h.

Member Typedef Documentation

◆ ConstSPtr

template<typename T >
typedef std::shared_ptr< const WPropertyList< ValueType > > WPropertyList< T >::ConstSPtr

Convenience typedef for a std::shared_ptr< const WPropertyList >.

Definition at line 62 of file WPropertyList.h.

◆ SPtr

template<typename T >
typedef std::shared_ptr< WPropertyList< ValueType > > WPropertyList< T >::SPtr

Convenience typedef for a std::shared_ptr< WPropertyList >.

Definition at line 57 of file WPropertyList.h.

◆ ValueType

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

The type of property to store in this list.

Definition at line 47 of file WPropertyList.h.

◆ WPropertyListType

template<typename T >
typedef WPropertyList< ValueType > WPropertyList< T >::WPropertyListType

Abbreviation for this template with the current value type.

Definition at line 52 of file WPropertyList.h.

Constructor & Destructor Documentation

◆ WPropertyList() [1/2]

template<typename T >
WPropertyList< T >::WPropertyList ( std::string  name,
std::string  description 
)
inline

Create an empty named property.

Parameters
namethe name of the property
descriptionthe description of the property

Definition at line 70 of file WPropertyList.h.

◆ WPropertyList() [2/2]

template<typename T >
WPropertyList< T >::WPropertyList ( const WPropertyListType from)
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.

Parameters
fromthe instance to copy.

Definition at line 82 of file WPropertyList.h.

◆ ~WPropertyList()

template<typename T >
virtual WPropertyList< T >::~WPropertyList ( )
inlinevirtual

Destructor.

Definition at line 91 of file WPropertyList.h.

Member Function Documentation

◆ clone()

template<typename T >
virtual WPropertyBase::SPtr WPropertyList< T >::clone ( )
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.

Note
this simply ensures the copy constructor of the runtime type is issued.
Returns
the deep clone of this property.

Implements WPropertyBase.

Definition at line 118 of file WPropertyList.h.

◆ getAsString()

template<typename T >
virtual std::string WPropertyList< T >::getAsString ( )
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.

Returns
the value as a string.

Implements WPropertyBase.

Definition at line 150 of file WPropertyList.h.

References WSharedObject< T >::getReadTicket(), and WPropertyGroupBase::m_properties.

+ Here is the call graph for this function:

◆ getType()

template<typename T >
virtual PROPERTY_TYPE WPropertyList< T >::getType ( ) const
inlinevirtual

Gets the real WPropertyVariable type of this instance.

Returns
the real type.

Reimplemented from WPropertyBase.

Definition at line 129 of file WPropertyList.h.

◆ set()

template<typename T >
virtual bool WPropertyList< T >::set ( std::shared_ptr< WPropertyBase value)
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.

Parameters
valuethe new value.
Returns
true if the value has been accepted.

Definition at line 165 of file WPropertyList.h.

◆ setAsString()

template<typename T >
bool WPropertyList< T >::setAsString ( std::string  value)
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.

Parameters
valuethe new value to set.
Returns
true if value could be set.

Implements WPropertyBase.

Definition at line 181 of file WPropertyList.h.


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