OpenVolumeMesh
Loading...
Searching...
No Matches
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
54namespace OpenVolumeMesh {
55
56template <class T>
58
59class ResourceManager;
60
61template <class T>
62const std::string typeName();
63
64template <> const std::string typeName<int>();
65template <> const std::string typeName<unsigned int>();
66template <> const std::string typeName<short>();
67template <> const std::string typeName<long>();
68template <> const std::string typeName<unsigned long>();
69template <> const std::string typeName<char>();
70template <> const std::string typeName<unsigned char>();
71template <> const std::string typeName<bool>();
72template <> const std::string typeName<float>();
73template <> const std::string typeName<double>();
74template <> const std::string typeName<std::string>();
75
77template<class T>
78class VertexPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, VertexPropHandle> {
79public:
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};
87template<class T>
88class EdgePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, EdgePropHandle> {
89public:
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};
97template<class T>
98class HalfEdgePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfEdgePropHandle> {
99public:
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};
107template<class T>
108class FacePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, FacePropHandle> {
109public:
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};
117template<class T>
118class HalfFacePropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfFacePropHandle> {
119public:
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};
127template<class T>
128class CellPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, CellPropHandle> {
129public:
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};
137template<class T>
138class MeshPropertyT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, MeshPropHandle> {
139public:
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_ */
Definition ResourceManager.hh:70
Definition ResourceManager.hh:62
Definition ResourceManager.hh:66
Definition ResourceManager.hh:64
Definition ResourceManager.hh:68
Definition ResourceManager.hh:72
OpenVolumeMeshPropertyT(const std::string &_name="<unknown>", const T _def=T())
Default constructor.
Definition OpenVolumeMeshProperty.hh:85
Definition ResourceManager.hh:74
Definition PropertyHandles.hh:51
Property classes for the different entity types.
Definition ResourceManager.hh:60
VertexPropertyT(const std::string &_name, ResourceManager &_resMan, VertexPropHandle _handle, const T _def=T())
Property classes for the different entity types.
Definition PropertyDefinesT.cc:54