summaryrefslogtreecommitdiffstats
path: root/ingen/Atom.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'ingen/Atom.hpp')
-rw-r--r--ingen/Atom.hpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/ingen/Atom.hpp b/ingen/Atom.hpp
index e26462a5..4015e59e 100644
--- a/ingen/Atom.hpp
+++ b/ingen/Atom.hpp
@@ -72,7 +72,7 @@ public:
_body.ptr = (LV2_Atom*)malloc(sizeof(LV2_Atom) + _atom.size);
memcpy(_body.ptr, copy._body.ptr, sizeof(LV2_Atom) + _atom.size);
} else {
- memcpy(&_body.val, &copy._body.val, sizeof(_body.val));
+ _body.val = copy._body.val;
}
}
@@ -86,7 +86,7 @@ public:
_body.ptr = (LV2_Atom*)malloc(sizeof(LV2_Atom) + _atom.size);
memcpy(_body.ptr, other._body.ptr, sizeof(LV2_Atom) + _atom.size);
} else {
- memcpy(&_body.val, &other._body.val, sizeof(_body.val));
+ _body.val = other._body.val;
}
return *this;
}
@@ -116,6 +116,20 @@ public:
return type() < other.type();
}
+ /** Like assignment, but only works for value atoms (not references).
+ * Always real-time safe.
+ * @return true iff set succeeded.
+ */
+ inline bool set_rt(const Atom& other) {
+ if (is_reference()) {
+ return false;
+ } else {
+ _atom = other._atom;
+ _body.val = other._body.val;
+ return true;
+ }
+ }
+
inline uint32_t size() const { return _atom.size; }
inline LV2_URID type() const { return _atom.type; }
inline bool is_valid() const { return _atom.type; }