RobWorkProject  23.9.11-
Public Types | Public Member Functions | List of all members
Property< T > Class Template Reference

Property class The Property class is a template to support properties of any type. A Property is characterized by a string identifier, string description and a value of the template specified type. More...

#include <Property.hpp>

Inherits PropertyBase.

Public Types

typedef rw::core::Ptr< PropertyPtr
 smart pointer type to this class
 
- Public Types inherited from PropertyBase
typedef rw::core::Ptr< PropertyBasePtr
 smart pointer type to this class
 
typedef std::function< void(PropertyBase *)> PropertyListener
 Method signature for a callback function.
 
typedef rw::core::Event< PropertyListener, PropertyBase * > ChangedEvent
 Type for changed property events.
 

Public Member Functions

 Property (const std::string &identifier, const std::string &description, T value)
 Constructs Property. More...
 
 Property (const std::string &identifier, const std::string &description, const PropertyType &type, T value)
 Constructs Property. More...
 
virtual ~Property ()
 Destroys Property If the property value is a pointer, the object pointed to will NOT be destroyed.
 
T & getValue ()
 Returns a reference to the property value. More...
 
const T & getValue () const
 Returns a constant reference to the property value. More...
 
PropertyValue< T > & getPropertyValue ()
 returns reference to the property value More...
 
const PropertyValue< T > & getPropertyValue () const
 returns const reference to the property value More...
 
void setValue (const T &value)
 Sets the property value. More...
 
Property< T > * clone () const
 Construct a clone of the property. More...
 
- Public Member Functions inherited from PropertyBase
 PropertyBase (const std::string &identifier, const std::string &description)
 Constructor. More...
 
 PropertyBase (const std::string &identifier, const std::string &description, const PropertyType &type)
 Constructor. More...
 
virtual ~PropertyBase ()
 Destroys PropertyBase.
 
const std::string & getIdentifier () const
 Returns the Property identifier. More...
 
const std::string & getDescription () const
 Returns description. More...
 
void setDescription (const std::string &desc, bool fireChangedEvent=true)
 Set description. More...
 
ChangedEventchangedEvent ()
 get changed event More...
 
const rw::core::PropertyTypegetType () const
 Returns the PropertyType. More...
 

Detailed Description

template<class T>
class rw::core::Property< T >

Property class The Property class is a template to support properties of any type. A Property is characterized by a string identifier, string description and a value of the template specified type.

Constructor & Destructor Documentation

◆ Property() [1/2]

Property ( const std::string &  identifier,
const std::string &  description,
value 
)
inline

Constructs Property.

Constructs a Property and tries to auto detect the type.

Parameters
identifier[in] identifier
description[in] description
value[in] value

◆ Property() [2/2]

Property ( const std::string &  identifier,
const std::string &  description,
const PropertyType type,
value 
)
inline

Constructs Property.

Parameters
identifier[in] identifier
description[in] description
type[in] type of property
value[in] value

Member Function Documentation

◆ clone()

Property<T>* clone ( ) const
inlinevirtual

Construct a clone of the property.

Implements PropertyBase.

◆ getPropertyValue() [1/2]

PropertyValue<T>& getPropertyValue ( )
inlinevirtual

returns reference to the property value

Returns
value

Implements PropertyBase.

◆ getPropertyValue() [2/2]

const PropertyValue<T>& getPropertyValue ( ) const
inlinevirtual

returns const reference to the property value

Returns
value

Implements PropertyBase.

◆ getValue() [1/2]

T& getValue ( )
inline

Returns a reference to the property value.

Note
Changing the value returned by reference will NOT fire the changed event. Please consider using the setValue function if possible, or fire the event manually on change, by calling changedEvent().fire()
Returns
reference to the property value.

◆ getValue() [2/2]

const T& getValue ( ) const
inline

Returns a constant reference to the property value.

Returns
constant reference to the property value.

◆ setValue()

void setValue ( const T &  value)
inline

Sets the property value.

This function will fire the changed event.

Parameters
value[in] the new value of the Property

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