mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-18 17:33:56 +02:00
Add a wrapper for serializing primitives
This commit is contained in:
@@ -60,6 +60,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() {}
|
||||||
|
PrimitiveWrapper(T value) : value(value) {}
|
||||||
|
|
||||||
|
operator T() { 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