OpenVolumeMesh
 All Classes Functions Variables Typedefs 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: 217 $ *
38  * $Date: 2012-07-18 15:04:05 +0200 (Wed, 18 Jul 2012) $ *
39  * $LastChangedBy: kremer $ *
40  * *
41 \*===========================================================================*/
42 
43 #ifndef PROPERTYDEFINES_HH_
44 #define PROPERTYDEFINES_HH_
45 
46 #include <iostream>
47 #include <typeinfo>
48 #include <stdexcept>
49 
50 #include "BaseProperty.hh"
51 #include "PropertyHandles.hh"
52 
53 namespace OpenVolumeMesh {
54 
55 template <class T>
56 class OpenVolumeMeshPropertyT;
57 template <class PropT, class HandleT>
58 class PropertyPtr;
59 
60 class ResourceManager;
61 
63 template<class T>
64 class VertexPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, VertexPropHandle> {
65 public:
66  VertexPropertyT(const std::string& _name, ResourceManager& _resMan, VertexPropHandle _handle, const T _def = T());
67  ~VertexPropertyT() {}
68  virtual void serialize(std::ostream& _ostr) const;
69  virtual void deserialize(std::istream& _istr);
70 };
71 template<class T>
72 class EdgePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, EdgePropHandle> {
73 public:
74  EdgePropertyT(const std::string& _name, ResourceManager& _resMan, EdgePropHandle _handle, const T _def = T());
75  ~EdgePropertyT() {}
76  virtual void serialize(std::ostream& _ostr) const;
77  virtual void deserialize(std::istream& _istr);
78 };
79 template<class T>
80 class HalfEdgePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfEdgePropHandle> {
81 public:
82  HalfEdgePropertyT(const std::string& _name, ResourceManager& _resMan, HalfEdgePropHandle _handle, const T _def = T());
83  ~HalfEdgePropertyT() {}
84  virtual void serialize(std::ostream& _ostr) const;
85  virtual void deserialize(std::istream& _istr);
86 };
87 template<class T>
88 class FacePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, FacePropHandle> {
89 public:
90  FacePropertyT(const std::string& _name, ResourceManager& _resMan, FacePropHandle _handle, const T _def = T());
91  ~FacePropertyT() {}
92  virtual void serialize(std::ostream& _ostr) const;
93  virtual void deserialize(std::istream& _istr);
94 };
95 template<class T>
96 class HalfFacePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfFacePropHandle> {
97 public:
98  HalfFacePropertyT(const std::string& _name, ResourceManager& _resMan, HalfFacePropHandle _handle, const T _def = T());
99  ~HalfFacePropertyT() {}
100  virtual void serialize(std::ostream& _ostr) const;
101  virtual void deserialize(std::istream& _istr);
102 };
103 template<class T>
104 class CellPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, CellPropHandle> {
105 public:
106  CellPropertyT(const std::string& _name, ResourceManager& _resMan, CellPropHandle _handle, const T _def = T());
107  ~CellPropertyT() {}
108  virtual void serialize(std::ostream& _ostr) const;
109  virtual void deserialize(std::istream& _istr);
110 };
111 template<class T>
112 class MeshPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, MeshPropHandle> {
113 public:
114  MeshPropertyT(const std::string& _name, ResourceManager& _resMan, MeshPropHandle _handle, const T _def = T());
115  ~MeshPropertyT() {}
116  virtual void serialize(std::ostream& _ostr) const;
117  virtual void deserialize(std::istream& _istr);
118 };
119 
120 template <class T>
121 const std::string typeName();
122 
123 template <> const std::string typeName<int>();
124 template <> const std::string typeName<unsigned int>();
125 template <> const std::string typeName<short>();
126 template <> const std::string typeName<long>();
127 template <> const std::string typeName<unsigned long>();
128 template <> const std::string typeName<char>();
129 template <> const std::string typeName<unsigned char>();
130 template <> const std::string typeName<bool>();
131 template <> const std::string typeName<float>();
132 template <> const std::string typeName<double>();
133 template <> const std::string typeName<std::string>();
134 
135 } // Namespace OpenVolumeMesh
136 
137 #if defined(INCLUDE_TEMPLATES) && !defined(PROPERTYDEFINEST_CC)
138 #include "PropertyDefinesT.cc"
139 #endif
140 
141 #endif /* PROPERTYDEFINES_HH_ */