diff --git a/modules/base/src/export_helper/generic_property_def.hh b/modules/base/src/export_helper/generic_property_def.hh index 785bcce900b6ab8ee2f5eca3aeb68d5c87923695..84a486bc371c0694002a917d08a988299b59e2fe 100644 --- a/modules/base/src/export_helper/generic_property_def.hh +++ b/modules/base/src/export_helper/generic_property_def.hh @@ -156,6 +156,7 @@ void const_generic_prop_def(O& bp_class) .def("GetIntProp", get_int2) .def("GetStringProp", get_str1) .def("GetStringProp", get_str2) + .def("GetPropList",&C::GetPropList) .def("GetGenericBoolProperty", &depr_get_bool_a<C>) .def("GetGenericBoolProperty", &depr_get_bool_b<C>) .def("GetGenericFloatProperty", &depr_get_float_a<C>) @@ -180,6 +181,7 @@ void generic_prop_def(O& bp_class) .def("SetFloatProp", &C::SetFloatProp) .def("SetIntProp", &C::SetIntProp) .def("SetStringProp", &C::SetStringProp) + .def("GetPropList",&C::GetPropList) .def("ClearGenericProperties", &depr_clear_props<C>) .def("SetGenericIntProperty", &depr_set_int<C>) .def("SetGenericFloatProperty", &depr_set_float<C>) @@ -189,4 +191,4 @@ void generic_prop_def(O& bp_class) ; } -#endif \ No newline at end of file +#endif diff --git a/modules/base/src/generic_property.hh b/modules/base/src/generic_property.hh index 12e53932e1ad7217bb50d7eefdded0733cc7e5c3..8787d95bd0632507630fd01cd874a991a410945e 100644 --- a/modules/base/src/generic_property.hh +++ b/modules/base/src/generic_property.hh @@ -31,6 +31,7 @@ #include <exception> #include <sstream> #include <map> +#include <vector> #include <boost/variant.hpp> #include <ost/module_config.hh> @@ -109,6 +110,7 @@ public: map_->erase(key); } } + void Assign(const GenericPropContainerImpl& impl) { if (impl.map_) { @@ -130,6 +132,17 @@ public: return *map_; } + std::vector<String> GetPropList() const + { + std::vector<String> prop_list; + if (map_) { + PropertyMap::const_iterator i; + for (i=map_->begin(); i!=map_->end(); ++i) { + prop_list.push_back(i->first); + } + } + return prop_list; + } private: mutable PropertyMap* map_; @@ -189,12 +202,13 @@ public: rep << this->GetImpl()->GenericProp(key); return rep.str(); } - /// \brief returns String property, raises an exception if it does not exist - String GetStringProp(const String& key) const - { - CheckHandleValidity(*static_cast<const H*>(this)); - return this->gp_get<String>(key); - } + + /// \brief returns String property, raises an exception if it does not exist + String GetStringProp(const String& key) const + { + CheckHandleValidity(*static_cast<const H*>(this)); + return this->gp_get<String>(key); + } /// \brief returns floating point property, raises an exception if it does /// not exist @@ -279,6 +293,12 @@ public: CheckHandleValidity(*static_cast<const H*>(this)); return this->GetImpl()->GetPropMap(); } + + std::vector<String> GetPropList() const + { + CheckHandleValidity(*static_cast<const H*>(this)); + return this->GetImpl()->GetPropList(); + } }; /// \brief base class for the handler classes