PropertyDefinesT_impl.hh 11.3 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*===========================================================================*\
 *                                                                           *
 *                            OpenVolumeMesh                                 *
 *        Copyright (C) 2011 by Computer Graphics Group, RWTH Aachen         *
 *                        www.openvolumemesh.org                             *
 *                                                                           *
 *---------------------------------------------------------------------------*
 *  This file is part of OpenVolumeMesh.                                     *
 *                                                                           *
 *  OpenVolumeMesh is free software: you can redistribute it and/or modify   *
 *  it under the terms of the GNU Lesser General Public License as           *
 *  published by the Free Software Foundation, either version 3 of           *
 *  the License, or (at your option) any later version with the              *
 *  following exceptions:                                                    *
 *                                                                           *
 *  If other files instantiate templates or use macros                       *
 *  or inline functions from this file, or you compile this file and         *
 *  link it with other files to produce an executable, this file does        *
 *  not by itself cause the resulting executable to be covered by the        *
 *  GNU Lesser General Public License. This exception does not however       *
 *  invalidate any other reasons why the executable file might be            *
 *  covered by the GNU Lesser General Public License.                        *
 *                                                                           *
 *  OpenVolumeMesh is distributed in the hope that it will be useful,        *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
 *  GNU Lesser General Public License for more details.                      *
 *                                                                           *
 *  You should have received a copy of the GNU LesserGeneral Public          *
 *  License along with OpenVolumeMesh.  If not,                              *
 *  see <http://www.gnu.org/licenses/>.                                      *
 *                                                                           *
\*===========================================================================*/

/*===========================================================================*\
 *                                                                           *
 *   $Revision$                                                         *
 *   $Date$                    *
 *   $LastChangedBy$                                                *
 *                                                                           *
\*===========================================================================*/

#define PROPERTYDEFINEST_CC

45
46
47
#include <istream>
#include <ostream>

48
49
50
51
52
53
#include "PropertyDefines.hh"

