Manages a set of properties. More...
#include <property_manager.h>
Signals | |
void | configChanged () |
Emitted when changes occur which would show up in a config file. | |
Public Member Functions | |
void | addProperty (const PropertyBasePtr &property, const std::string &name, const std::string &prefix, void *user_data) |
void | changePrefix (const std::string &old_prefix, const std::string &new_prefix) |
rename a property | |
void | clear () |
CategoryPropertyWPtr | createCategory (const std::string &name, const std::string &prefix, const CategoryPropertyWPtr &parent=CategoryPropertyWPtr(), void *user_data=NULL) |
Create a category property. | |
CategoryPropertyWPtr | createCheckboxCategory (const std::string &label, const std::string &name, const std::string &prefix, const boost::function< bool(void)> &getter, const boost::function< void(bool)> &setter, const CategoryPropertyWPtr &parent=CategoryPropertyWPtr(), void *user_data=NULL) |
template<typename T , typename G , typename S > | |
boost::weak_ptr< T > | createProperty (const std::string &name, const std::string &prefix, const G &getter, const S &setter, const CategoryPropertyWPtr &parent, void *user_data=NULL) |
Create a property. | |
StatusPropertyWPtr | createStatus (const std::string &name, const std::string &prefix, const CategoryPropertyWPtr &parent=CategoryPropertyWPtr(), void *user_data=NULL) |
void | deleteByUserData (void *user_data) |
Delete all properties that have a given user data. | |
void | deleteChildren (const PropertyBasePtr &property) |
Delete all the children of a property. | |
void | deleteProperty (const PropertyBasePtr &property) |
Delete a property. | |
void | deleteProperty (const std::string &name, const std::string &prefix) |
Delete a property, by name/prefix. | |
void | emitConfigChanged () |
Emit the configChanged() signal. | |
PropertyTreeWidget * | getPropertyTreeWidget () |
Get the property grid used by this manager. | |
bool | hasProperty (const std::string &name, const std::string &prefix) |
void | load (const boost::shared_ptr< Config > &config, const StatusCallback &cb=StatusCallback()) |
Load all existing properties' values from a Config. | |
PropertyManager () | |
Constructor. | |
void | propertySet (const PropertyBasePtr &property) |
Called when a property has been set (ie, Property::changed() has been called) | |
void | refreshAll () |
void | save (const boost::shared_ptr< Config > &config) |
Save all properties into a Config. | |
void | setDefaultUserData (void *data) |
void | setPropertyTreeWidget (PropertyTreeWidget *grid) |
void | update () |
~PropertyManager () | |
Destructor. | |
Protected Types | |
typedef std::map< std::pair < std::string, std::string > , PropertyBasePtr > | M_Property |
typedef std::set < PropertyBaseWPtr > | S_PropertyBaseWPtr |
Protected Attributes | |
boost::mutex | changed_mutex_ |
S_PropertyBaseWPtr | changed_properties_ |
boost::shared_ptr< Config > | config_ |
void * | default_user_data_ |
PropertyTreeWidget * | grid_ |
M_Property | properties_ |
Manages a set of properties.
The PropertyManager manages a set of properties, allowing you to create, delete, and load/save them from disk
Definition at line 57 of file property_manager.h.
typedef std::map< std::pair<std::string, std::string>, PropertyBasePtr > rviz::PropertyManager::M_Property [protected] |
Definition at line 175 of file property_manager.h.
typedef std::set<PropertyBaseWPtr> rviz::PropertyManager::S_PropertyBaseWPtr [protected] |
Definition at line 179 of file property_manager.h.
Constructor.
grid | The property grid to be associated with these properties |
Definition at line 41 of file property_manager.cpp.
Destructor.
Definition at line 47 of file property_manager.cpp.
void rviz::PropertyManager::addProperty | ( | const PropertyBasePtr & | property, |
const std::string & | name, | ||
const std::string & | prefix, | ||
void * | user_data | ||
) |
Definition at line 52 of file property_manager.cpp.
void rviz::PropertyManager::changePrefix | ( | const std::string & | old_prefix, |
const std::string & | new_prefix | ||
) |
rename a property
Definition at line 199 of file property_manager.cpp.
void rviz::PropertyManager::clear | ( | void | ) |
Definition at line 390 of file property_manager.cpp.
void rviz::PropertyManager::configChanged | ( | ) | [signal] |
Emitted when changes occur which would show up in a config file.
CategoryPropertyWPtr rviz::PropertyManager::createCategory | ( | const std::string & | name, |
const std::string & | prefix, | ||
const CategoryPropertyWPtr & | parent = CategoryPropertyWPtr() , |
||
void * | user_data = NULL |
||
) |
Create a category property.
name | Name of the category |
parent | Parent category (may be NULL) |
Definition at line 92 of file property_manager.cpp.
CategoryPropertyWPtr rviz::PropertyManager::createCheckboxCategory | ( | const std::string & | label, |
const std::string & | name, | ||
const std::string & | prefix, | ||
const boost::function< bool(void)> & | getter, | ||
const boost::function< void(bool)> & | setter, | ||
const CategoryPropertyWPtr & | parent = CategoryPropertyWPtr() , |
||
void * | user_data = NULL |
||
) |
Definition at line 101 of file property_manager.cpp.
boost::weak_ptr<T> rviz::PropertyManager::createProperty | ( | const std::string & | name, |
const std::string & | prefix, | ||
const G & | getter, | ||
const S & | setter, | ||
const CategoryPropertyWPtr & | parent, | ||
void * | user_data = NULL |
||
) | [inline] |
Create a property.
name | Name of the property (eg, "Color") |
prefix | Prefix for the property (eg, "Head Laser Scan") |
getter | Getter object (see boost::function and boost::bind). Must be compatible with Property<T>::Getter |
setter | Setter object (see boost::function and boost::bind). Must be compatible with Property<T>::Setter |
parent | Parent category |
user_data | User data to associate with the created property |
Definition at line 82 of file property_manager.h.
StatusPropertyWPtr rviz::PropertyManager::createStatus | ( | const std::string & | name, |
const std::string & | prefix, | ||
const CategoryPropertyWPtr & | parent = CategoryPropertyWPtr() , |
||
void * | user_data = NULL |
||
) |
Definition at line 84 of file property_manager.cpp.
void rviz::PropertyManager::deleteByUserData | ( | void * | user_data | ) |
Delete all properties that have a given user data.
user_data | The user data to compare against |
Definition at line 273 of file property_manager.cpp.
void rviz::PropertyManager::deleteChildren | ( | const PropertyBasePtr & | property | ) |
Delete all the children of a property.
property | The property whose children to delete |
Definition at line 241 of file property_manager.cpp.
void rviz::PropertyManager::deleteProperty | ( | const PropertyBasePtr & | property | ) |
Delete a property.
property | The property to delete |
Definition at line 147 of file property_manager.cpp.
void rviz::PropertyManager::deleteProperty | ( | const std::string & | name, |
const std::string & | prefix | ||
) |
Delete a property, by name/prefix.
name | Name of the property |
prefix | Prefix of the property |
Definition at line 177 of file property_manager.cpp.
Emit the configChanged() signal.
Definition at line 308 of file property_manager.cpp.
Get the property grid used by this manager.
Definition at line 150 of file property_manager.h.
bool rviz::PropertyManager::hasProperty | ( | const std::string & | name, |
const std::string & | prefix | ||
) | [inline] |
Definition at line 105 of file property_manager.h.
void rviz::PropertyManager::load | ( | const boost::shared_ptr< Config > & | config, |
const StatusCallback & | cb = StatusCallback() |
||
) |
Load all existing properties' values from a Config.
config | The config to load from |
Definition at line 328 of file property_manager.cpp.
void rviz::PropertyManager::propertySet | ( | const PropertyBasePtr & | property | ) |
Called when a property has been set (ie, Property::changed() has been called)
property | The property that was set |
Definition at line 301 of file property_manager.cpp.
void rviz::PropertyManager::refreshAll | ( | ) |
Definition at line 376 of file property_manager.cpp.
void rviz::PropertyManager::save | ( | const boost::shared_ptr< Config > & | config | ) |
Save all properties into a Config.
config | The config to save to |
Definition at line 313 of file property_manager.cpp.
void rviz::PropertyManager::setDefaultUserData | ( | void * | data | ) | [inline] |
Definition at line 159 of file property_manager.h.
void rviz::PropertyManager::setPropertyTreeWidget | ( | PropertyTreeWidget * | grid | ) |
Definition at line 359 of file property_manager.cpp.
void rviz::PropertyManager::update | ( | ) |
Definition at line 110 of file property_manager.cpp.
boost::mutex rviz::PropertyManager::changed_mutex_ [protected] |
Definition at line 178 of file property_manager.h.
Definition at line 180 of file property_manager.h.
boost::shared_ptr<Config> rviz::PropertyManager::config_ [protected] |
Definition at line 184 of file property_manager.h.
void* rviz::PropertyManager::default_user_data_ [protected] |
Definition at line 182 of file property_manager.h.
PropertyTreeWidget* rviz::PropertyManager::grid_ [protected] |
Definition at line 173 of file property_manager.h.
M_Property rviz::PropertyManager::properties_ [protected] |
Definition at line 176 of file property_manager.h.