25 #ifndef WPROPERTYGROUPBASE_H
26 #define WPROPERTYGROUPBASE_H
33 #include <boost/thread.hpp>
34 #include <boost/thread/locks.hpp>
35 #include <boost/thread/mutex.hpp>
36 #include <boost/thread/thread.hpp>
38 #include "WConditionSet.h"
39 #include "WPropertyBase.h"
40 #include "WPropertyTypes.h"
41 #include "WPropertyVariable.h"
42 #include "WSharedSequenceContainer.h"
78 typedef std::shared_ptr< WPropertyGroupBase >
SPtr;
83 typedef std::shared_ptr< const WPropertyGroupBase >
ConstSPtr;
141 virtual std::shared_ptr< WPropertyBase >
getProperty( std::string name );
167 virtual std::shared_ptr< WPropertyBase >
findProperty( std::string name )
const;
226 bool propNamePredicate( std::shared_ptr< WPropertyBase > prop1, std::shared_ptr< WPropertyBase > prop2 )
const;
247 template<
typename PropertyType >
253 typedef typename PropertyType::element_type::ValueType
ValueType;
267 new typename PropertyType::element_type( name, description, initial )
Abstract base class for all properties.
std::shared_ptr< WPropertyBase > SPtr
Convenience typedef for a std::shared_ptr< WPropertyBase >
This is the base class and interface for property groups.
PropertyContainerType::const_iterator PropertyConstIterator
The const iterator type of the container.
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.
bool autoHideEmpty() const
Checks whether the property group should be hidden if it is empty.
void addArbitraryProperty(WPropertyBase::SPtr prop)
Insert the specified property into the list.
virtual ~WPropertyGroupBase()
Destructor.
std::shared_ptr< const WPropertyGroupBase > ConstSPtr
Convenience typedef for a std::shared_ptr< const WPropertyGroupBase >.
WSharedSequenceContainer< PropertyContainerType > PropertySharedContainerType
The alias for a shared container.
virtual PropertySharedContainerType::ReadTicket getProperties() const
Returns a read ticket for read-access to the list of properties.
void setAutoHideEmpty(bool autoHide=true)
Should the property group be hidden automatically if it is empty? By default, this is true.
virtual PropertySharedContainerType::ReadTicket getReadTicket() const
Returns an read ticket for the properties.
bool m_autoHideEmpty
True if the prop should be hidden if if empty.
virtual std::shared_ptr< WPropertyBase > getProperty(std::string name)
Function searches the property.
static const std::string separator
The separator used to separate groups and subgroups.
std::shared_ptr< WPropertyGroupBase > SPtr
Convenience typedef for a std::shared_ptr< WPropertyGroupBase >.
virtual std::shared_ptr< WPropertyBase > findProperty(std::string name) const
Searches the property with a given name.
std::vector< std::shared_ptr< WPropertyBase > > PropertyContainerType
For shortening: a type defining a shared vector of WSubject pointers.
virtual bool existsProperty(std::string name)
Helper function that finds a property by its name.
WPropertyGroupBase(std::string name, std::string description)
Constructor.
virtual void visitAsString(PropertyStringVisitor visitor, std::string pathPrefix="") const
Visit all leafs in the property three that aren't empty groups.
PropertySharedContainerType m_properties
The set of proerties.
PropertyContainerType::iterator PropertyIterator
The iterator type of the container.
boost::function< void(std::string, std::string)> PropertyStringVisitor
The visitor type used to visit properties as strings.
std::shared_ptr< WSharedObjectTicketRead< T > > ReadTicket
Type for read tickets.
Comfortable template to create a property instance and add it to the group.
static void createAndAdd(WPropertyGroupBase *group, std::string name, std::string description, const ValueType &initial=ValueType())
Actually does the work and adds a new property with the given name, description and other parameters ...
PropertyType::element_type::ValueType ValueType
The type of the initial value.