OpenWalnut  1.2.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
WPropertyBase Class Reference

Abstract base class for all properties. More...

#include <WPropertyBase.h>

+ Inheritance diagram for WPropertyBase:

List of all members.

Public Types

typedef boost::shared_ptr
< WPropertyBase
SPtr
 Convenience typedef for a boost::shared_ptr< WPropertyBase >
typedef boost::shared_ptr
< const WPropertyBase
ConstSPtr
 Convenience typedef for a boost::shared_ptr< const WPropertyBase >
typedef boost::function< void(boost::shared_ptr
< WPropertyBase >)> 
PropertyChangeNotifierType
 Signal signature emitted during set operations.

Public Member Functions

 WPropertyBase (std::string name, std::string description)
 Create an empty named property.
 WPropertyBase (const WPropertyBase &from)
 Copy constructor.
virtual ~WPropertyBase ()
 Destructor.
virtual boost::shared_ptr
< WPropertyBase
clone ()=0
 This method clones a property and returns the clone.
std::string getName () const
 Gets the name of the class.
std::string getDescription () const
 Gets the description of the property.
bool isHidden () const
 Determines whether the property is hidden or not.
void setHidden (bool hidden=true)
 Sets the property hidden.
virtual PROPERTY_TYPE getType () const
 Gets the real WPropertyVariable type of this instance.
virtual PROPERTY_PURPOSE getPurpose () const
 Gets the purpose of a property.
virtual void setPurpose (PROPERTY_PURPOSE purpose)
 Sets the purpose of the property.
virtual bool setAsString (std::string value)=0
 This methods allows properties to be set by a string value.
virtual std::string getAsString ()=0
 Returns the current value as a string.
virtual boost::shared_ptr
< WCondition
getUpdateCondition () const
 This method returns a condition which gets fired whenever the property changes somehow.
virtual bool set (boost::shared_ptr< WPropertyBase > value)=0
 Sets the value from the specified property to this one.
WPropInt toPropInt ()
 Helper converts this instance to its native type.
WPropDouble toPropDouble ()
 Helper converts this instance to its native type.
WPropBool toPropBool ()
 Helper converts this instance to its native type.
WPropString toPropString ()
 Helper converts this instance to its native type.
WPropFilename toPropFilename ()
 Helper converts this instance to its native type.
WPropSelection toPropSelection ()
 Helper converts this instance to its native type.
WPropColor toPropColor ()
 Helper converts this instance to its native type.
WPropPosition toPropPosition ()
 Helper converts this instance to its native type.
WPropTrigger toPropTrigger ()
 Helper converts this instance to its native type.
WPropMatrix4X4 toPropMatrix4X4 ()
 Helper converts this instance to its native type.
WPropGroup toPropGroup ()
 Helper converts this instance to its native type.
template<typename T >
boost::shared_ptr
< WPropertyVariable< T > > 
toPropertyVariable ()
 Helper converts this instance to an arbitrary type.

Protected Types

typedef
boost::signals2::signal< void(boost::shared_ptr
< WPropertyBase >)> 
PropertyChangeSignalType
 Signal used for firing change signals.

Protected Member Functions

virtual void updateType ()
 Calculates the type of the property.

Protected Attributes

std::string m_name
 Name of the property.
std::string m_description
 Description of the property.
bool m_hidden
 Flag denoting whether the property is hidden or not.
PROPERTY_TYPE m_type
 Type of the PropertyVariable instance.
PROPERTY_PURPOSE m_purpose
 The purpose of this property.
PropertyChangeSignalType signal_PropertyChange
 Signal getting fired whenever the property changes.
boost::shared_ptr< WConditionSetm_updateCondition
 Condition notified whenever something changes.

Detailed Description

Abstract base class for all properties.

Simply provides name and type information.

Definition at line 44 of file WPropertyBase.h.


Member Typedef Documentation

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

Convenience typedef for a boost::shared_ptr< const WPropertyBase >

Reimplemented in WPropertyVariable< T >, and WProperties.

Definition at line 55 of file WPropertyBase.h.

typedef boost::function<void ( boost::shared_ptr< WPropertyBase > )> WPropertyBase::PropertyChangeNotifierType

Signal signature emitted during set operations.

Definition at line 282 of file WPropertyBase.h.

typedef boost::signals2::signal<void ( boost::shared_ptr< WPropertyBase > )> WPropertyBase::PropertyChangeSignalType
protected

Signal used for firing change signals.

Definition at line 319 of file WPropertyBase.h.

typedef boost::shared_ptr< WPropertyBase > WPropertyBase::SPtr

Convenience typedef for a boost::shared_ptr< WPropertyBase >

Reimplemented in WPropertyVariable< T >, and WProperties.

Definition at line 50 of file WPropertyBase.h.


Constructor & Destructor Documentation

WPropertyBase::WPropertyBase ( std::string  name,
std::string  description 
)

Create an empty named property.

Parameters:
namethe name of the property
descriptionthe description of the property

Definition at line 39 of file WPropertyBase.cpp.

References m_name.

WPropertyBase::WPropertyBase ( const WPropertyBase 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.

Parameters:
fromthe instance to copy.

Definition at line 56 of file WPropertyBase.cpp.

WPropertyBase::~WPropertyBase ( )
virtual

Destructor.

Definition at line 68 of file WPropertyBase.cpp.


Member Function Documentation

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

Implemented in WPropertyVariable< T >, and WProperties.

virtual std::string WPropertyBase::getAsString ( )
pure 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.

Implemented in WPropertyVariable< T >, and WProperties.

std::string WPropertyBase::getDescription ( ) const

Gets the description of the property.

Returns:
the description

Definition at line 78 of file WPropertyBase.cpp.

References m_description.

std::string WPropertyBase::getName ( ) const

Gets the name of the class.

Returns:
the name.

Definition at line 73 of file WPropertyBase.cpp.

References m_name.

Referenced by WProperties::addProperty().

PROPERTY_PURPOSE WPropertyBase::getPurpose ( ) const
virtual

Gets the purpose of a property.

See PROPERTY_PURPOSE for more details. For short: it helps the GUI and others to understand what a module (or whomever created this property) intents with this property. Typically this value is PV_PURPOSE_PARAMETER, meaning that it is used to tune the behaviour of a module.

Notes:
always assume this to be a hint. It does not actually prevent someone from writing or interpreting a parameter property as an information property.
See also:
PROPERTY_PURPOSE
Returns:
the purpose.

Definition at line 88 of file WPropertyBase.cpp.

References m_purpose.

Referenced by WProperties::addProperty().

PROPERTY_TYPE WPropertyBase::getType ( ) const
virtual

Gets the real WPropertyVariable type of this instance.

Returns:
the real type.

Reimplemented in WProperties.

Definition at line 83 of file WPropertyBase.cpp.

References m_type.

boost::shared_ptr< WCondition > WPropertyBase::getUpdateCondition ( ) const
virtual

This method returns a condition which gets fired whenever the property changes somehow.

It is fired when:

Returns:
a condition notified whenever something changes.

Definition at line 172 of file WPropertyBase.cpp.

References m_updateCondition.

bool WPropertyBase::isHidden ( ) const

Determines whether the property is hidden or not.

Returns:
true if hidden

Definition at line 103 of file WPropertyBase.cpp.

References m_hidden.

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

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

Implemented in WPropertyVariable< T >, and WProperties.

virtual bool WPropertyBase::setAsString ( std::string  value)
pure 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.

Implemented in WPropertyVariable< T >, and WProperties.

void WPropertyBase::setHidden ( bool  hidden = true)

Sets the property hidden.

This flag is especially used by the GUI.

Parameters:
hiddentrue if it should be hidden.

Definition at line 108 of file WPropertyBase.cpp.

References m_hidden, and m_updateCondition.

void WPropertyBase::setPurpose ( PROPERTY_PURPOSE  purpose)
virtual

Sets the purpose of the property.

See getPurpose for more details. You generally should avoid setting this value after initialization.

Parameters:
purposethe purpose to set.

Definition at line 93 of file WPropertyBase.cpp.

References m_purpose.

WPropBool WPropertyBase::toPropBool ( )

Helper converts this instance to its native type.

Returns:
the property as bool property

Definition at line 127 of file WPropertyBase.cpp.

WPropColor WPropertyBase::toPropColor ( )

Helper converts this instance to its native type.

Returns:
the property as color property

Definition at line 147 of file WPropertyBase.cpp.

WPropDouble WPropertyBase::toPropDouble ( )

Helper converts this instance to its native type.

Returns:
the property as double property

Definition at line 122 of file WPropertyBase.cpp.

template<typename T >
boost::shared_ptr< WPropertyVariable< T > > WPropertyBase::toPropertyVariable ( )

Helper converts this instance to an arbitrary type.

Returns:
the property of given type of NULL if not valid type

Definition at line 336 of file WPropertyBase.h.

WPropFilename WPropertyBase::toPropFilename ( )

Helper converts this instance to its native type.

Returns:
the property as path property

Definition at line 137 of file WPropertyBase.cpp.

WPropGroup WPropertyBase::toPropGroup ( )

Helper converts this instance to its native type.

Returns:
the property as group

Definition at line 157 of file WPropertyBase.cpp.

Referenced by WProperties::findProperty().

WPropInt WPropertyBase::toPropInt ( )

Helper converts this instance to its native type.

Returns:
the property as integer property

Definition at line 117 of file WPropertyBase.cpp.

WPropMatrix4X4 WPropertyBase::toPropMatrix4X4 ( )

Helper converts this instance to its native type.

Returns:
the property as matrix4x4 property

Definition at line 162 of file WPropertyBase.cpp.

WPropPosition WPropertyBase::toPropPosition ( )

Helper converts this instance to its native type.

Returns:
the property as position property

Definition at line 152 of file WPropertyBase.cpp.

WPropSelection WPropertyBase::toPropSelection ( )

Helper converts this instance to its native type.

Returns:
the property as selection property

Definition at line 142 of file WPropertyBase.cpp.

WPropString WPropertyBase::toPropString ( )

Helper converts this instance to its native type.

Returns:
the property as string property

Definition at line 132 of file WPropertyBase.cpp.

WPropTrigger WPropertyBase::toPropTrigger ( )

Helper converts this instance to its native type.

Returns:
the property as trigger property

Definition at line 167 of file WPropertyBase.cpp.

void WPropertyBase::updateType ( )
protectedvirtual

Calculates the type of the property.

This has to be done by the implementing class.

Reimplemented in WPropertyVariable< T >.

Definition at line 98 of file WPropertyBase.cpp.

References m_type.


Member Data Documentation

std::string WPropertyBase::m_description
protected

Description of the property.

Definition at line 294 of file WPropertyBase.h.

Referenced by getDescription().

bool WPropertyBase::m_hidden
protected

Flag denoting whether the property is hidden or not.

Definition at line 299 of file WPropertyBase.h.

Referenced by isHidden(), and setHidden().

std::string WPropertyBase::m_name
protected

Name of the property.

Definition at line 289 of file WPropertyBase.h.

Referenced by getName(), and WPropertyBase().

PROPERTY_PURPOSE WPropertyBase::m_purpose
protected

The purpose of this property.

PropertyBase always initializes it with PV_PURPOSE_PARAMETER.

Definition at line 309 of file WPropertyBase.h.

Referenced by getPurpose(), and setPurpose().

PROPERTY_TYPE WPropertyBase::m_type
protected

Type of the PropertyVariable instance.

Definition at line 304 of file WPropertyBase.h.

Referenced by getType(), and updateType().

boost::shared_ptr< WConditionSet > WPropertyBase::m_updateCondition
protected

Condition notified whenever something changes.

See getUpdateCondition for more details.

See also:
getUpdateCondition

Definition at line 330 of file WPropertyBase.h.

Referenced by getUpdateCondition(), setHidden(), WProperties::WProperties(), and WPropertyVariable< T >::WPropertyVariable().

PropertyChangeSignalType WPropertyBase::signal_PropertyChange
protected

Signal getting fired whenever the property changes.

Definition at line 324 of file WPropertyBase.h.

Referenced by WPropertyVariable< T >::WPropertyVariable().


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