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

PropertyValue class. More...

#include <PropertyValue.hpp>

Inherits PropertyValueBase.

Public Types

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

Public Member Functions

 PropertyValue (T value)
 Constructs PropertyValue. More...
 
 PropertyValue (const PropertyType &type, T value)
 Constructs PropertyValue. More...
 
virtual ~PropertyValue ()
 Destroys PropertyValue 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...
 
void setValue (const T &value)
 Sets the property value. More...
 
PropertyValue< T > * clone () const
 Construct a clone of the property. More...
 
- Public Member Functions inherited from PropertyValueBase
 PropertyValueBase ()
 Constructor.
 
 PropertyValueBase (const PropertyType &type)
 Constructor. More...
 
virtual ~PropertyValueBase ()
 Destroys PropertyValueBase.
 
const rw::core::PropertyTypegetType () const
 Returns the PropertyType. More...
 
ChangedEventchangedEvent ()
 get changed event More...
 

Detailed Description

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

PropertyValue class.

The PropertyValue class is a template to support property values of any type.

Constructor & Destructor Documentation

◆ PropertyValue() [1/2]

PropertyValue ( value)
inline

Constructs PropertyValue.

Constructs a PropertyValue and tries to auto detect the type.

Parameters
value[in] value

◆ PropertyValue() [2/2]

PropertyValue ( const PropertyType type,
value 
)
inline

Constructs PropertyValue.

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

Member Function Documentation

◆ clone()

PropertyValue<T>* clone ( ) const
inlinevirtual

Construct a clone of the property.

Implements PropertyValueBase.

◆ 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: