OpenWalnut  1.2.5
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
WProperties Class Reference

Class to manage properties of an object and to provide convenience methods for easy access and manipulation. More...

#include <WProperties.h>

+ Inheritance diagram for WProperties:

List of all members.

Public Types

typedef boost::shared_ptr
< WProperties
SPtr
 shared pointer to object of this type
typedef boost::shared_ptr
< const WProperties
ConstSPtr
 const shared pointer to object of this type
typedef WPropertiesPtr
 pointer to object of this type
typedef const WPropertiesConstPtr
 const pointer to object of this type
typedef WPropertiesRef
 ref to object of this type
typedef const WPropertiesConstRef
 const ref to object of this type
typedef std::vector
< boost::shared_ptr
< WPropertyBase > > 
PropertyContainerType
 For shortening: a type defining a shared vector of WSubject pointers.
typedef
WSharedSequenceContainer
< PropertyContainerType
PropertySharedContainerType
 The alias for a shared container.
typedef
PropertyContainerType::const_iterator 
PropertyConstIterator
 The const iterator type of the container.
typedef
PropertyContainerType::iterator 
PropertyIterator
 The iterator type of the container.

Public Member Functions

 WProperties (std::string name="unnamed group", std::string description="an unnamed group of properties")
 Constructor.
 WProperties (const WProperties &from)
 Copy constructor.
virtual ~WProperties ()
 destructor
virtual boost::shared_ptr
< WPropertyBase
clone ()
 This method clones a property and returns the clone.
template<typename PropType >
PropType addProperty (PropType prop)
 Simply insert the specified property to the list.
void removeProperty (boost::shared_ptr< WPropertyBase > prop)
 Simply remove the specified property from the list.
bool existsProperty (std::string name)
 Helper function that finds a property by its name.
boost::shared_ptr< WPropertyBasegetProperty (std::string name)
 Function searches the property.
PropertySharedContainerType::ReadTicket getProperties () const
 Returns a read ticket for read-access to the list of properties.
PropertySharedContainerType::ReadTicket getReadTicket () const
 Returns an read ticket for the properties.
boost::shared_ptr< WPropertyBasefindProperty (std::string name) const
 Searches the property with a given name.
virtual void clear ()
 Removes all properties from the list.
WPropGroup addPropertyGroup (std::string name, std::string description, bool hide=false)
 Create and add a new property group.
template<typename T >
boost::shared_ptr
< WPropertyVariable< T > > 
addProperty (std::string name, std::string description, const T &initial, bool hide=false)
 Create and add a new property of the template type.
template<typename T >
boost::shared_ptr
< WPropertyVariable< T > > 
addProperty (std::string name, std::string description, const T &initial, boost::shared_ptr< WCondition > condition, bool hide=false)
 Create and add a new property of the template type.
