44 #ifndef OPENMESH_BASEPROPERTY_HH 45 #define OPENMESH_BASEPROPERTY_HH 48 #include <OpenMesh/Core/IO/StoreRestore.hh> 65 static const size_t UnknownSize = size_t(-1);
84 : name_(_name), persistent_(false)
89 : name_( _rhs.name_ ), persistent_( _rhs.persistent_ ) {}
97 virtual void reserve(
size_t _n) = 0;
100 virtual void resize(
size_t _n) = 0;
103 virtual void clear() = 0;
106 virtual void push_back() = 0;
109 virtual void swap(
size_t _i0,
size_t _i1) = 0;
112 virtual void copy(
size_t _io,
size_t _i1) = 0;
120 const std::string&
name()
const {
return name_; }
122 virtual void stats(std::ostream& _ostr)
const;
131 virtual void set_persistent(
bool _yn ) = 0;
134 virtual size_t n_elements()
const = 0;
137 virtual size_t element_size()
const = 0;
142 return size_of( n_elements() );
149 return (element_size()!=UnknownSize)
150 ? (_n_elem*element_size())
155 virtual size_t store( std::ostream& _ostr,
bool _swap )
const = 0;
160 virtual size_t restore( std::istream& _istr,
bool _swap ) = 0;
165 template <
typename T >
166 void check_and_set_persistent(
bool _yn )
168 if ( _yn && !IO::is_streamable<T>() )
169 omerr() <<
"Warning! Type of property value is not binary storable!\n";
170 persistent_ = IO::is_streamable<T>() && _yn;
181 #endif //OPENMESH_BASEPROPERTY_HH BaseProperty(const BaseProperty &_rhs)
Copy constructor.
Definition: BaseProperty.hh:88
bool persistent(void) const
Returns true if the persistent flag is enabled else false.
Definition: BaseProperty.hh:127
Abstract class defining the basic interface of a dynamic property.
Definition: BaseProperty.hh:60
virtual size_t size_of(size_t _n_elem) const
Estimated size of property if it has _n_elem elements.
Definition: BaseProperty.hh:147
virtual ~BaseProperty()
Destructor.
Definition: BaseProperty.hh:92
virtual size_t size_of() const
Return size of property in bytes.
Definition: BaseProperty.hh:140
BaseProperty(const std::string &_name="<unknown>")
Default constructor.
Definition: BaseProperty.hh:83
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
const std::string & name() const
Return the name of the property.
Definition: BaseProperty.hh:120
This file provides the streams omlog, omout, and omerr.