33 #ifndef __H__LIB_GRID__SERIALIZATION_IMPL__
34 #define __H__LIB_GRID__SERIALIZATION_IMPL__
71 template <
class TIterator>
75 for(TIterator iter = begin; iter != end; ++iter)
79 template<
class TGeomObj,
class TSerializers>
82 TSerializers& serializers)
const
85 for(
size_t i = 0; i < serializers.size(); ++i){
86 serializers[i]->write_data(out, o);
120 template <
class TIterator>
124 for(TIterator iter = begin; iter != end; ++iter)
128 template<
class TGeomObj,
class TDeserializers>
131 TDeserializers& deserializers)
134 for(
size_t i = 0; i < deserializers.size(); ++i){
135 deserializers[i]->read_data(in, o);
143 template <
class TElem,
class TAttachment>
147 return SerializeAttachment<TElem, TAttachment>(
156 template <
class TElem,
class TAttachment>
167 typedef typename TAttachment::ValueType ValueType;
170 int magicNumber = 8304548;
171 out.
write((
char*)&magicNumber,
sizeof(
int));
179 for(; iterBegin != iterEnd; ++iterBegin)
181 out.
write((
char*)&aa[*iterBegin],
sizeof(ValueType));
183 out.
write((
char*)&magicNumber,
sizeof(
int));
191 template <
class TElem,
class TAttachment>
195 return DeserializeAttachment<TElem, TAttachment>(
196 grid, attachment, grid.
begin<TElem>(),
197 grid.
end<TElem>(), in);
202 template <
class TElem,
class TAttachment>
213 typedef typename TAttachment::ValueType ValueType;
217 int magicNumber = 8304548;
219 in.
read((
char*)&tInt,
sizeof(
int));
221 if(tInt != magicNumber){
222 UG_LOG(
" WARNING: magic-number mismatch before read in DeserializeAttachment. Data-salad possible!\n");
236 for(; iterBegin != iterEnd; ++iterBegin)
238 in.
read((
char*)&aa[*iterBegin],
sizeof(ValueType));
240 in.
read((
char*)&tInt,
sizeof(
int));
242 if(tInt != magicNumber){
243 UG_LOG(
" WARNING: magic-number mismatch after read in DeserializeAttachment. Data-salad possible!\n");
A Buffer for binary data.
Definition: binary_buffer.h:56
void read(char *buf, size_t size)
reads data of the given size (in bytes)
Definition: binary_buffer_impl.h:58
void write(const char *buf, size_t size)
writes data of the given size (in bytes)
Definition: binary_buffer_impl.h:71
Base-class for edges.
Definition: grid_base_objects.h:397
Faces are 2-dimensional objects.
Definition: grid_base_objects.h:510
the generic attachment-accessor for access to grids attachment pipes.
Definition: grid.h:182
void deserialize(BinaryBuffer &in, Vertex *vrt)
Deserializes data associated with the given object.
Definition: serialization_impl.hpp:93
std::vector< SPVolumeDataSerializer > m_volSerializers
Definition: serialization.h:275
std::vector< SPFaceDataSerializer > m_faceSerializers
Definition: serialization.h:274
std::vector< SPGridDataSerializer > m_gridSerializers
Definition: serialization.h:276
std::vector< SPEdgeDataSerializer > m_edgeSerializers
Definition: serialization.h:273
void serialize(BinaryBuffer &out, Vertex *vrt) const
Serializes data associated with the given object.
Definition: serialization_impl.hpp:44
std::vector< SPVertexDataSerializer > m_vrtSerializers
Definition: serialization.h:272
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
void attach_to(IAttachment &attachment, bool passOnValues)
attach with custom pass-on-behaviour and unspecified default value.
Definition: grid_impl.hpp:296
bool has_attachment(IAttachment &attachment)
Definition: grid.h:796
geometry_traits< TGeomObj >::iterator begin()
Definition: grid_impl.hpp:164
geometry_traits< TGeomObj >::iterator end()
Definition: grid_impl.hpp:175
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
Volumes are 3-dimensional objects.
Definition: grid_base_objects.h:754
Definition: grid_base_object_traits.h:68
bool SerializeAttachment(Grid &grid, TAttachment &attachment, BinaryBuffer &out)
Definition: serialization_impl.hpp:144
bool DeserializeAttachment(Grid &grid, TAttachment &attachment, BinaryBuffer &in)
copies attached values from a binary stream
Definition: serialization_impl.hpp:192
#define UG_LOG(msg)
Definition: log.h:367