Skip to content

Commit 9dc71a9

Browse files
committed
Remove SERIALIZATION_SPLIT_MEMBER
SERIALIZATION_SPLIT_MEMBER generates a `template<typename Archive> sample::serialize(Archive, uint)` function that tries to detect the type of archive it is called with and then calls either `save()` or `load()`. As the `Archive` is either `eos::portable_iarchive` *or* `eos::portable_oarchive`, we can just define `serialize()` as overloaded function and avoid the overhead altogether.
1 parent c7d904a commit 9dc71a9

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/sample.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ template <class Archive> void sample::serialize_channels(Archive &ar, const uint
280280
}
281281
}
282282

283-
void sample::save(eos::portable_oarchive &ar, const uint32_t archive_version) const {
283+
void lsl::sample::serialize(eos::portable_oarchive &ar, const uint32_t archive_version) const {
284284
// write sample header
285285
if (timestamp == DEDUCED_TIMESTAMP) {
286286
ar &TAG_DEDUCED_TIMESTAMP;
@@ -291,7 +291,7 @@ void sample::save(eos::portable_oarchive &ar, const uint32_t archive_version) co
291291
const_cast<sample *>(this)->serialize_channels(ar, archive_version);
292292
}
293293

294-
void sample::load(eos::portable_iarchive &ar, const uint32_t archive_version) {
294+
void lsl::sample::serialize(eos::portable_iarchive &ar, const uint32_t archive_version) {
295295
// read sample header
296296
char tag;
297297
ar &tag;

src/sample.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "util/cast.hpp"
66
#include <atomic>
77
#include <boost/endian/conversion.hpp>
8-
#include <boost/serialization/split_member.hpp>
98
#include <cstdint>
109
#include <iosfwd>
1110
#include <limits>
@@ -304,17 +303,16 @@ class sample {
304303
default: throw std::runtime_error("Unsupported channel format for endian conversion.");
305304
}
306305
}
306+
307307
/// Serialize a sample into a portable archive (protocol 1.00).
308-
void save(eos::portable_oarchive &ar, const uint32_t archive_version) const;
308+
void serialize(eos::portable_oarchive &ar, const uint32_t archive_version) const;
309309

310310
/// Deserialize a sample from a portable archive (protocol 1.00).
311-
void load(eos::portable_iarchive &ar, const uint32_t archive_version);
311+
void serialize(eos::portable_iarchive &ar, const uint32_t archive_version);
312312

313313
/// Serialize (read/write) the channel data.
314314
template <class Archive> void serialize_channels(Archive &ar, const uint32_t archive_version);
315315

316-
BOOST_SERIALIZATION_SPLIT_MEMBER()
317-
318316
/// Assign a test pattern to the sample (for protocol validation)
319317
sample &assign_test_pattern(int offset = 1);
320318

0 commit comments

Comments
 (0)