Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
PropertyDefines.hh
1 /*===========================================================================*\
2  * *
3  * OpenVolumeMesh *
4  * Copyright (C) 2011 by Computer Graphics Group, RWTH Aachen *
5  * www.openvolumemesh.org *
6  * *
7  *---------------------------------------------------------------------------*
8  * This file is part of OpenVolumeMesh. *
9  * *
10  * OpenVolumeMesh is free software: you can redistribute it and/or modify *
11  * it under the terms of the GNU Lesser General Public License as *
12  * published by the Free Software Foundation, either version 3 of *
13  * the License, or (at your option) any later version with the *
14  * following exceptions: *
15  * *
16  * If other files instantiate templates or use macros *
17  * or inline functions from this file, or you compile this file and *
18  * link it with other files to produce an executable, this file does *
19  * not by itself cause the resulting executable to be covered by the *
20  * GNU Lesser General Public License. This exception does not however *
21  * invalidate any other reasons why the executable file might be *
22  * covered by the GNU Lesser General Public License. *
23  * *
24  * OpenVolumeMesh is distributed in the hope that it will be useful, *
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27  * GNU Lesser General Public License for more details. *
28  * *
29  * You should have received a copy of the GNU LesserGeneral Public *
30  * License along with OpenVolumeMesh. If not, *
31  * see <http://www.gnu.org/licenses/>. *
32  * *
33 \*===========================================================================*/
34 
35 /*===========================================================================*\
36  * *
37  * $Revision$ *
38  * $Date$ *
39  * $LastChangedBy$ *
40  * *
41 \*===========================================================================*/
42 
43 #ifndef PROPERTYDEFINES_HH_
44 #define PROPERTYDEFINES_HH_
45 
46 #include <iosfwd>
47 #include <stdexcept>
48 #include <string>
49 #include <typeinfo>
50 
51 #include "PropertyHandles.hh"
52 #include "PropertyPtr.hh"
53 
54 namespace OpenVolumeMesh {
55 
56 template <class T>
57 class OpenVolumeMeshPropertyT;
58 
59 class ResourceManager;
60 
61 template <class T>
62 const std::string typeName();
63 
64 template <> const std::string typeName<int>();
65 template <> const std::string typeName<unsigned int>();
66 template <> const std::string typeName<short>();
67 template <> const std::string typeName<long>();
68 template <> const std::string typeName<unsigned long>();
69 template <> const std::string typeName<char>();
70 template <> const std::string typeName<unsigned char>();
71 template <> const std::string typeName<bool>();
72 template <> const std::string typeName<float>();
73 template <> const std::string typeName<double>();
74 template <> const std::string typeName<std::string>();
75 
77 template<class T>
78 class VertexPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, VertexPropHandle> {
79 public:
80  VertexPropertyT(const std::string& _name, ResourceManager& _resMan, VertexPropHandle _handle, const T _def = T());
81  virtual ~VertexPropertyT() {}
82  virtual void serialize(std::ostream& _ostr) const;
83  virtual void deserialize(std::istream& _istr);
84  virtual const std::string entityType() const { return "VProp"; }
85  virtual const std::string typeNameWrapper() const { return typeName<T>(); }
86 };
87 template<class T>
88 class EdgePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, EdgePropHandle> {
89 public:
90  EdgePropertyT(const std::string& _name, ResourceManager& _resMan, EdgePropHandle _handle, const T _def = T());
91  virtual ~EdgePropertyT() {}
92  virtual void serialize(std::ostream& _ostr) const;
93  virtual void deserialize(std::istream& _istr);
94  virtual const std::string entityType() const { return "EProp"; }
95  virtual const std::string typeNameWrapper() const { return typeName<T>(); }
96 };
97 template<class T>
98 class HalfEdgePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfEdgePropHandle> {
99 public:
100  HalfEdgePropertyT(const std::string& _name, ResourceManager& _resMan, HalfEdgePropHandle _handle, const T _def = T());
101  virtual ~HalfEdgePropertyT() {}
102  virtual void serialize(std::ostream& _ostr) const;
103  virtual void deserialize(std::istream& _istr);
104  virtual const std::string entityType() const { return "HEProp"; }
105  virtual const std::string typeNameWrapper() const { return typeName<T>(); }
106 };
107 template<class T>
108 class FacePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, FacePropHandle> {
109 public:
110  FacePropertyT(const std::string& _name, ResourceManager& _resMan, FacePropHandle _handle, const T _def = T());
111  virtual ~FacePropertyT() {}
112  virtual void serialize(std::ostream& _ostr) const;
113  virtual void deserialize(std::istream& _istr);
114  virtual const std::string entityType() const { return "FProp"; }
115  virtual const std::string typeNameWrapper() const { return typeName<T>(); }
116 };
117 template<class T>
118 class HalfFacePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfFacePropHandle> {
119 public:
120  HalfFacePropertyT(const std::string& _name, ResourceManager& _resMan, HalfFacePropHandle _handle, const T _def = T());
121  virtual ~HalfFacePropertyT() {}
122  virtual void serialize(std::ostream& _ostr) const;
123  virtual void deserialize(std::istream& _istr);
124  virtual const std::string entityType() const { return "HFProp"; }
125  virtual const std::string typeNameWrapper() const { return typeName<T>(); }
126 };
127 template<class T>
128 class CellPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, CellPropHandle> {
129 public:
130  CellPropertyT(const std::string& _name, ResourceManager& _resMan, CellPropHandle _handle, const T _def = T());
131  virtual ~CellPropertyT() {}
132  virtual void serialize(std::ostream& _ostr) const;
133  virtual void deserialize(std::istream& _istr);
134  virtual const std::string entityType() const { return "CProp"; }
135  virtual const std::string typeNameWrapper() const { return typeName<T>(); }
136 };
137 template<class T>
138 class MeshPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, MeshPropHandle> {
139 public:
140  MeshPropertyT(const std::string& _name, ResourceManager& _resMan, MeshPropHandle _handle, const T _def = T());
141  virtual ~MeshPropertyT() {}
142  virtual void serialize(std::ostream& _ostr) const;
143  virtual void deserialize(std::istream& _istr);
144  virtual const std::string entityType() const { return "MProp"; }
145  virtual const std::string typeNameWrapper() const { return typeName<T>(); }
146 };
147 
148 } // Namespace OpenVolumeMesh
149 
150 #if defined(INCLUDE_TEMPLATES) && !defined(PROPERTYDEFINEST_CC)
151 #include "PropertyDefinesT.cc"
152 #endif
153 
154 #endif /* PROPERTYDEFINES_HH_ */
VertexPropertyT(const std::string &_name, ResourceManager &_resMan, VertexPropHandle _handle, const T _def=T())
Property classes for the different entity types.
DLLEXPORT QString typeName(DataType _id)
Get the name of a type with given id.
Definition: Types.cc:165
Property classes for the different entity types.