add function to property that return a unique string for their type

This commit is contained in:
Alexandra Heuschling
2020-11-26 17:50:48 +01:00
parent e81a771656
commit 52dd8dcbc5
2 changed files with 18 additions and 0 deletions

View File

@@ -133,6 +133,9 @@ public: // I/O support
/// persistency. /// persistency.
virtual void set_persistent( bool _yn ) = 0; virtual void set_persistent( bool _yn ) = 0;
///returns a unique string for the type of the elements
virtual std::string get_storage_name() const = 0;
/// Number of elements in property /// Number of elements in property
virtual size_t n_elements() const = 0; virtual size_t n_elements() const = 0;

View File

@@ -54,6 +54,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <algorithm> #include <algorithm>
#include <OpenMesh/Core/Utils/typename.hh>
//== NAMESPACES =============================================================== //== NAMESPACES ===============================================================
@@ -207,6 +208,10 @@ public: // data access interface
return p; return p;
} }
std::string get_storage_name() const override
{
return get_string_for_type(T());
}
private: private:
@@ -371,6 +376,11 @@ public:
return p; return p;
} }
std::string get_storage_name() const override
{
return get_string_for_type(bool());
}
private: private:
@@ -457,6 +467,11 @@ public:
PropertyT<value_type>* p = new PropertyT<value_type>( *this ); PropertyT<value_type>* p = new PropertyT<value_type>( *this );
return p; return p;
} }
std::string get_storage_name() const override
{
return get_string_for_type(std::string());
}
private: private:
vector_type data_; vector_type data_;