namespace OpenVolumeMesh {

/// Property classes for the different entity types
template<class T>
54
55
VertexPropertyT<T>::VertexPropertyT(const std::string& _name, ResourceManager& _resMan, VertexPropHandle _handle, const T _def) :
        PropertyPtr<OpenVolumeMeshPropertyT<T>, VertexPropHandle>(new OpenVolumeMeshPropertyT<T>(_name, _def), _resMan, _handle) {
56
57
58

}

59
60
61
62
63
64
65
66
67
68
template<class T>
VertexPropertyT<T>::VertexPropertyT(OpenVolumeMeshPropertyT<T> *_prop, ResourceManager &_resMan, VertexPropHandle _handle) :
        PropertyPtr<OpenVolumeMeshPropertyT<T>, VertexPropHandle>(_prop, _resMan, _handle)
{
}

template<class T>
BaseProperty *VertexPropertyT<T>::clone(ResourceManager &_resMan, OpenVolumeMeshHandle _handle) const
{
    auto prop_clone = ptr::shared_ptr<OpenVolumeMeshPropertyT<T>>::get()->clone();
69
    return new VertexPropertyT<T>(prop_clone, _resMan, VertexPropHandle(_handle.idx()));
70
71
}

72
template<class T>
73
74
void VertexPropertyT<T>::serialize(std::ostream& _ostr) const {
    PropertyPtr<OpenVolumeMeshPropertyT<T>, VertexPropHandle>::get()->serialize(_ostr);
75
76
}

Mike Kremer's avatar
Mike Kremer committed
77
template<class T>
78
void VertexPropertyT<T>::deserialize(std::istream& _istr) {
79
    PropertyPtr<OpenVolumeMeshPropertyT<T>, VertexPropHandle>::get()->deserialize(_istr);
Mike Kremer's avatar
Mike Kremer committed
80
81
}

82
template<class T>
83
84
EdgePropertyT<T>::EdgePropertyT(const std::string& _name, ResourceManager& _resMan, EdgePropHandle _handle, const T _def) :
        PropertyPtr<OpenVolumeMeshPropertyT<T>, EdgePropHandle>(new OpenVolumeMeshPropertyT<T>(_name, _def), _resMan, _handle) {
85
86

}
87
88
89
90
91
92
93
94
95
96
template<class T>
EdgePropertyT<T>::EdgePropertyT(OpenVolumeMeshPropertyT<T> *_prop, ResourceManager &_resMan, EdgePropHandle _handle) :
        PropertyPtr<OpenVolumeMeshPropertyT<T>, EdgePropHandle>(_prop, _resMan, _handle)
{
}

template<class T>
BaseProperty *EdgePropertyT<T>::clone(ResourceManager &_resMan, const OpenVolumeMeshHandle _handle) const
{
    auto prop_clone = ptr::shared_ptr<OpenVolumeMeshPropertyT<T>>::get()->clone();
97
    return new EdgePropertyT<T>(prop_clone, _resMan, EdgePropHandle(_handle.idx()));
98
}
99
100

template<class T>
101
102
void EdgePropertyT<T>::serialize(std::ostream& _ostr) const {
    PropertyPtr<OpenVolumeMeshPropertyT<T>, EdgePropHandle>::get()->serialize(_ostr);
103
104
}

Mike Kremer's avatar
Mike Kremer committed
105
template<class T>
106
void EdgePropertyT<T>::deserialize(std::istream& _istr) {
107
    PropertyPtr<OpenVolumeMeshPropertyT<T>, EdgePropHandle>::get()->deserialize(_istr);
Mike Kremer's avatar
Mike Kremer committed
108
109
}

110
template<class T>
111
112
HalfEdgePropertyT<T>::HalfEdgePropertyT(const std::string& _name, ResourceManager& _resMan, HalfEdgePropHandle _handle, const T _def) :
        PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfEdgePropHandle>(new OpenVolumeMeshPropertyT<T>(_name, _def), _resMan, _handle) {
113
114

}
115
116
117
118
119
120
121
122
123
124
template<class T>
HalfEdgePropertyT<T>::HalfEdgePropertyT(OpenVolumeMeshPropertyT<T> *_prop, ResourceManager &_resMan, HalfEdgePropHandle _handle) :
        PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfEdgePropHandle>(_prop, _resMan, _handle)
{
}

template<class T>
BaseProperty *HalfEdgePropertyT<T>::clone(ResourceManager &_resMan, const OpenVolumeMeshHandle _handle) const
{
    auto prop_clone = ptr::shared_ptr<OpenVolumeMeshPropertyT<T>>::get()->clone();
125
    return new HalfEdgePropertyT<T>(prop_clone, _resMan, HalfEdgePropHandle(_handle.idx()));
126
}
127
128

template<class T>
129
130
void HalfEdgePropertyT<T>::serialize(std::ostream& _ostr) const {
    PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfEdgePropHandle>::get()->serialize(_ostr);
131
132
}

Mike Kremer's avatar
Mike Kremer committed
133
template<class T>
134
void HalfEdgePropertyT<T>::deserialize(std::istream& _istr) {
135
    PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfEdgePropHandle>::get()->deserialize(_istr);
Mike Kremer's avatar
Mike Kremer committed
136
137
}

138
template<class T>
139
140
FacePropertyT<T>::FacePropertyT(const std::string& _name, ResourceManager& _resMan, FacePropHandle _handle, const T _def) :
        PropertyPtr<OpenVolumeMeshPropertyT<T>, FacePropHandle>(new OpenVolumeMeshPropertyT<T>(_name, _def), _resMan, _handle) {
141
142

}
143
144
145
146
147
148
149
150
151
152
template<class T>
FacePropertyT<T>::FacePropertyT(OpenVolumeMeshPropertyT<T> *_prop, ResourceManager &_resMan, FacePropHandle _handle) :
        PropertyPtr<OpenVolumeMeshPropertyT<T>, FacePropHandle>(_prop, _resMan, _handle)
{
}

template<class T>
BaseProperty *FacePropertyT<T>::clone(ResourceManager &_resMan, const OpenVolumeMeshHandle _handle) const
{
    auto prop_clone = ptr::shared_ptr<OpenVolumeMeshPropertyT<T>>::get()->clone();
153
    return new FacePropertyT<T>(prop_clone, _resMan, FacePropHandle(_handle.idx()));
154
}
155
156

template<class T>
157
158
void FacePropertyT<T>::serialize(std::ostream& _ostr) const {
    PropertyPtr<OpenVolumeMeshPropertyT<T>, FacePropHandle>::get()->serialize(_ostr);
159
160
}

Mike Kremer's avatar
Mike Kremer committed
161
template<class T>
162
void FacePropertyT<T>::deserialize(std::istream& _istr) {
163
    PropertyPtr<OpenVolumeMeshPropertyT<T>, FacePropHandle>::get()->deserialize(_istr);
Mike Kremer's avatar
Mike Kremer committed
164
165
}

166
template<class T>
167
168
HalfFacePropertyT<T>::HalfFacePropertyT(const std::string& _name, ResourceManager& _resMan, HalfFacePropHandle _handle, const T _def) :
        PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfFacePropHandle>(new OpenVolumeMeshPropertyT<T>(_name, _def), _resMan, _handle) {
169
170

}
171
172
173
174
175
176
177
178
179
180
template<class T>
HalfFacePropertyT<T>::HalfFacePropertyT(OpenVolumeMeshPropertyT<T> *_prop, ResourceManager &_resMan, HalfFacePropHandle _handle) :
        PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfFacePropHandle>(_prop, _resMan, _handle)
{
}

template<class T>
BaseProperty *HalfFacePropertyT<T>::clone(ResourceManager &_resMan, const OpenVolumeMeshHandle _handle) const
{
    auto prop_clone = ptr::shared_ptr<OpenVolumeMeshPropertyT<T>>::get()->clone();
181
    return new HalfFacePropertyT<T>(prop_clone, _resMan, HalfFacePropHandle(_handle.idx()));
182
}
183
184

template<class T>
185
186
void HalfFacePropertyT<T>::serialize(std::ostream& _ostr) const {
    PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfFacePropHandle>::get()->serialize(_ostr);
187
188
}

Mike Kremer's avatar
Mike Kremer committed
189
template<class T>
190
void HalfFacePropertyT<T>::deserialize(std::istream& _istr) {
191
    PropertyPtr<OpenVolumeMeshPropertyT<T>, HalfFacePropHandle>::get()->deserialize(_istr);
Mike Kremer's avatar
Mike Kremer committed
192
193
}

194
template<class T>
195
196
CellPropertyT<T>::CellPropertyT(const std::string& _name, ResourceManager& _resMan, CellPropHandle _handle, const T _def) :
        PropertyPtr<OpenVolumeMeshPropertyT<T>, CellPropHandle>(new OpenVolumeMeshPropertyT<T>(_name, _def), _resMan, _handle) {
197
198

}
199
200
201
202
203
204
205
206
207
208
template<class T>
CellPropertyT<T>::CellPropertyT(OpenVolumeMeshPropertyT<T> *_prop, ResourceManager &_resMan, CellPropHandle _handle) :
        PropertyPtr<OpenVolumeMeshPropertyT<T>, CellPropHandle>(_prop, _resMan, _handle)
{
}

template<class T>
BaseProperty *CellPropertyT<T>::clone(ResourceManager &_resMan, const OpenVolumeMeshHandle _handle) const
{
    auto prop_clone = ptr::shared_ptr<OpenVolumeMeshPropertyT<T>>::get()->clone();
209
    return new CellPropertyT<T>(prop_clone, _resMan, CellPropHandle(_handle.idx()));
210
}
211
212

template<class T>
213
214
void CellPropertyT<T>::serialize(std::ostream& _ostr) const {
    PropertyPtr<OpenVolumeMeshPropertyT<T>, CellPropHandle>::get()->serialize(_ostr);
215
216
}

Mike Kremer's avatar
Mike Kremer committed
217
template<class T>
218
void CellPropertyT<T>::deserialize(std::istream& _istr) {
219
    PropertyPtr<OpenVolumeMeshPropertyT<T>, CellPropHandle>::get()->deserialize(_istr);
Mike Kremer's avatar
Mike Kremer committed
220
221
}

222
template<class T>
223
224
MeshPropertyT<T>::MeshPropertyT(const std::string& _name, ResourceManager& _resMan, MeshPropHandle _handle, const T _def) :
        PropertyPtr<OpenVolumeMeshPropertyT<T>, MeshPropHandle>(new OpenVolumeMeshPropertyT<T>(_name, _def), _resMan, _handle) {
225
226

}
227
228
229
230
231
232
233
234
235
236
template<class T>
MeshPropertyT<T>::MeshPropertyT(OpenVolumeMeshPropertyT<T> *_prop, ResourceManager &_resMan, MeshPropHandle _handle) :
        PropertyPtr<OpenVolumeMeshPropertyT<T>, MeshPropHandle>(_prop, _resMan, _handle)
{
}

template<class T>
BaseProperty *MeshPropertyT<T>::clone(ResourceManager &_resMan, const OpenVolumeMeshHandle _handle) const
{
    auto prop_clone = ptr::shared_ptr<OpenVolumeMeshPropertyT<T>>::get()->clone();
237
    return new MeshPropertyT<T>(prop_clone, _resMan, MeshPropHandle(_handle.idx()));
238
}
239
240

template<class T>
241
242
void MeshPropertyT<T>::serialize(std::ostream& _ostr) const {
    PropertyPtr<OpenVolumeMeshPropertyT<T>, MeshPropHandle>::get()->serialize(_ostr);
243
244
}

Mike Kremer's avatar
Mike Kremer committed
245
template<class T>
246
void MeshPropertyT<T>::deserialize(std::istream& _istr) {
247
    PropertyPtr<OpenVolumeMeshPropertyT<T>, MeshPropHandle>::get()->deserialize(_istr);
Mike Kremer's avatar
Mike Kremer committed
248
249
}

250
251
252
253
254
template <class T>
const std::string typeName() {
    throw std::runtime_error("Serialization is not supported for these data types!");
}

255
} // Namespace OpenVolumeMesh