diff --git a/vcg/complex/trimesh/allocate.h b/vcg/complex/trimesh/allocate.h index 4ce1b582..9b1afccd 100644 --- a/vcg/complex/trimesh/allocate.h +++ b/vcg/complex/trimesh/allocate.h @@ -1235,10 +1235,17 @@ public: virtual std::string Name() = 0; virtual std::string TypeID() = 0; - virtual void AddPerVertexAttribute(MeshType & m) = 0; - virtual void AddPerFaceAttribute(MeshType & m) = 0; - virtual void AddPerEdgeAttribute(MeshType & m) = 0; - virtual void AddPerMeshAttribute(MeshType & m) = 0; + template + void AddPerVertexAttribute(MeshType & m){assert(0);}; + + template + void AddPerFaceAttribute(MeshType & m){assert(0);}; + + template + void AddPerEdgeAttribute(MeshType & m){assert(0);}; + + template + void AddPerMeshAttribute(MeshType & m){assert(0);}; }; @@ -1251,19 +1258,26 @@ public: template - struct NameTypeBound: public NameTypeBound_Base{ - NameTypeBound(){} - NameTypeBound(std::string name){_name = name ;} - std::string Name() {return _name;} - bool operator ==(const NameTypeBound & o ) const {return Name()==o.Name();} + struct NameTypeBound: public NameTypeBound_Base{ + NameTypeBound(){} + NameTypeBound(std::string name){_name = name ;} + std::string Name() {return _name;} + bool operator ==(const NameTypeBound & o ) const {return Name()==o.Name();} + + std::string TypeID(){ return typeid(TYPE).name();} - std::string TypeID(){ return typeid(TYPE).name();} - - void AddPerVertexAttribute(MeshType & m){Allocator::template AddPerVertexAttribute (m,_name);} - void AddPerFaceAttribute(MeshType & m) {Allocator::template AddPerFaceAttribute (m,_name);} - void AddPerEdgeAttribute(MeshType & m) {Allocator::template AddPerEdgeAttribute (m,_name);} - void AddPerMeshAttribute(MeshType & m) {Allocator::template AddPerMeshAttribute (m,_name);} - private: + template + void AddPerVertexAttribute(BoundMeshType & m){Allocator::template AddPerVertexAttribute(m,_name);} + + template + void AddPerFaceAttribute(MeshType & m) {Allocator::template AddPerFaceAttribute (m,_name);} + + template + void AddPerEdgeAttribute(MeshType & m) {Allocator::template AddPerEdgeAttribute (m,_name);} + + template + void AddPerMeshAttribute(MeshType & m) {Allocator::template AddPerMeshAttribute (m,_name);} + private: std::string _name; };