mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Move PrimitiveWrapper to serialization common
This commit is contained in:
@@ -44,6 +44,28 @@ struct Ack {
|
|||||||
void serialize(S&) {}
|
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
|
* 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
|
* the configuration. During this process we will also transmit the version
|
||||||
|
|||||||
@@ -142,28 +142,6 @@ class NativeUID {
|
|||||||
ArrayUID uid_;
|
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
|
* 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
|
* native plugin and the Wine process. Depending on the platform and on whether
|
||||||
|
|||||||
Reference in New Issue
Block a user