12 #ifndef SPROCKIT_COMMON_MESSAGES_spkt_serializer_H_INCLUDED 13 #define SPROCKIT_COMMON_MESSAGES_spkt_serializer_H_INCLUDED 16 #include <sst/core/serialization/serialize_packer.h> 17 #include <sst/core/serialization/serialize_sizer.h> 18 #include <sst/core/serialization/serialize_unpacker.h> 29 namespace Serialization {
78 unpacker_.unpack<T>(t);
91 set_mode(SERIALIZE_MODE mode) {
118 template <
class T,
int N>
123 sizer_.add(
sizeof(T) * N);
127 char* charstr = packer_.next_str(N*
sizeof(T));
128 ::memcpy(charstr, arr, N*
sizeof(T));
132 char* charstr = unpacker_.next_str(N*
sizeof(T));
133 ::memcpy(arr, charstr, N*
sizeof(T));
139 template <
typename T,
typename Int>
141 binary(T*& buffer, Int& size){
144 sizer_.add(
sizeof(Int));
154 packer_.pack(nullsize);
159 unpacker_.unpack(size);
172 template <
typename Int>
174 binary(
void*& buffer, Int& size){
175 char* tmp = (
char*) buffer;
176 binary<char>(tmp, size);
181 string(std::string& str);
184 start_packing(
char* buffer,
size_t size){
185 packer_.init(buffer, size);
196 start_unpacking(
char* buffer,
size_t size){
197 unpacker_.init(buffer, size);
204 case SIZER:
return sizer_.size();
205 case PACK:
return packer_.size();
206 case UNPACK:
return unpacker_.size();
217 SERIALIZE_MODE mode_;
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
void unpack_buffer(void *buf, int size)
unpack_buffer
Definition: serializer.cc:22
Definition: serialize_packer.h:23
void pack_buffer(void *buf, int size)
pack_buffer
Definition: serializer.cc:37
Definition: serialize_sizer.h:21
Definition: serialize_unpacker.h:22