Skip to content
Snippets Groups Projects
Commit 4f7b21e9 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[MeL] Overload Properties::size() for item types.

Counts number of properties on a given mesh item type.
parent 009dc173
No related branches found
No related tags found
No related merge requests found
......@@ -167,4 +167,12 @@ std::map<std::string, PropertyVectorBase*>::size_type Properties::size() const
{
return _properties.size();
}
std::map<std::string, PropertyVectorBase*>::size_type Properties::size(
MeshItemType const mesh_item_type) const
{
return count_if(begin(), end(), [&](auto const p) {
return p.second->getMeshItemType() == mesh_item_type;
});
}
} // end namespace MeshLib
......@@ -155,6 +155,9 @@ public:
std::map<std::string, PropertyVectorBase*>::iterator begin();
std::map<std::string, PropertyVectorBase*>::iterator end();
std::map<std::string, PropertyVectorBase*>::size_type size() const;
// Counts properties of given mesh item type.
std::map<std::string, PropertyVectorBase*>::size_type size(
MeshItemType const mesh_item_type) const;
private:
/// A mapping from property's name to the stored object of any type.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment