diff options
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/Broadcaster.hpp | 12 | ||||
-rw-r--r-- | src/server/EventWriter.cpp | 19 | ||||
-rw-r--r-- | src/server/EventWriter.hpp | 6 | ||||
-rw-r--r-- | src/server/events/Delta.cpp | 16 |
4 files changed, 30 insertions, 23 deletions
diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp index 2d184559..fd8d3996 100644 --- a/src/server/Broadcaster.hpp +++ b/src/server/Broadcaster.hpp @@ -102,13 +102,14 @@ public: void put(const Raul::URI& uri, const Properties& properties, Resource::Graph ctx = Resource::Graph::DEFAULT) { - BROADCAST(put, uri, properties); + BROADCAST(put, uri, properties, ctx); } void delta(const Raul::URI& uri, const Properties& remove, - const Properties& add) { - BROADCAST(delta, uri, remove, add); + const Properties& add, + Resource::Graph ctx = Resource::Graph::DEFAULT) { + BROADCAST(delta, uri, remove, add, ctx); } void copy(const Raul::URI& old_uri, @@ -142,8 +143,9 @@ public: void set_property(const Raul::URI& subject, const Raul::URI& predicate, - const Atom& value) { - BROADCAST(set_property, subject, predicate, value); + const Atom& value, + Resource::Graph ctx = Resource::Graph::DEFAULT) { + BROADCAST(set_property, subject, predicate, value, ctx); } Raul::URI uri() const { return Raul::URI("ingen:/broadcaster"); } diff --git a/src/server/EventWriter.cpp b/src/server/EventWriter.cpp index 1cd573b2..28a8d319 100644 --- a/src/server/EventWriter.cpp +++ b/src/server/EventWriter.cpp @@ -78,14 +78,14 @@ EventWriter::put(const Raul::URI& uri, } void -EventWriter::delta(const Raul::URI& uri, - const Properties& remove, - const Properties& add) +EventWriter::delta(const Raul::URI& uri, + const Properties& remove, + const Properties& add, + const Resource::Graph ctx) { _engine.enqueue_event( new Events::Delta(_engine, _respondee, _request_id, now(), - Events::Delta::Type::PATCH, Resource::Graph::DEFAULT, - uri, add, remove), + Events::Delta::Type::PATCH, ctx, uri, add, remove), _event_mode); } @@ -149,13 +149,14 @@ EventWriter::disconnect_all(const Raul::Path& graph, } void -EventWriter::set_property(const Raul::URI& uri, - const Raul::URI& predicate, - const Atom& value) +EventWriter::set_property(const Raul::URI& uri, + const Raul::URI& predicate, + const Atom& value, + const Resource::Graph ctx) { _engine.enqueue_event( new Events::Delta(_engine, _respondee, _request_id, now(), - Events::Delta::Type::SET, Resource::Graph::DEFAULT, + Events::Delta::Type::SET, ctx, uri, {{predicate, value}}, {}), _event_mode); } diff --git a/src/server/EventWriter.hpp b/src/server/EventWriter.hpp index 32e3b249..18e98421 100644 --- a/src/server/EventWriter.hpp +++ b/src/server/EventWriter.hpp @@ -63,7 +63,8 @@ public: virtual void delta(const Raul::URI& path, const Properties& remove, - const Properties& add); + const Properties& add, + Resource::Graph ctx = Resource::Graph::DEFAULT); virtual void copy(const Raul::URI& old_uri, const Raul::URI& new_uri); @@ -79,7 +80,8 @@ public: virtual void set_property(const Raul::URI& subject_path, const Raul::URI& predicate, - const Atom& value); + const Atom& value, + Resource::Graph ctx = Resource::Graph::DEFAULT); virtual void del(const Raul::URI& uri); diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 9f4c1da2..ecc1830a 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -364,7 +364,7 @@ Delta::pre_process(PreProcessContext& ctx) if (value.get<int32_t>() < 1 || value.get<int32_t>() > 128) { _status = Status::INVALID_POLY; } else { - op = SpecialType::POLYPHONY; + op = SpecialType::POLYPHONY; _graph->prepare_internal_poly( *_engine.buffer_factory(), value.get<int32_t>()); } @@ -585,7 +585,7 @@ Delta::post_process() } break; case Type::PATCH: - _engine.broadcaster()->delta(_subject, _remove, _properties); + _engine.broadcaster()->delta(_subject, _remove, _properties, _context); break; } } @@ -597,15 +597,17 @@ Delta::undo(Interface& target) if (_create_event) { _create_event->undo(target); } else if (_type == Type::PATCH) { - target.delta(_subject, _added, _removed); + target.delta(_subject, _added, _removed, _context); } else if (_type == Type::SET || _type == Type::PUT) { if (_removed.size() == 1) { - target.set_property( - _subject, _removed.begin()->first, _removed.begin()->second); + target.set_property(_subject, + _removed.begin()->first, + _removed.begin()->second, + _context); } else if (_removed.empty()) { - target.delta(_subject, _added, {}); + target.delta(_subject, _added, {}, _context); } else { - target.put(_subject, _removed); + target.put(_subject, _removed, _context); } } } |