Move PrimitiveWrapper to serialization common

This commit is contained in:
Robbert van der Helm
2022-09-10 18:00:44 +02:00
parent 6865cbd937
commit c0c2a61f03
2 changed files with 22 additions and 22 deletions
+22
View File
@@ -44,6 +44,28 @@ struct Ack {
void serialize(S&) {}
};
/**
* A simple wrapper around primitive values for serialization purposes. Bitsery
* doesn't seem to like serializing plain primitives using `s.object()` even if
* you define a serialization function.
*/
template <typename T>
class PrimitiveWrapper {
public:
PrimitiveWrapper() noexcept {}
PrimitiveWrapper(T value) noexcept : value_(value) {}
operator T() const noexcept { return value_; }
template <typename S>
void serialize(S& s) {
s.template value<sizeof(T)>(value_);
}
private:
T value_;
};
/**
* Marker struct to indicate the other side (the plugin) should send a copy of
* the configuration. During this process we will also transmit the version
-22
View File
@@ -142,28 +142,6 @@ class NativeUID {
ArrayUID uid_;
};
/**
* A simple wrapper around primitive values for serialization purposes. Bitsery
* doesn't seem to like serializing plain primitives using `s.object()` even if
* you define a serialization function.
*/
template <typename T>
class PrimitiveWrapper {
public:
PrimitiveWrapper() noexcept {}
PrimitiveWrapper(T value) noexcept : value_(value) {}
operator T() const noexcept { return value_; }
template <typename S>
void serialize(S& s) {
s.template value<sizeof(T)>(value_);
}
private:
T value_;
};
/**
* A wrapper around `Steinberg::tresult` that we can safely share between the
* native plugin and the Wine process. Depending on the platform and on whether