Commit 9c6364ab authored by Mike Kremer's avatar Mike Kremer
Browse files

Added option to specify default property value for all properties.

git-svn-id: http://www.openvolumemesh.org/svnrepo/OpenVolumeMesh/trunk@217 66977474-1d4b-4f09-8fe9-267525286df2
parent 110a223b
...@@ -58,7 +58,7 @@ template <class ColT> ...@@ -58,7 +58,7 @@ template <class ColT>
class ColorAttrib { class ColorAttrib {
public: public:
ColorAttrib(TopologyKernel& _kernel); ColorAttrib(TopologyKernel& _kernel, const ColT _def = ColT());
virtual ~ColorAttrib(); virtual ~ColorAttrib();
......
...@@ -47,13 +47,13 @@ ...@@ -47,13 +47,13 @@
namespace OpenVolumeMesh { namespace OpenVolumeMesh {
template <class ColT> template <class ColT>
ColorAttrib<ColT>::ColorAttrib(TopologyKernel& _kernel) : ColorAttrib<ColT>::ColorAttrib(TopologyKernel& _kernel, const ColT _def) :
vcolor_prop_(_kernel.request_vertex_property<ColT>("vertex_color")), vcolor_prop_(_kernel.request_vertex_property<ColT>("vertex_color", _def)),
ecolor_prop_(_kernel.request_edge_property<ColT>("edge_color")), ecolor_prop_(_kernel.request_edge_property<ColT>("edge_color", _def)),
hecolor_prop_(_kernel.request_halfedge_property<ColT>("halfedge_color")), hecolor_prop_(_kernel.request_halfedge_property<ColT>("halfedge_color", _def)),
fcolor_prop_(_kernel.request_face_property<ColT>("face_color")), fcolor_prop_(_kernel.request_face_property<ColT>("face_color", _def)),
hfcolor_prop_(_kernel.request_halfface_property<ColT>("halfface_color")), hfcolor_prop_(_kernel.request_halfface_property<ColT>("halfface_color", _def)),
ccolor_prop_(_kernel.request_cell_property<ColT>("cell_color")), ccolor_prop_(_kernel.request_cell_property<ColT>("cell_color", _def)),
kernel_(_kernel) { kernel_(_kernel) {
} }
......
...@@ -81,13 +81,16 @@ public: ...@@ -81,13 +81,16 @@ public:
public: public:
/// Default constructor /// Default constructor
OpenVolumeMeshPropertyT(const std::string& _name = "<unknown>") : OpenVolumeMeshPropertyT(const std::string& _name = "<unknown>", const T _def = T()) :
OpenVolumeMeshBaseProperty(_name) { OpenVolumeMeshBaseProperty(_name),
def_(_def) {
} }
/// Copy constructor /// Copy constructor
OpenVolumeMeshPropertyT(const OpenVolumeMeshPropertyT& _rhs) : OpenVolumeMeshPropertyT(const OpenVolumeMeshPropertyT& _rhs) :
OpenVolumeMeshBaseProperty(_rhs), data_(_rhs.data_) { OpenVolumeMeshBaseProperty(_rhs),
data_(_rhs.data_),
def_(_rhs.def_) {
} }
public: public:
...@@ -96,14 +99,14 @@ public: ...@@ -96,14 +99,14 @@ public:
data_.reserve(_n); data_.reserve(_n);
} }
virtual void resize(size_t _n) { virtual void resize(size_t _n) {
data_.resize(_n, Value()); data_.resize(_n, def_);
} }
virtual void clear() { virtual void clear() {
data_.clear(); data_.clear();
vector_type().swap(data_); vector_type().swap(data_);
} }
virtual void push_back() { virtual void push_back() {
data_.push_back(T()); data_.push_back(def_);
} }
virtual void swap(size_t _i0, size_t _i1) { virtual void swap(size_t _i0, size_t _i1) {
std::swap(data_[_i0], data_[_i1]); std::swap(data_[_i0], data_[_i1]);
...@@ -190,7 +193,7 @@ public: ...@@ -190,7 +193,7 @@ public:
/// Make a copy of self. /// Make a copy of self.
OpenVolumeMeshPropertyT<T>* clone() const { OpenVolumeMeshPropertyT<T>* clone() const {
OpenVolumeMeshPropertyT<T>* p = new OpenVolumeMeshPropertyT<T> (*this); OpenVolumeMeshPropertyT<T>* p = new OpenVolumeMeshPropertyT<T>(*this);
return p; return p;
} }
...@@ -223,6 +226,8 @@ protected: ...@@ -223,6 +226,8 @@ protected:
private: private:
vector_type data_; vector_type data_;
const T def_;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -244,8 +249,9 @@ public: ...@@ -244,8 +249,9 @@ public:
public: public:
OpenVolumeMeshPropertyT(const std::string& _name = "<unknown>") : OpenVolumeMeshPropertyT(const std::string& _name = "<unknown>", const bool _def = bool()) :
OpenVolumeMeshBaseProperty(_name) { OpenVolumeMeshBaseProperty(_name),
def_(_def) {
} }
public: public:
...@@ -255,14 +261,14 @@ public: ...@@ -255,14 +261,14 @@ public:
data_.reserve(_n); data_.reserve(_n);
} }
virtual void resize(size_t _n) { virtual void resize(size_t _n) {
data_.resize(_n); data_.resize(_n, def_);
} }
virtual void clear() { virtual void clear() {
data_.clear(); data_.clear();
vector_type().swap(data_); vector_type().swap(data_);
} }
virtual void push_back() { virtual void push_back() {
data_.push_back(bool()); data_.push_back(def_);
} }
virtual void swap(size_t _i0, size_t _i1) { virtual void swap(size_t _i0, size_t _i1) {
bool t(data_[_i0]); bool t(data_[_i0]);
...@@ -339,6 +345,8 @@ protected: ...@@ -339,6 +345,8 @@ protected:
private: private:
vector_type data_; vector_type data_;
const bool def_;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -361,8 +369,9 @@ public: ...@@ -361,8 +369,9 @@ public:
public: public:
OpenVolumeMeshPropertyT(const std::string& _name = "<unknown>") : OpenVolumeMeshPropertyT(const std::string& _name = "<unknown>", const std::string _def = std::string()) :
OpenVolumeMeshBaseProperty(_name) { OpenVolumeMeshBaseProperty(_name),
def_(_def) {
} }
public: public:
...@@ -372,14 +381,14 @@ public: ...@@ -372,14 +381,14 @@ public:
data_.reserve(_n); data_.reserve(_n);
} }
virtual void resize(size_t _n) { virtual void resize(size_t _n) {
data_.resize(_n); data_.resize(_n, def_);
} }
virtual void clear() { virtual void clear() {
data_.clear(); data_.clear();
vector_type().swap(data_); vector_type().swap(data_);
} }
virtual void push_back() { virtual void push_back() {
data_.push_back(std::string()); data_.push_back(def_);
} }
virtual void swap(size_t _i0, size_t _i1) { virtual void swap(size_t _i0, size_t _i1) {
std::swap(data_[_i0], data_[_i1]); std::swap(data_[_i0], data_[_i1]);
...@@ -469,6 +478,7 @@ private: ...@@ -469,6 +478,7 @@ private:
vector_type data_; vector_type data_;
const std::string def_;
}; };
} // Namespace OpenVolumeMesh } // Namespace OpenVolumeMesh
......
...@@ -63,7 +63,7 @@ class ResourceManager; ...@@ -63,7 +63,7 @@ class ResourceManager;
template<class T> template<class T>
class VertexPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, VertexPropHandle> { class VertexPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, VertexPropHandle> {
public: public:
VertexPropertyT(const std::string& _name, ResourceManager& _resMan, VertexPropHandle _handle); VertexPropertyT(const std::string& _name, ResourceManager& _resMan, VertexPropHandle _handle, const T _def = T());
~VertexPropertyT() {} ~VertexPropertyT() {}
virtual void serialize(std::ostream& _ostr) const; virtual void serialize(std::ostream& _ostr) const;
virtual void deserialize(std::istream& _istr); virtual void deserialize(std::istream& _istr);
...@@ -71,7 +71,7 @@ public: ...@@ -71,7 +71,7 @@ public:
template<class T> template<class T>
class EdgePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, EdgePropHandle> { class EdgePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, EdgePropHandle> {
public: public:
EdgePropertyT(const std::string& _name, ResourceManager& _resMan, EdgePropHandle _handle); EdgePropertyT(const std::string& _name, ResourceManager& _resMan, EdgePropHandle _handle, const T _def = T());
~EdgePropertyT() {} ~EdgePropertyT() {}
virtual void serialize(std::ostream& _ostr) const; virtual void serialize(std::ostream& _ostr) const;
virtual void deserialize(std::istream& _istr); virtual void deserialize(std::istream& _istr);
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
template<class T> template<class T>
class HalfEdgePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfEdgePropHandle> { class HalfEdgePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfEdgePropHandle> {
public: public:
HalfEdgePropertyT(const std::string& _name, ResourceManager& _resMan, HalfEdgePropHandle _handle); HalfEdgePropertyT(const std::string& _name, ResourceManager& _resMan, HalfEdgePropHandle _handle, const T _def = T());
~HalfEdgePropertyT() {} ~HalfEdgePropertyT() {}
virtual void serialize(std::ostream& _ostr) const; virtual void serialize(std::ostream& _ostr) const;
virtual void deserialize(std::istream& _istr); virtual void deserialize(std::istream& _istr);
...@@ -87,7 +87,7 @@ public: ...@@ -87,7 +87,7 @@ public:
template<class T> template<class T>
class FacePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, FacePropHandle> { class FacePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, FacePropHandle> {
public: public:
FacePropertyT(const std::string& _name, ResourceManager& _resMan, FacePropHandle _handle); FacePropertyT(const std::string& _name, ResourceManager& _resMan, FacePropHandle _handle, const T _def = T());
~FacePropertyT() {} ~FacePropertyT() {}
virtual void serialize(std::ostream& _ostr) const; virtual void serialize(std::ostream& _ostr) const;
virtual void deserialize(std::istream& _istr); virtual void deserialize(std::istream& _istr);
...@@ -95,7 +95,7 @@ public: ...@@ -95,7 +95,7 @@ public:
template<class T> template<class T>
class HalfFacePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfFacePropHandle> { class HalfFacePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfFacePropHandle> {
public: public:
HalfFacePropertyT(const std::string& _name, ResourceManager& _resMan, HalfFacePropHandle _handle); HalfFacePropertyT(const std::string& _name, ResourceManager& _resMan, HalfFacePropHandle _handle, const T _def = T());
~HalfFacePropertyT() {} ~HalfFacePropertyT() {}
virtual void serialize(std::ostream& _ostr) const; virtual void serialize(std::ostream& _ostr) const;
virtual void deserialize(std::istream& _istr); virtual void deserialize(std::istream& _istr);
...@@ -103,7 +103,7 @@ public: ...@@ -103,7 +103,7 @@ public:
template<class T> template<class T>
class CellPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, CellPropHandle> { class CellPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, CellPropHandle> {
public: public:
CellPropertyT(const std::string& _name, ResourceManager& _resMan, CellPropHandle _handle); CellPropertyT(const std::string& _name, ResourceManager& _resMan, CellPropHandle _handle, const T _def = T());
~CellPropertyT() {} ~CellPropertyT() {}
virtual void serialize(std::ostream& _ostr) const; virtual void serialize(std::ostream& _ostr) const;
virtual void deserialize(std::istream& _istr); virtual void deserialize(std::istream& _istr);
...@@ -111,7 +111,7 @@ public: ...@@ -111,7 +111,7 @@ public:
template<class T> template<class T>
class MeshPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, MeshPropHandle> { class MeshPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, MeshPropHandle> {
public: public:
MeshPropertyT(const std::string& _name, ResourceManager& _resMan, MeshPropHandle _handle); MeshPropertyT(const std::string& _name, ResourceManager& _resMan, MeshPropHandle _handle, const T _def = T());
~MeshPropertyT() {} ~MeshPropertyT() {}
virtual void serialize(std::ostream& _ostr) const; virtual void serialize(std::ostream& _ostr) const;
virtual void deserialize(std::istream& _istr); virtual void deserialize(std::istream& _istr);
......
...@@ -49,8 +49,8 @@ namespace OpenVolumeMesh { ...@@ -49,8 +49,8 @@ namespace OpenVolumeMesh {
/// Property classes for the different entity types /// Property classes for the different entity types
template<class T> template<class T>
VertexPropertyT<T>::VertexPropertyT(const std::string& _name, ResourceManager& _resMan, VertexPropHandle _handle) : VertexPropertyT<T>::VertexPropertyT(const std::string& _name, ResourceManager& _resMan, VertexPropHandle _handle, const T _def) :
PropertyPtr<OpenVolumeMeshPropertyT<T>, VertexPropHandle>(new OpenVolumeMeshPropertyT<T>(_name), _resMan, _handle) { PropertyPtr<OpenVolumeMeshPropertyT<T>, VertexPropHandle>(new OpenVolumeMeshPropertyT<T>(_name, _def), _resMan, _handle) {
} }
...@@ -67,8 +67,8 @@ void VertexPropertyT<T>::deserialize(std::istream& _istr) { ...@@ -67,8 +67,8 @@ void VertexPropertyT<T>::deserialize(std::istream& _istr) {
} }
template<class T> template<class T>
EdgePropertyT<T>::EdgePropertyT(const std::string& _name, ResourceManager& _resMan, EdgePropHandle _handle) : EdgePropertyT<T>::EdgePropertyT(const std::string& _name, ResourceManager& _resMan, EdgePropHandle _handle, const T _def) :
PropertyPtr<OpenVolumeMeshPropertyT<T>, EdgePropHandle>(new OpenVolumeMeshPropertyT<T>(_name), _resMan, _handle) { PropertyPtr<OpenVolumeMeshPropertyT<T>, EdgePropHandle>(new OpenVolumeMeshPropertyT<T>(_name, _def), _resMan, _handle) {
} }
...@@ -85,8 +85,8 @@ void EdgePropertyT<T>::deserialize(std::istream& _istr) { ...@@ -85,8 +85,8 @@ void EdgePropertyT<T>::deserialize(std::istream& _istr) {
} }
template<class T> template<class T>
HalfEdgePropertyT<T>::HalfEdgePropertyT(const std::string& _name, ResourceManager& _resMan, HalfEdgePropHandle _handle) : HalfEdgePropertyT<T>::HalfEdgePropertyT(const std::string& _name, ResourceManager& _resMan, HalfEdgePropHandle _handle, const T _def) :
PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfEdgePropHandle>(new OpenVolumeMeshPropertyT<T>(_name), _resMan, _handle) { PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfEdgePropHandle>(new OpenVolumeMeshPropertyT<T>(_name, _def), _resMan, _handle) {
} }
...@@ -103,8 +103,8 @@ void HalfEdgePropertyT<T>::deserialize(std::istream& _istr) { ...@@ -103,8 +103,8 @@ void HalfEdgePropertyT<T>::deserialize(std::istream& _istr) {
} }
template<class T> template<class T>
FacePropertyT<T>::FacePropertyT(const std::string& _name, ResourceManager& _resMan, FacePropHandle _handle) : FacePropertyT<T>::FacePropertyT(const std::string& _name, ResourceManager& _resMan, FacePropHandle _handle, const T _def) :
PropertyPtr<OpenVolumeMeshPropertyT<T>, FacePropHandle>(new OpenVolumeMeshPropertyT<T>(_name), _resMan, _handle) { PropertyPtr<OpenVolumeMeshPropertyT<T>, FacePropHandle>(new OpenVolumeMeshPropertyT<T>(_name, _def), _resMan, _handle) {
} }
...@@ -121,8 +121,8 @@ void FacePropertyT<T>::deserialize(std::istream& _istr) { ...@@ -121,8 +121,8 @@ void FacePropertyT<T>::deserialize(std::istream& _istr) {
} }
template<class T> template<class T>
HalfFacePropertyT<T>::HalfFacePropertyT(const std::string& _name, ResourceManager& _resMan, HalfFacePropHandle _handle) : HalfFacePropertyT<T>::HalfFacePropertyT(const std::string& _name, ResourceManager& _resMan, HalfFacePropHandle _handle, const T _def) :
PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfFacePropHandle>(new OpenVolumeMeshPropertyT<T>(_name), _resMan, _handle) { PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfFacePropHandle>(new OpenVolumeMeshPropertyT<T>(_name, _def), _resMan, _handle) {
} }
...@@ -139,8 +139,8 @@ void HalfFacePropertyT<T>::deserialize(std::istream& _istr) { ...@@ -139,8 +139,8 @@ void HalfFacePropertyT<T>::deserialize(std::istream& _istr) {
} }
template<class T> template<class T>
CellPropertyT<T>::CellPropertyT(const std::string& _name, ResourceManager& _resMan, CellPropHandle _handle) : CellPropertyT<T>::CellPropertyT(const std::string& _name, ResourceManager& _resMan, CellPropHandle _handle, const T _def) :
PropertyPtr<OpenVolumeMeshPropertyT<T>, CellPropHandle>(new OpenVolumeMeshPropertyT<T>(_name), _resMan, _handle) { PropertyPtr<OpenVolumeMeshPropertyT<T>, CellPropHandle>(new OpenVolumeMeshPropertyT<T>(_name, _def), _resMan, _handle) {
} }
...@@ -157,8 +157,8 @@ void CellPropertyT<T>::deserialize(std::istream& _istr) { ...@@ -157,8 +157,8 @@ void CellPropertyT<T>::deserialize(std::istream& _istr) {
} }
template<class T> template<class T>
MeshPropertyT<T>::MeshPropertyT(const std::string& _name, ResourceManager& _resMan, MeshPropHandle _handle) : MeshPropertyT<T>::MeshPropertyT(const std::string& _name, ResourceManager& _resMan, MeshPropHandle _handle, const T _def) :
PropertyPtr<OpenVolumeMeshPropertyT<T>, MeshPropHandle>(new OpenVolumeMeshPropertyT<T>(_name), _resMan, _handle) { PropertyPtr<OpenVolumeMeshPropertyT<T>, MeshPropHandle>(new OpenVolumeMeshPropertyT<T>(_name, _def), _resMan, _handle) {
} }
......
...@@ -128,19 +128,19 @@ public: ...@@ -128,19 +128,19 @@ public:
/// Get number of cells in mesh /// Get number of cells in mesh
virtual unsigned int n_cells() const = 0; virtual unsigned int n_cells() const = 0;
template<class T> VertexPropertyT<T> request_vertex_property(const std::string& _name = std::string()); template<class T> VertexPropertyT<T> request_vertex_property(const std::string& _name = std::string(), const T _def = T());
template<class T> EdgePropertyT<T> request_edge_property(const std::string& _name = std::string()); template<class T> EdgePropertyT<T> request_edge_property(const std::string& _name = std::string(), const T _def = T());
template<class T> HalfEdgePropertyT<T> request_halfedge_property(const std::string& _name = std::string()); template<class T> HalfEdgePropertyT<T> request_halfedge_property(const std::string& _name = std::string(), const T _def = T());
template<class T> FacePropertyT<T> request_face_property(const std::string& _name = std::string()); template<class T> FacePropertyT<T> request_face_property(const std::string& _name = std::string(), const T _def = T());
template<class T> HalfFacePropertyT<T> request_halfface_property(const std::string& _name = std::string()); template<class T> HalfFacePropertyT<T> request_halfface_property(const std::string& _name = std::string(), const T _def = T());
template<class T> CellPropertyT<T> request_cell_property(const std::string& _name = std::string()); template<class T> CellPropertyT<T> request_cell_property(const std::string& _name = std::string(), const T _def = T());
template<class T> MeshPropertyT<T> request_mesh_property(const std::string& _name = std::string()); template<class T> MeshPropertyT<T> request_mesh_property(const std::string& _name = std::string(), const T _def = T());
private: private:
...@@ -291,8 +291,8 @@ private: ...@@ -291,8 +291,8 @@ private:
template<class StdVecT> template<class StdVecT>
void remove_property(StdVecT& _vec, size_t _idx); void remove_property(StdVecT& _vec, size_t _idx);
template<class StdVecT, class PropT, class HandleT> template<class StdVecT, class PropT, class HandleT, class T>
PropT request_property(StdVecT& _vec, const std::string& _name, size_t _size); PropT request_property(StdVecT& _vec, const std::string& _name, size_t _size, const T _def = T());
template<class PropT> template<class PropT>
void set_persistentT(PropT& _prop, bool _flag); void set_persistentT(PropT& _prop, bool _flag);
......
...@@ -51,49 +51,49 @@ ...@@ -51,49 +51,49 @@
namespace OpenVolumeMesh { namespace OpenVolumeMesh {
template<class T> template<class T>
VertexPropertyT<T> ResourceManager::request_vertex_property(const std::string& _name) { VertexPropertyT<T> ResourceManager::request_vertex_property(const std::string& _name, const T _def) {
return request_property<std::vector<BaseProperty*>,VertexPropertyT<T>,VertexPropHandle>(vertex_props_, _name, n_vertices()); return request_property<std::vector<BaseProperty*>,VertexPropertyT<T>,VertexPropHandle,T>(vertex_props_, _name, n_vertices(), _def);
} }
template<class T> template<class T>
EdgePropertyT<T> ResourceManager::request_edge_property(const std::string& _name) { EdgePropertyT<T> ResourceManager::request_edge_property(const std::string& _name, const T _def) {
return request_property<std::vector<BaseProperty*>,EdgePropertyT<T>,EdgePropHandle>(edge_props_, _name, n_edges()); return request_property<std::vector<BaseProperty*>,EdgePropertyT<T>,EdgePropHandle,T>(edge_props_, _name, n_edges(), _def);
} }
template<class T> template<class T>
HalfEdgePropertyT<T> ResourceManager::request_halfedge_property(const std::string& _name) { HalfEdgePropertyT<T> ResourceManager::request_halfedge_property(const std::string& _name, const T _def) {
return request_property<std::vector<BaseProperty*>,HalfEdgePropertyT<T>,HalfEdgePropHandle>(halfedge_props_, _name, n_edges()*2u); return request_property<std::vector<BaseProperty*>,HalfEdgePropertyT<T>,HalfEdgePropHandle,T>(halfedge_props_, _name, n_edges()*2u, _def);
} }
template<class T> template<class T>
FacePropertyT<T> ResourceManager::request_face_property(const std::string& _name) { FacePropertyT<T> ResourceManager::request_face_property(const std::string& _name, const T _def) {
return request_property<std::vector<BaseProperty*>,FacePropertyT<T>,FacePropHandle>(face_props_, _name, n_faces()); return request_property<std::vector<BaseProperty*>,FacePropertyT<T>,FacePropHandle,T>(face_props_, _name, n_faces(), _def);
} }
template<class T> template<class T>
HalfFacePropertyT<T> ResourceManager::request_halfface_property(const std::string& _name) { HalfFacePropertyT<T> ResourceManager::request_halfface_property(const std::string& _name, const T _def) {
return request_property<std::vector<BaseProperty*>,HalfFacePropertyT<T>,HalfFacePropHandle>(halfface_props_, _name, n_faces()*2u); return request_property<std::vector<BaseProperty*>,HalfFacePropertyT<T>,HalfFacePropHandle,T>(halfface_props_, _name, n_faces()*2u, _def);
} }
template<class T> template<class T>
CellPropertyT<T> ResourceManager::request_cell_property(const std::string& _name) { CellPropertyT<T> ResourceManager::request_cell_property(const std::string& _name, const T _def) {
return request_property<std::vector<BaseProperty*>,CellPropertyT<T>,CellPropHandle>(cell_props_, _name, n_cells()); return request_property<std::vector<BaseProperty*>,CellPropertyT<T>,CellPropHandle,T>(cell_props_, _name, n_cells(), _def);
} }
template<class T> template<class T>
MeshPropertyT<T> ResourceManager::request_mesh_property(const std::string& _name) { MeshPropertyT<T> ResourceManager::request_mesh_property(const std::string& _name, const T _def) {
return request_property<std::vector<BaseProperty*>,MeshPropertyT<T>,MeshPropHandle>(mesh_props_, _name, 1); return request_property<std::vector<BaseProperty*>,MeshPropertyT<T>,MeshPropHandle,T>(mesh_props_, _name, 1, _def);
} }
template<class StdVecT, class PropT, class HandleT> template<class StdVecT, class PropT, class HandleT, class T>
PropT ResourceManager::request_property(StdVecT& _vec, const std::string& _name, size_t _size) { PropT ResourceManager::request_property(StdVecT& _vec, const std::string& _name, size_t _size, const T _def) {
if(!_name.empty()) { if(!_name.empty()) {