template<typename T >
boost::shared_ptr
< WPropertyVariable< T > > 
addProperty (std::string name, std::string description, const T &initial, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
template<typename T >
boost::shared_ptr
< WPropertyVariable< T > > 
addProperty (std::string name, std::string description, const T &initial, boost::shared_ptr< WCondition > condition, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
virtual PROPERTY_TYPE getType () const
 Gets the real 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)
 Sets the value from the specified property to this one.
WPropBool addProperty (std::string name, std::string description, const WPVBaseTypes::PV_BOOL &initial, bool hide=false)
 Create and add a new property of the template type.
WPropInt addProperty (std::string name, std::string description, const WPVBaseTypes::PV_INT &initial, bool hide=false)
 Create and add a new property of the template type.
WPropDouble addProperty (std::string name, std::string description, const WPVBaseTypes::PV_DOUBLE &initial, bool hide=false)
 Create and add a new property of the template type.
WPropString addProperty (std::string name, std::string description, const WPVBaseTypes::PV_STRING &initial, bool hide=false)
 Create and add a new property of the template type.
WPropFilename addProperty (std::string name, std::string description, const WPVBaseTypes::PV_PATH &initial, bool hide=false)
 Create and add a new property of the template type.
WPropSelection addProperty (std::string name, std::string description, const WPVBaseTypes::PV_SELECTION &initial, bool hide=false)
 Create and add a new property of the template type.
WPropPosition addProperty (std::string name, std::string description, const WPVBaseTypes::PV_POSITION &initial, bool hide=false)
 Create and add a new property of the template type.
WPropColor addProperty (std::string name, std::string description, const WPVBaseTypes::PV_COLOR &initial, bool hide=false)
 Create and add a new property of the template type.
WPropTrigger addProperty (std::string name, std::string description, const WPVBaseTypes::PV_TRIGGER &initial, bool hide=false)
 Create and add a new property of the template type.
WPropBool addProperty (std::string name, std::string description, const WPVBaseTypes::PV_BOOL &initial, boost::shared_ptr< WCondition > condition, bool hide=false)
 Create and add a new property of the template type.
WPropInt addProperty (std::string name, std::string description, const WPVBaseTypes::PV_INT &initial, boost::shared_ptr< WCondition > condition, bool hide=false)
 Create and add a new property of the template type.
WPropDouble addProperty (std::string name, std::string description, const WPVBaseTypes::PV_DOUBLE &initial, boost::shared_ptr< WCondition > condition, bool hide=false)
 Create and add a new property of the template type.
WPropString addProperty (std::string name, std::string description, const WPVBaseTypes::PV_STRING &initial, boost::shared_ptr< WCondition > condition, bool hide=false)
 Create and add a new property of the template type.
WPropFilename addProperty (std::string name, std::string description, const WPVBaseTypes::PV_PATH &initial, boost::shared_ptr< WCondition > condition, bool hide=false)
 Create and add a new property of the template type.
WPropSelection addProperty (std::string name, std::string description, const WPVBaseTypes::PV_SELECTION &initial, boost::shared_ptr< WCondition > condition, bool hide=false)
 Create and add a new property of the template type.
WPropPosition addProperty (std::string name, std::string description, const WPVBaseTypes::PV_POSITION &initial, boost::shared_ptr< WCondition > condition, bool hide=false)
 Create and add a new property of the template type.
WPropColor addProperty (std::string name, std::string description, const WPVBaseTypes::PV_COLOR &initial, boost::shared_ptr< WCondition > condition, bool hide=false)
 Create and add a new property of the template type.
WPropTrigger addProperty (std::string name, std::string description, const WPVBaseTypes::PV_TRIGGER &initial, boost::shared_ptr< WCondition > condition, bool hide=false)
 Create and add a new property of the template type.
WPropBool addProperty (std::string name, std::string description, const WPVBaseTypes::PV_BOOL &initial, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropInt addProperty (std::string name, std::string description, const WPVBaseTypes::PV_INT &initial, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropDouble addProperty (std::string name, std::string description, const WPVBaseTypes::PV_DOUBLE &initial, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropString addProperty (std::string name, std::string description, const WPVBaseTypes::PV_STRING &initial, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropFilename addProperty (std::string name, std::string description, const WPVBaseTypes::PV_PATH &initial, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropSelection addProperty (std::string name, std::string description, const WPVBaseTypes::PV_SELECTION &initial, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropPosition addProperty (std::string name, std::string description, const WPVBaseTypes::PV_POSITION &initial, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropColor addProperty (std::string name, std::string description, const WPVBaseTypes::PV_COLOR &initial, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropTrigger addProperty (std::string name, std::string description, const WPVBaseTypes::PV_TRIGGER &initial, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropBool addProperty (std::string name, std::string description, const WPVBaseTypes::PV_BOOL &initial, boost::shared_ptr< WCondition > condition, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropInt addProperty (std::string name, std::string description, const WPVBaseTypes::PV_INT &initial, boost::shared_ptr< WCondition > condition, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropDouble addProperty (std::string name, std::string description, const WPVBaseTypes::PV_DOUBLE &initial, boost::shared_ptr< WCondition > condition, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropString addProperty (std::string name, std::string description, const WPVBaseTypes::PV_STRING &initial, boost::shared_ptr< WCondition > condition, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropFilename addProperty (std::string name, std::string description, const WPVBaseTypes::PV_PATH &initial, boost::shared_ptr< WCondition > condition, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropSelection addProperty (std::string name, std::string description, const WPVBaseTypes::PV_SELECTION &initial, boost::shared_ptr< WCondition > condition, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropPosition addProperty (std::string name, std::string description, const WPVBaseTypes::PV_POSITION &initial, boost::shared_ptr< WCondition > condition, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropColor addProperty (std::string name, std::string description, const WPVBaseTypes::PV_COLOR &initial, boost::shared_ptr< WCondition > condition, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
WPropTrigger addProperty (std::string name, std::string description, const WPVBaseTypes::PV_TRIGGER &initial, boost::shared_ptr< WCondition > condition, WPropertyBase::PropertyChangeNotifierType notifier, bool hide=false)
 Create and add a new property of the template type.
virtual boost::shared_ptr
< WCondition
getChildUpdateCondition () const
 This returns the condition fired whenever one children fires its update condition.

Protected Member Functions

boost::shared_ptr< WPropertyBasefindProperty (const WProperties *const props, std::string name) const
 Helping function to find a property inside a specific group.

Private Member Functions

bool propNamePredicate (boost::shared_ptr< WPropertyBase > prop1, boost::shared_ptr< WPropertyBase > prop2) const
 Compares the names of two properties and returns true if they are equal.

Private Attributes

PropertySharedContainerType m_properties
 The set of proerties.
boost::shared_ptr< WConditionSetm_childUpdateCondition
 Condition notified whenever a property inside this group fires its WPropertyBase::m_updateCondition.

Friends

class WPropertiesTest

Detailed Description

Class to manage properties of an object and to provide convenience methods for easy access and manipulation.

It also allows thread safe iteration on its elements. The main purpose of this class is to group properties together and to allow searching properties by a given name. The name of each property in a group has to be unique and is constructed using the group names containing them: hello/you/property is the property with the name "property" in the group "you" which against is in the group "hello".

Notes:
The root group of each module does not have a name.

Definition at line 53 of file WProperties.h.


Member Typedef Documentation

const pointer to object of this type

Definition at line 62 of file WProperties.h.

const ref to object of this type

Definition at line 64 of file WProperties.h.

typedef boost::shared_ptr< const WProperties > WProperties::ConstSPtr

const shared pointer to object of this type

Reimplemented from WPropertyBase.

Definition at line 60 of file WProperties.h.

typedef PropertyContainerType::const_iterator WProperties::PropertyConstIterator

The const iterator type of the container.

Definition at line 79 of file WProperties.h.

typedef std::vector< boost::shared_ptr< WPropertyBase > > WProperties::PropertyContainerType

For shortening: a type defining a shared vector of WSubject pointers.

Definition at line 69 of file WProperties.h.

typedef PropertyContainerType::iterator WProperties::PropertyIterator

The iterator type of the container.

Definition at line 84 of file WProperties.h.

The alias for a shared container.

Definition at line 74 of file WProperties.h.

pointer to object of this type

Definition at line 61 of file WProperties.h.

ref to object of this type

Definition at line 63 of file WProperties.h.

typedef boost::shared_ptr< WProperties > WProperties::SPtr

shared pointer to object of this type

Reimplemented from WPropertyBase.

Definition at line 59 of file WProperties.h.


Constructor & Destructor Documentation

WProperties::WProperties ( std::string  name = "unnamed group",
std::string  description = "an unnamed group of properties" 
)

Constructor.

Creates an empty list of properties.

Notes:
WModule::getProperties always returns an unnamed instance.
Parameters:
namethe name of the property group. The GUI is using this name for naming the tabs/group boxes
descriptionthe description of the group.

Definition at line 41 of file WProperties.cpp.

References WSharedObject< T >::getChangeCondition(), m_properties, and WPropertyBase::m_updateCondition.

Referenced by addPropertyGroup(), and clone().

WProperties::WProperties ( const WProperties from) [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. The conditions you can grab using getValueChangeConditon and getCondition are not the same as in the original! This is because the class corresponds to the observer/observable pattern. You won't expect a clone to fire a condition if a original flag is changed (which after cloning is completely decoupled from the clone).

Notes:
the properties inside this list are also copied deep
Parameters:
fromthe instance to copy.

Definition at line 53 of file WProperties.cpp.

References addProperty(), WSharedObject< T >::getChangeCondition(), WSharedObject< T >::getReadTicket(), m_properties, and WPropertyBase::m_updateCondition.

destructor

Definition at line 49 of file WProperties.cpp.


Member Function Documentation

template<typename PropType >
PropType WProperties::addProperty ( PropType  prop)

Simply insert the specified property to the list.

Parameters:
propthe property to add
Returns:
The given prop.

Definition at line 976 of file WProperties.h.

References WPropertyBase::getName(), WPropertyBase::getPurpose(), WSharedObject< T >::getWriteTicket(), m_childUpdateCondition, m_properties, and propNamePredicate().

Referenced by addProperty(), addPropertyGroup(), and WProperties().

template<typename T >
boost::shared_ptr< WPropertyVariable< T > > WProperties::addProperty ( std::string  name,
std::string  description,
const T &  initial,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 1017 of file WProperties.h.

References addProperty().

template<typename T >
boost::shared_ptr< WPropertyVariable< T > > WProperties::addProperty ( std::string  name,
std::string  description,
const T &  initial,
boost::shared_ptr< WCondition condition,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
conditionuse this external condition for notification.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 1028 of file WProperties.h.

References addProperty().

template<typename T >
boost::shared_ptr< WPropertyVariable< T > > WProperties::addProperty ( std::string  name,
std::string  description,
const T &  initial,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 1040 of file WProperties.h.

References addProperty().

template<typename T >
boost::shared_ptr< WPropertyVariable< T > > WProperties::addProperty ( std::string  name,
std::string  description,
const T &  initial,
boost::shared_ptr< WCondition condition,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
conditionuse this external condition for notification
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 1052 of file WProperties.h.

References addProperty().

WPropBool WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_BOOL initial,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 329 of file WProperties.cpp.

WPropInt WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_INT initial,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable. It also sets the min and max constraint to [0,100].

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 334 of file WProperties.cpp.

WPropDouble WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_DOUBLE initial,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable. It also sets the min and max constraint to [0,100].

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 339 of file WProperties.cpp.

WPropString WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_STRING initial,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 344 of file WProperties.cpp.

WPropFilename WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_PATH initial,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 349 of file WProperties.cpp.

WPropSelection WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_SELECTION initial,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 354 of file WProperties.cpp.

WPropPosition WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_POSITION initial,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 359 of file WProperties.cpp.

WPropColor WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_COLOR initial,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 364 of file WProperties.cpp.

WPropTrigger WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_TRIGGER initial,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 369 of file WProperties.cpp.

WPropBool WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_BOOL initial,
boost::shared_ptr< WCondition condition,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
conditionuse this external condition for notification.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 381 of file WProperties.cpp.

WPropInt WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_INT initial,
boost::shared_ptr< WCondition condition,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable. It also sets the min and max constraint to [0,100].

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
conditionuse this external condition for notification.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 387 of file WProperties.cpp.

WPropDouble WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_DOUBLE initial,
boost::shared_ptr< WCondition condition,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable. It also sets the min and max constraint to [0,100].

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
conditionuse this external condition for notification.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 393 of file WProperties.cpp.

WPropString WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_STRING initial,
boost::shared_ptr< WCondition condition,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
conditionuse this external condition for notification.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 399 of file WProperties.cpp.

WPropFilename WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_PATH initial,
boost::shared_ptr< WCondition condition,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
conditionuse this external condition for notification.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 405 of file WProperties.cpp.

WPropSelection WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_SELECTION initial,
boost::shared_ptr< WCondition condition,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
conditionuse this external condition for notification.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 411 of file WProperties.cpp.

WPropPosition WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_POSITION initial,
boost::shared_ptr< WCondition condition,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
conditionuse this external condition for notification.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 417 of file WProperties.cpp.

WPropColor WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_COLOR initial,
boost::shared_ptr< WCondition condition,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
conditionuse this external condition for notification.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 423 of file WProperties.cpp.

WPropTrigger WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_TRIGGER initial,
boost::shared_ptr< WCondition condition,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
conditionuse this external condition for notification.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 429 of file WProperties.cpp.

WPropBool WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_BOOL initial,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 442 of file WProperties.cpp.

WPropInt WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_INT initial,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable. It also sets the min and max constraint to [0,100].

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 448 of file WProperties.cpp.

WPropDouble WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_DOUBLE initial,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable. It also sets the min and max constraint to [0,100].

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 454 of file WProperties.cpp.

WPropString WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_STRING initial,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 460 of file WProperties.cpp.

WPropFilename WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_PATH initial,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 466 of file WProperties.cpp.

WPropSelection WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_SELECTION initial,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 472 of file WProperties.cpp.

WPropPosition WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_POSITION initial,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 478 of file WProperties.cpp.

WPropColor WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_COLOR initial,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 484 of file WProperties.cpp.

WPropTrigger WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_TRIGGER initial,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 490 of file WProperties.cpp.

WPropBool WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_BOOL initial,
boost::shared_ptr< WCondition condition,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
conditionuse this external condition for notification
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 504 of file WProperties.cpp.

WPropInt WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_INT initial,
boost::shared_ptr< WCondition condition,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable. It also sets the min and max constraint to [0,100].

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
conditionuse this external condition for notification
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 511 of file WProperties.cpp.

WPropDouble WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_DOUBLE initial,
boost::shared_ptr< WCondition condition,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable. It also sets the min and max constraint to [0,100].

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
conditionuse this external condition for notification
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 518 of file WProperties.cpp.

WPropString WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_STRING initial,
boost::shared_ptr< WCondition condition,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
conditionuse this external condition for notification
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 525 of file WProperties.cpp.

WPropFilename WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_PATH initial,
boost::shared_ptr< WCondition condition,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
conditionuse this external condition for notification
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 532 of file WProperties.cpp.

WPropSelection WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_SELECTION initial,
boost::shared_ptr< WCondition condition,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
conditionuse this external condition for notification
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 539 of file WProperties.cpp.

WPropPosition WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_POSITION initial,
boost::shared_ptr< WCondition condition,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
conditionuse this external condition for notification
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 546 of file WProperties.cpp.

WPropColor WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_COLOR initial,
boost::shared_ptr< WCondition condition,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
conditionuse this external condition for notification
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 553 of file WProperties.cpp.

WPropTrigger WProperties::addProperty ( std::string  name,
std::string  description,
const WPVBaseTypes::PV_TRIGGER initial,
boost::shared_ptr< WCondition condition,
WPropertyBase::PropertyChangeNotifierType  notifier,
bool  hide = false 
)

Create and add a new property of the template type.

For more details see appropriate constructor ow WPropertyVariable.

See also:
WPropertyVariable
Parameters:
namethe property name
descriptionthe property description
initialthe initial value
notifieruse this notifier for change callbacks.
conditionuse this external condition for notification
hideset to true to set the hide flag directly.
Returns:
the newly created property variable instance.

Definition at line 560 of file WProperties.cpp.

WPropGroup WProperties::addPropertyGroup ( std::string  name,
std::string  description,
bool  hide = false 
)

Create and add a new property group.

Use these groups to structure your properties.

Parameters:
namethe name of the group.
descriptionthe description of the group.
hidetrue if group should be completely hidden.
Returns:
The newly created property group.

Definition at line 303 of file WProperties.cpp.

References addProperty(), and WProperties().

void WProperties::clear ( ) [virtual]

Removes all properties from the list.

Definition at line 311 of file WProperties.cpp.

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

boost::shared_ptr< WPropertyBase > WProperties::clone ( ) [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.

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

Implements WPropertyBase.

Definition at line 77 of file WProperties.cpp.

References WProperties().

bool WProperties::existsProperty ( std::string  name)

Helper function that finds a property by its name.

Use this method to find out whether the property exists or not, since findProperty throws an exception.

Parameters:
namename of searched property.
Returns:
Answer to the question whether the property exists.

Definition at line 277 of file WProperties.cpp.

References findProperty().

boost::shared_ptr< WPropertyBase > WProperties::findProperty ( std::string  name) const

Searches the property with a given name.

It does not throw any exception. It simply returns NULL if it can't be found.

Parameters:
namethe name of the property to search
Returns:
the property or NULL if not found.

Definition at line 240 of file WProperties.cpp.

References WPropertyBase::toPropGroup().

Referenced by existsProperty(), and getProperty().

boost::shared_ptr< WPropertyBase > WProperties::findProperty ( const WProperties *const  props,
std::string  name 
) const [protected]

Helping function to find a property inside a specific group.

It does not recursively find properties nested inside other property groups.

Parameters:
propsthe group to search in. This is not a shared pointer since it is not needed. It simply can't happen that it is freed during findProperty as it is contained in this or a nested properties instance.
namethe name of the property inside THIS group.
Returns:
the property if found, else NULL.

Definition at line 219 of file WProperties.cpp.

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

std::string WProperties::getAsString ( ) [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.

Returns:
the value as a string.

Implements WPropertyBase.

Definition at line 94 of file WProperties.cpp.

boost::shared_ptr< WCondition > WProperties::getChildUpdateCondition ( ) const [virtual]

This returns the condition fired whenever one children fires its update condition.

Useful to get notified about all changes that happen.

Returns:
the condition fired if a child fires its update condition.

Definition at line 318 of file WProperties.cpp.

References m_childUpdateCondition.

Returns a read ticket for read-access to the list of properties.

Returns:
the read ticket.

Definition at line 293 of file WProperties.cpp.

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

boost::shared_ptr< WPropertyBase > WProperties::getProperty ( std::string  name)

Function searches the property.

If it does not exists, it throws an exception.

Parameters:
namethe name of the property
Returns:
a WProperty object

Definition at line 282 of file WProperties.cpp.

References findProperty().

Returns an read ticket for the properties.

This, and only this, has to be used for external iteration of properties.

See also:
WSharedObjectTicketRead
Returns:
the read ticket.

Definition at line 298 of file WProperties.cpp.

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

PROPERTY_TYPE WProperties::getType ( ) const [virtual]

Gets the real type of this instance.

In this case, PV_GROUP.

Returns:
the real type.

Reimplemented from WPropertyBase.

Definition at line 83 of file WProperties.cpp.

bool WProperties::propNamePredicate ( boost::shared_ptr< WPropertyBase prop1,
boost::shared_ptr< WPropertyBase prop2 
) const [private]

Compares the names of two properties and returns true if they are equal.

Parameters:
prop1the first prop.
prop2the second prop.
Returns:
Are the names of the two properties equal?

Definition at line 202 of file WProperties.cpp.

Referenced by addProperty().

void WProperties::removeProperty ( boost::shared_ptr< WPropertyBase prop)

Simply remove the specified property from the list.

If the given property is not in the list, nothing happens.

Parameters:
propthe property to remove.

Definition at line 206 of file WProperties.cpp.

References WSharedObject< T >::getWriteTicket(), m_childUpdateCondition, and m_properties.

bool WProperties::set ( boost::shared_ptr< WPropertyBase value) [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.

Notes:
for WProperties, this actually does nothing an.
Parameters:
valuethe new value.
Returns:
true, always.

Implements WPropertyBase.

Definition at line 197 of file WProperties.cpp.

bool WProperties::setAsString ( std::string  value) [virtual]

This methods allows properties to be set by a string value.

This method does nothing here, as groups can not be set in any kind.

Parameters:
valuethe new value to set. IGNORED.
Returns:
always true

Implements WPropertyBase.

Definition at line 88 of file WProperties.cpp.


Member Data Documentation

boost::shared_ptr< WConditionSet > WProperties::m_childUpdateCondition [private]

Condition notified whenever a property inside this group fires its WPropertyBase::m_updateCondition.

This is especially useful to get a notification if something updates without further knowledge what changed. Useful if you want to listen for updates in modules for example.

See also:
getChildUpdateCondition

Definition at line 962 of file WProperties.h.

Referenced by addProperty(), getChildUpdateCondition(), and removeProperty().

The set of proerties.

This uses the operators ==,<,> WProperty to determine equalness.

Definition at line 954 of file WProperties.h.

Referenced by addProperty(), clear(), findProperty(), getProperties(), getReadTicket(), removeProperty(), and WProperties().


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends