From 4ce6781bd6727fca68d4c99337f47a75d849e5ab Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 21 Oct 2011 20:41:08 +0000 Subject: Merge QueuedEvent into Event. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3569 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/Engine.cpp | 2 +- src/server/Event.cpp | 12 +++++- src/server/Event.hpp | 35 ++++++++++++----- src/server/EventSource.cpp | 20 +++++----- src/server/EventSource.hpp | 10 ++--- src/server/JackDriver.cpp | 2 +- src/server/PostProcessor.cpp | 12 +++--- src/server/PostProcessor.hpp | 12 +++--- src/server/QueuedEvent.cpp | 49 ------------------------ src/server/QueuedEvent.hpp | 70 ---------------------------------- src/server/events/Connect.cpp | 18 ++++----- src/server/events/Connect.hpp | 4 +- src/server/events/CreateNode.cpp | 8 ++-- src/server/events/CreateNode.hpp | 4 +- src/server/events/CreatePatch.cpp | 12 +++--- src/server/events/CreatePatch.hpp | 4 +- src/server/events/CreatePort.cpp | 10 ++--- src/server/events/CreatePort.hpp | 4 +- src/server/events/Deactivate.hpp | 6 +-- src/server/events/Delete.cpp | 8 ++-- src/server/events/Delete.hpp | 4 +- src/server/events/Disconnect.cpp | 14 +++---- src/server/events/Disconnect.hpp | 4 +- src/server/events/DisconnectAll.cpp | 14 +++---- src/server/events/DisconnectAll.hpp | 4 +- src/server/events/Get.cpp | 4 +- src/server/events/Get.hpp | 4 +- src/server/events/Move.cpp | 12 +++--- src/server/events/Move.hpp | 4 +- src/server/events/Ping.hpp | 6 +-- src/server/events/RegisterClient.cpp | 4 +- src/server/events/RegisterClient.hpp | 4 +- src/server/events/SetMetadata.cpp | 10 ++--- src/server/events/SetMetadata.hpp | 6 +-- src/server/events/SetPortValue.cpp | 6 +-- src/server/events/SetPortValue.hpp | 4 +- src/server/events/UnregisterClient.cpp | 2 +- src/server/events/UnregisterClient.hpp | 4 +- src/server/wscript | 1 - 39 files changed, 158 insertions(+), 255 deletions(-) delete mode 100644 src/server/QueuedEvent.cpp delete mode 100644 src/server/QueuedEvent.hpp diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 3e5ee704..c3c73468 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -134,7 +134,7 @@ Engine::set_driver(SharedPtr driver) } static void -execute_and_delete_event(ProcessContext& context, QueuedEvent* ev) +execute_and_delete_event(ProcessContext& context, Event* ev) { ev->pre_process(); ev->execute(context); diff --git a/src/server/Event.cpp b/src/server/Event.cpp index f967bfac..d69de2b9 100644 --- a/src/server/Event.cpp +++ b/src/server/Event.cpp @@ -31,14 +31,23 @@ namespace Ingen { namespace Server { +void +Event::pre_process() +{ + ThreadManager::assert_thread(THREAD_PRE_PROCESS); + assert(_pre_processed == false); + _pre_processed = true; +} + void Event::execute(ProcessContext& context) { ThreadManager::assert_thread(THREAD_PROCESS); + assert(_pre_processed); assert(!_executed); assert(_time <= context.end()); - // Missed the event, jitter, damnit. + // Didn't get around to executing in time, jitter, oh well... if (_time < context.start()) _time = context.start(); @@ -53,4 +62,3 @@ Event::post_process() } // namespace Server } // namespace Ingen - diff --git a/src/server/Event.hpp b/src/server/Event.hpp index e915631a..64e93b8b 100644 --- a/src/server/Event.hpp +++ b/src/server/Event.hpp @@ -34,14 +34,15 @@ class Engine; class Request; class ProcessContext; -/** Base class for all events (both realtime and QueuedEvent). +/** An event (command) to perform some action on Ingen. * - * This is for time-critical events like note ons. There is no non-realtime - * pre-execute method as in QueuedEvent's, any lookups etc need to be done in the - * realtime execute() method. + * Virtuall all operations on Ingen are implemented as events. An event has + * three distinct execution phases: * - * QueuedEvent extends this class with a pre_process() method for any work that needs - * to be done before processing in the realtime audio thread. + * 1) Pre-process: In a non-realtime thread, prepare event for execution + * 2) Execute: In the audio thread, execute (apply) event + * 3) Post-process: In a non-realtime thread, finalize event + * (e.g. clean up and send replies) * * \ingroup engine */ @@ -50,14 +51,17 @@ class Event : public Raul::Deletable public: virtual ~Event() {} - /** Execute this event in the audio thread (MUST be realtime safe). */ + /** Pre-process event before execution (non-realtime). */ + virtual void pre_process(); + + /** Execute this event in the audio thread (realtime). */ virtual void execute(ProcessContext& context); - /** Perform any actions after execution (ie send replies to commands) - * (no realtime requirements). */ + /** Post-process event after execution (non-realtime). */ virtual void post_process(); - inline SampleCount time() const { return _time; } + inline bool is_prepared() const { return _pre_processed; } + inline SampleCount time() const { return _time; } /** Get the next event in the event process list. */ Event* next() const { return _next.get(); } @@ -71,6 +75,16 @@ protected: , _request(request) , _time(time) , _error(0) // success + , _pre_processed(false) + , _executed(false) + {} + + /** Constructor for internal events only */ + explicit Event(Engine& engine) + : _engine(engine) + , _time(0) + , _error(0) // success + , _pre_processed(false) , _executed(false) {} @@ -79,6 +93,7 @@ protected: Raul::AtomicPtr _next; FrameTime _time; int _error; + bool _pre_processed; bool _executed; }; diff --git a/src/server/EventSource.cpp b/src/server/EventSource.cpp index 3d3e5e08..2711451e 100644 --- a/src/server/EventSource.cpp +++ b/src/server/EventSource.cpp @@ -18,7 +18,7 @@ #include "EventSource.hpp" #include "PostProcessor.hpp" #include "ProcessContext.hpp" -#include "QueuedEvent.hpp" +#include "Event.hpp" #include "ThreadManager.hpp" using namespace std; @@ -40,13 +40,13 @@ EventSource::~EventSource() /** Push an unprepared event onto the queue. */ void -EventSource::push_queued(QueuedEvent* const ev) +EventSource::push_queued(Event* const ev) { assert(!ev->is_prepared()); assert(!ev->next()); - QueuedEvent* const head = _head.get(); - QueuedEvent* const tail = _tail.get(); + Event* const head = _head.get(); + Event* const tail = _tail.get(); if (!head) { _head = ev; @@ -84,20 +84,20 @@ EventSource::process(PostProcessor& dest, ProcessContext& context, bool limit) size_t num_events_processed = 0; - QueuedEvent* ev = _head.get(); - QueuedEvent* last = ev; + Event* ev = _head.get(); + Event* last = ev; while (ev && ev->is_prepared() && ev->time() < context.end()) { ev->execute(context); last = ev; - ev = (QueuedEvent*)ev->next(); + ev = (Event*)ev->next(); ++num_events_processed; if (limit && (num_events_processed > MAX_QUEUED_EVENTS)) break; } if (num_events_processed > 0) { - QueuedEvent* next = (QueuedEvent*)last->next(); + Event* next = (Event*)last->next(); last->next(NULL); dest.append(_head.get(), last); _head = next; @@ -110,7 +110,7 @@ EventSource::process(PostProcessor& dest, ProcessContext& context, bool limit) void EventSource::_whipped() { - QueuedEvent* ev = _prepared_back.get(); + Event* ev = _prepared_back.get(); if (!ev) return; @@ -118,7 +118,7 @@ EventSource::_whipped() ev->pre_process(); assert(ev->is_prepared()); - _prepared_back = (QueuedEvent*)ev->next(); + _prepared_back = (Event*)ev->next(); } } // namespace Server diff --git a/src/server/EventSource.hpp b/src/server/EventSource.hpp index f05322e0..462a2cd8 100644 --- a/src/server/EventSource.hpp +++ b/src/server/EventSource.hpp @@ -25,7 +25,7 @@ namespace Ingen { namespace Server { class Event; -class QueuedEvent; +class Event; class PostProcessor; class ProcessContext; @@ -46,16 +46,16 @@ public: bool empty() { return !_head.get(); } protected: - void push_queued(QueuedEvent* const ev); + void push_queued(Event* const ev); inline bool unprepared_events() { return (_prepared_back.get() != NULL); } virtual void _whipped(); ///< Prepare 1 event private: - Raul::AtomicPtr _head; - Raul::AtomicPtr _prepared_back; - Raul::AtomicPtr _tail; + Raul::AtomicPtr _head; + Raul::AtomicPtr _prepared_back; + Raul::AtomicPtr _tail; }; } // namespace Server diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 11424475..11d1ff08 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -45,7 +45,7 @@ #include "PortImpl.hpp" #include "PostProcessor.hpp" #include "ProcessSlave.hpp" -#include "QueuedEvent.hpp" +#include "Event.hpp" #include "ThreadManager.hpp" #include "ingen/shared/World.hpp" #include "ingen/shared/LV2Features.hpp" diff --git a/src/server/PostProcessor.cpp b/src/server/PostProcessor.cpp index d9195027..473bcbd1 100644 --- a/src/server/PostProcessor.cpp +++ b/src/server/PostProcessor.cpp @@ -24,7 +24,7 @@ #include "Notification.hpp" #include "PostProcessor.hpp" #include "ProcessContext.hpp" -#include "QueuedEvent.hpp" +#include "Event.hpp" using namespace std; using namespace Raul; @@ -43,7 +43,7 @@ PostProcessor::~PostProcessor() } void -PostProcessor::append(QueuedEvent* first, QueuedEvent* last) +PostProcessor::append(Event* first, Event* last) { assert(first); assert(last); @@ -84,15 +84,15 @@ PostProcessor::process() } /* Process normal events */ - QueuedEvent* ev = _head.get(); + Event* ev = _head.get(); if (!ev) { return; } - QueuedEvent* const tail = _tail.get(); - _head = (QueuedEvent*)tail->next(); + Event* const tail = _tail.get(); + _head = (Event*)tail->next(); while (ev && ev->time() <= end_time) { - QueuedEvent* const next = (QueuedEvent*)ev->next(); + Event* const next = (Event*)ev->next(); ev->post_process(); delete ev; if (ev == tail) { diff --git a/src/server/PostProcessor.hpp b/src/server/PostProcessor.hpp index 9b2ca037..9fde0e43 100644 --- a/src/server/PostProcessor.hpp +++ b/src/server/PostProcessor.hpp @@ -26,7 +26,7 @@ namespace Ingen { namespace Server { -class QueuedEvent; +class Event; class Engine; /** Processor for Events after leaving the audio thread. @@ -49,7 +49,7 @@ public: /** Push a list of events on to the process queue. realtime-safe, not thread-safe. */ - void append(QueuedEvent* first, QueuedEvent* last); + void append(Event* first, Event* last); /** Post-process and delete all pending events */ void process(); @@ -58,10 +58,10 @@ public: void set_end_time(FrameTime time) { _max_time = time; } private: - Engine& _engine; - Raul::AtomicPtr _head; - Raul::AtomicPtr _tail; - Raul::AtomicInt _max_time; + Engine& _engine; + Raul::AtomicPtr _head; + Raul::AtomicPtr _tail; + Raul::AtomicInt _max_time; }; } // namespace Server diff --git a/src/server/QueuedEvent.cpp b/src/server/QueuedEvent.cpp deleted file mode 100644 index ac3c60af..00000000 --- a/src/server/QueuedEvent.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "QueuedEvent.hpp" -#include "ThreadManager.hpp" -#include "ProcessContext.hpp" - -namespace Ingen { -namespace Server { - -void -QueuedEvent::pre_process() -{ - ThreadManager::assert_thread(THREAD_PRE_PROCESS); - assert(_pre_processed == false); - _pre_processed = true; -} - -void -QueuedEvent::execute(ProcessContext& context) -{ - assert(_pre_processed); - assert(_time <= context.end()); - - // Didn't prepare in time. QueuedEvents aren't (necessarily) sample accurate - // so just run at the beginning of this cycle - if (_time <= context.start()) - _time = context.start(); - - Event::execute(context); -} - -} // namespace Server -} // namespace Ingen - diff --git a/src/server/QueuedEvent.hpp b/src/server/QueuedEvent.hpp deleted file mode 100644 index 6c851047..00000000 --- a/src/server/QueuedEvent.hpp +++ /dev/null @@ -1,70 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_ENGINE_QUEUEDEVENT_HPP -#define INGEN_ENGINE_QUEUEDEVENT_HPP - -#include "Event.hpp" - -namespace Ingen { -namespace Server { - -/** An Event with a not-time-critical preprocessing stage. - * - * These events are events that aren't able to be executed immediately by the - * Jack thread (because they allocate memory or whatever). They are pushed - * on to the QueuedEventQueue where they are preprocessed then pushed on - * to the realtime Event Queue when they are ready. - * - * Lookups for these events should go in the pre_process() method, since they are - * not time critical and shouldn't waste time in the audio thread doing - * lookups they can do beforehand. (This applies for any expensive operation that - * could be done before the execute() method). - * - * \ingroup engine - */ -class QueuedEvent : public Event -{ -public: - /** Process this event into a realtime-suitable event. */ - virtual void pre_process(); - - virtual void execute(ProcessContext& context); - - bool is_prepared() const { return _pre_processed; } - -protected: - QueuedEvent(Engine& engine, - SharedPtr request, - FrameTime time) - : Event(engine, request, time) - , _pre_processed(false) - {} - - // NULL event base (for internal events only!) - explicit QueuedEvent(Engine& engine) - : Event(engine, SharedPtr(), 0) - , _pre_processed(false) - {} - - bool _pre_processed; -}; - -} // namespace Server -} // namespace Ingen - -#endif // INGEN_ENGINE_QUEUEDEVENT_HPP diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index 551b3a29..c8858961 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -49,7 +49,7 @@ Connect::Connect(Engine& engine, SampleCount timestamp, const Path& src_port_path, const Path& dst_port_path) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) , _src_port_path(src_port_path) , _dst_port_path(dst_port_path) , _patch(NULL) @@ -68,7 +68,7 @@ Connect::pre_process() PortImpl* dst_port = _engine.engine_store()->find_port(_dst_port_path); if (!src_port || !dst_port) { _error = PORT_NOT_FOUND; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -76,7 +76,7 @@ Connect::pre_process() _src_output_port = dynamic_cast(src_port); if (!_dst_input_port || !_src_output_port) { _error = DIRECTION_MISMATCH; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -84,7 +84,7 @@ Connect::pre_process() NodeImpl* const dst_node = dst_port->parent_node(); if (!src_node || !dst_node) { _error = PARENTS_NOT_FOUND; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -92,13 +92,13 @@ Connect::pre_process() && src_node != dst_node->parent() && src_node->parent() != dst_node) { _error = PARENT_PATCH_DIFFERENT; - QueuedEvent::pre_process(); + Event::pre_process(); return; } if (!ConnectionImpl::can_connect(_src_output_port, _dst_input_port)) { _error = TYPE_MISMATCH; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -121,7 +121,7 @@ Connect::pre_process() if (_patch->has_connection(_src_output_port, _dst_input_port)) { _error = ALREADY_CONNECTED; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -153,13 +153,13 @@ Connect::pre_process() if (_patch->enabled()) _compiled_patch = _patch->compile(); - QueuedEvent::pre_process(); + Event::pre_process(); } void Connect::execute(ProcessContext& context) { - QueuedEvent::execute(context); + Event::execute(context); if (_error == NO_ERROR) { // This must be inserted here, since they're actually used by the audio thread diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index edb1344c..3b9e64a3 100644 --- a/src/server/events/Connect.hpp +++ b/src/server/events/Connect.hpp @@ -19,7 +19,7 @@ #define INGEN_EVENTS_CONNECT_HPP #include "raul/Path.hpp" -#include "QueuedEvent.hpp" +#include "Event.hpp" #include "PatchImpl.hpp" #include "InputPort.hpp" #include "types.hpp" @@ -46,7 +46,7 @@ namespace Events { * * \ingroup engine */ -class Connect : public QueuedEvent +class Connect : public Event { public: Connect(Engine& engine, diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp index 20134a0c..e827f840 100644 --- a/src/server/events/CreateNode.cpp +++ b/src/server/events/CreateNode.cpp @@ -47,7 +47,7 @@ CreateNode::CreateNode( const Path& path, const URI& plugin_uri, const Resource::Properties& properties) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) , _path(path) , _plugin_uri(plugin_uri) , _patch(NULL) @@ -70,7 +70,7 @@ CreateNode::pre_process() { if (_engine.engine_store()->find_object(_path) != NULL) { _node_already_exists = true; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -100,13 +100,13 @@ CreateNode::pre_process() if (!_node) _error = 1; - QueuedEvent::pre_process(); + Event::pre_process(); } void CreateNode::execute(ProcessContext& context) { - QueuedEvent::execute(context); + Event::execute(context); if (_node) { _engine.maid()->push(_patch->compiled_patch()); diff --git a/src/server/events/CreateNode.hpp b/src/server/events/CreateNode.hpp index 86cabf2a..b01af7cc 100644 --- a/src/server/events/CreateNode.hpp +++ b/src/server/events/CreateNode.hpp @@ -22,7 +22,7 @@ #include "ingen/Resource.hpp" -#include "QueuedEvent.hpp" +#include "Event.hpp" namespace Ingen { namespace Server { @@ -38,7 +38,7 @@ namespace Events { * * \ingroup engine */ -class CreateNode : public QueuedEvent +class CreateNode : public Event { public: CreateNode( diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp index d62a2203..2abe5d22 100644 --- a/src/server/events/CreatePatch.cpp +++ b/src/server/events/CreatePatch.cpp @@ -42,7 +42,7 @@ CreatePatch::CreatePatch( const Raul::Path& path, int poly, const Resource::Properties& properties) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) , _path(path) , _patch(NULL) , _parent(NULL) @@ -57,13 +57,13 @@ CreatePatch::pre_process() { if (_path.is_root() || _engine.engine_store()->find_object(_path) != NULL) { _error = OBJECT_EXISTS; - QueuedEvent::pre_process(); + Event::pre_process(); return; } if (_poly < 1) { _error = INVALID_POLY; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -72,7 +72,7 @@ CreatePatch::pre_process() _parent = _engine.engine_store()->find_patch(path.parent()); if (_parent == NULL) { _error = PARENT_NOT_FOUND; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -102,13 +102,13 @@ CreatePatch::pre_process() //_patch->add_to_store(_engine.engine_store()); _engine.engine_store()->add(_patch); - QueuedEvent::pre_process(); + Event::pre_process(); } void CreatePatch::execute(ProcessContext& context) { - QueuedEvent::execute(context); + Event::execute(context); if (_patch) { if (!_parent) { diff --git a/src/server/events/CreatePatch.hpp b/src/server/events/CreatePatch.hpp index e3afde5f..49f0b633 100644 --- a/src/server/events/CreatePatch.hpp +++ b/src/server/events/CreatePatch.hpp @@ -18,7 +18,7 @@ #ifndef INGEN_EVENTS_CREATEPATCH_HPP #define INGEN_EVENTS_CREATEPATCH_HPP -#include "QueuedEvent.hpp" +#include "Event.hpp" #include "ingen/Resource.hpp" namespace Ingen { @@ -33,7 +33,7 @@ namespace Events { * * \ingroup engine */ -class CreatePatch : public QueuedEvent +class CreatePatch : public Event { public: CreatePatch( diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 418cdab0..0a200add 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -47,7 +47,7 @@ CreatePort::CreatePort( const Raul::Path& path, bool is_output, const Resource::Properties& properties) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) , _path(path) , _data_type(PortType::UNKNOWN) , _patch(NULL) @@ -91,7 +91,7 @@ void CreatePort::pre_process() { if (_error == UNKNOWN_TYPE || _engine.engine_store()->find_object(_path)) { - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -113,7 +113,7 @@ CreatePort::pre_process() index_i = _properties.insert(make_pair(uris.lv2_index, (int)old_num_ports)); } else if (index_i->second.type() != Atom::INT || index_i->second.get_int32() != static_cast(old_num_ports)) { - QueuedEvent::pre_process(); + Event::pre_process(); _error = BAD_INDEX; return; } @@ -153,13 +153,13 @@ CreatePort::pre_process() _error = CREATION_FAILED; } } - QueuedEvent::pre_process(); + Event::pre_process(); } void CreatePort::execute(ProcessContext& context) { - QueuedEvent::execute(context); + Event::execute(context); if (_patch_port) { _engine.maid()->push(_patch->external_ports()); diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp index 4b1b03fa..bb3aa0e4 100644 --- a/src/server/events/CreatePort.hpp +++ b/src/server/events/CreatePort.hpp @@ -24,7 +24,7 @@ #include "ingen/Resource.hpp" #include "PortType.hpp" -#include "QueuedEvent.hpp" +#include "Event.hpp" namespace Ingen { namespace Server { @@ -39,7 +39,7 @@ namespace Events { * * \ingroup engine */ -class CreatePort : public QueuedEvent +class CreatePort : public Event { public: CreatePort( diff --git a/src/server/events/Deactivate.hpp b/src/server/events/Deactivate.hpp index 779ba54c..1b083f29 100644 --- a/src/server/events/Deactivate.hpp +++ b/src/server/events/Deactivate.hpp @@ -18,7 +18,7 @@ #ifndef INGEN_EVENTS_DEACTIVATE_HPP #define INGEN_EVENTS_DEACTIVATE_HPP -#include "QueuedEvent.hpp" +#include "Event.hpp" #include "Engine.hpp" namespace Ingen { @@ -29,11 +29,11 @@ namespace Events { * * \ingroup engine */ -class Deactivate : public QueuedEvent +class Deactivate : public Event { public: Deactivate(Engine& engine, SharedPtr request, SampleCount timestamp) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) {} void post_process() { diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index 1e7b35e8..0b975298 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -40,7 +40,7 @@ Delete::Delete(Engine& engine, SharedPtr request, FrameTime time, const Raul::URI& uri) - : QueuedEvent(engine, request, time) + : Event(engine, request, time) , _uri(uri) , _store_iterator(engine.engine_store()->end()) , _garbage(NULL) @@ -68,7 +68,7 @@ void Delete::pre_process() { if (_path.is_root() || _path == "path:/control_in" || _path == "path:/control_out") { - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -129,13 +129,13 @@ Delete::pre_process() } - QueuedEvent::pre_process(); + Event::pre_process(); } void Delete::execute(ProcessContext& context) { - QueuedEvent::execute(context); + Event::execute(context); PatchImpl* parent_patch = NULL; diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp index d865ca11..926ecd47 100644 --- a/src/server/events/Delete.hpp +++ b/src/server/events/Delete.hpp @@ -18,7 +18,7 @@ #ifndef INGEN_EVENTS_DELETE_HPP #define INGEN_EVENTS_DELETE_HPP -#include "QueuedEvent.hpp" +#include "Event.hpp" #include "EngineStore.hpp" #include "PatchImpl.hpp" #include "ControlBindings.hpp" @@ -55,7 +55,7 @@ class DisconnectAll; /** DELETE a graph object (see \ref methods). * \ingroup engine */ -class Delete : public QueuedEvent +class Delete : public Event { public: Delete(Engine& engine, diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 5a6d53e8..5fc723b5 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -48,7 +48,7 @@ Disconnect::Disconnect(Engine& engine, SampleCount timestamp, const Raul::Path& src_port_path, const Raul::Path& dst_port_path) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) , _src_port_path(src_port_path) , _dst_port_path(dst_port_path) , _patch(NULL) @@ -119,7 +119,7 @@ Disconnect::pre_process() && _src_port_path.parent() != _dst_port_path.parent().parent() && _src_port_path.parent().parent() != _dst_port_path.parent()) { _error = PARENT_PATCH_DIFFERENT; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -128,7 +128,7 @@ Disconnect::pre_process() if (_src_port == NULL || _dst_port == NULL) { _error = PORT_NOT_FOUND; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -157,13 +157,13 @@ Disconnect::pre_process() if (!_patch->has_connection(_src_port, _dst_port)) { _error = NOT_CONNECTED; - QueuedEvent::pre_process(); + Event::pre_process(); return; } if (src_node == NULL || dst_node == NULL) { _error = PARENTS_NOT_FOUND; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -175,7 +175,7 @@ Disconnect::pre_process() if (_patch->enabled()) _compiled_patch = _patch->compile(); - QueuedEvent::pre_process(); + Event::pre_process(); } bool @@ -210,7 +210,7 @@ Disconnect::Impl::execute(ProcessContext& context, bool set_dst_buffers) void Disconnect::execute(ProcessContext& context) { - QueuedEvent::execute(context); + Event::execute(context); if (_error == NO_ERROR) { if (!_impl->execute(context, true)) { diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp index d0124ce1..1ecb02cf 100644 --- a/src/server/events/Disconnect.hpp +++ b/src/server/events/Disconnect.hpp @@ -19,7 +19,7 @@ #define INGEN_EVENTS_DISCONNECT_HPP #include "raul/Path.hpp" -#include "QueuedEvent.hpp" +#include "Event.hpp" #include "types.hpp" #include "PatchImpl.hpp" #include "BufferFactory.hpp" @@ -43,7 +43,7 @@ namespace Events { * * \ingroup engine */ -class Disconnect : public QueuedEvent +class Disconnect : public Event { public: Disconnect(Engine& engine, diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index b6ec3c4b..fde8e214 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -46,7 +46,7 @@ namespace Server { namespace Events { DisconnectAll::DisconnectAll(Engine& engine, SharedPtr request, SampleCount timestamp, const Path& parent_path, const Path& node_path) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) , _parent_path(parent_path) , _path(node_path) , _parent(NULL) @@ -60,7 +60,7 @@ DisconnectAll::DisconnectAll(Engine& engine, SharedPtr request, SampleC /** Internal version for use by other events. */ DisconnectAll::DisconnectAll(Engine& engine, PatchImpl* parent, GraphObjectImpl* object) - : QueuedEvent(engine) + : Event(engine) , _parent_path(parent->path()) , _path(object->path()) , _parent(parent) @@ -89,7 +89,7 @@ DisconnectAll::pre_process() if (_parent == NULL) { _error = PARENT_NOT_FOUND; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -97,14 +97,14 @@ DisconnectAll::pre_process() if (object == NULL) { _error = OBJECT_NOT_FOUND; - QueuedEvent::pre_process(); + Event::pre_process(); return; } if (object->parent_patch() != _parent && object->parent()->parent_patch() != _parent) { _error = INVALID_PARENT_PATH; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -145,13 +145,13 @@ DisconnectAll::pre_process() if (!_deleting && _parent->enabled()) _compiled_patch = _parent->compile(); - QueuedEvent::pre_process(); + Event::pre_process(); } void DisconnectAll::execute(ProcessContext& context) { - QueuedEvent::execute(context); + Event::execute(context); if (_error == NO_ERROR) { for (Impls::iterator i = _impls.begin(); i != _impls.end(); ++i) { diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp index e3b23df6..6d3754f0 100644 --- a/src/server/events/DisconnectAll.hpp +++ b/src/server/events/DisconnectAll.hpp @@ -23,7 +23,7 @@ #include "raul/Path.hpp" #include "Disconnect.hpp" -#include "QueuedEvent.hpp" +#include "Event.hpp" namespace Ingen { namespace Server { @@ -41,7 +41,7 @@ class Disconnect; * * \ingroup engine */ -class DisconnectAll : public QueuedEvent +class DisconnectAll : public Event { public: DisconnectAll( diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index ae649e1f..7cb85db4 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -35,7 +35,7 @@ Get::Get(Engine& engine, SharedPtr request, SampleCount timestamp, const URI& uri) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) , _uri(uri) , _object(NULL) , _plugin(NULL) @@ -56,7 +56,7 @@ Get::pre_process() _plugin = _engine.node_factory()->plugin(_uri); } - QueuedEvent::pre_process(); + Event::pre_process(); } void diff --git a/src/server/events/Get.hpp b/src/server/events/Get.hpp index 4a1c3c6a..5eb45982 100644 --- a/src/server/events/Get.hpp +++ b/src/server/events/Get.hpp @@ -20,7 +20,7 @@ #include -#include "QueuedEvent.hpp" +#include "Event.hpp" #include "NodeFactory.hpp" #include "types.hpp" @@ -36,7 +36,7 @@ namespace Events { * * \ingroup engine */ -class Get : public QueuedEvent +class Get : public Event { public: Get(Engine& engine, diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index ec2f763e..10be3bc8 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -36,7 +36,7 @@ namespace Server { namespace Events { Move::Move(Engine& engine, SharedPtr request, SampleCount timestamp, const Path& path, const Path& new_path) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) , _old_path(path) , _new_path(new_path) , _parent_patch(NULL) @@ -55,19 +55,19 @@ Move::pre_process() if (!_old_path.parent().is_parent_of(_new_path)) { _error = PARENT_DIFFERS; - QueuedEvent::pre_process(); + Event::pre_process(); return; } _store_iterator = _engine.engine_store()->find(_old_path); if (_store_iterator == _engine.engine_store()->end()) { _error = OBJECT_NOT_FOUND; - QueuedEvent::pre_process(); + Event::pre_process(); return; } if (_engine.engine_store()->find_object(_new_path)) { _error = OBJECT_EXISTS; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -92,13 +92,13 @@ Move::pre_process() _engine.engine_store()->add(*removed.get()); - QueuedEvent::pre_process(); + Event::pre_process(); } void Move::execute(ProcessContext& context) { - QueuedEvent::execute(context); + Event::execute(context); SharedPtr port = PtrCast(_store_iterator->second); if (port && port->parent()->parent() == NULL) { diff --git a/src/server/events/Move.hpp b/src/server/events/Move.hpp index 4286f583..bab9d047 100644 --- a/src/server/events/Move.hpp +++ b/src/server/events/Move.hpp @@ -19,7 +19,7 @@ #define INGEN_EVENTS_MOVE_HPP #include "raul/Path.hpp" -#include "QueuedEvent.hpp" +#include "Event.hpp" #include "EngineStore.hpp" namespace Ingen { @@ -42,7 +42,7 @@ namespace Events { /** MOVE a graph object to a new path (see \ref methods). * \ingroup engine */ -class Move : public QueuedEvent +class Move : public Event { public: Move( diff --git a/src/server/events/Ping.hpp b/src/server/events/Ping.hpp index 2353e496..ad732397 100644 --- a/src/server/events/Ping.hpp +++ b/src/server/events/Ping.hpp @@ -18,7 +18,7 @@ #ifndef INGEN_EVENTS_PING_HPP #define INGEN_EVENTS_PING_HPP -#include "QueuedEvent.hpp" +#include "Event.hpp" #include "types.hpp" #include "Request.hpp" @@ -34,11 +34,11 @@ namespace Events { * * \ingroup engine */ -class Ping : public QueuedEvent +class Ping : public Event { public: Ping(Engine& engine, SharedPtr request, SampleCount timestamp) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) {} void post_process() { _request->respond_ok(); } diff --git a/src/server/events/RegisterClient.cpp b/src/server/events/RegisterClient.cpp index 869f2c0f..34e7a9f3 100644 --- a/src/server/events/RegisterClient.cpp +++ b/src/server/events/RegisterClient.cpp @@ -33,7 +33,7 @@ RegisterClient::RegisterClient(Engine& engine, SampleCount timestamp, const URI& uri, ClientInterface* client) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) , _uri(uri) , _client(client) { @@ -44,7 +44,7 @@ RegisterClient::pre_process() { _engine.broadcaster()->register_client(_uri, _client); - QueuedEvent::pre_process(); + Event::pre_process(); } void diff --git a/src/server/events/RegisterClient.hpp b/src/server/events/RegisterClient.hpp index ec2d0809..960e2c05 100644 --- a/src/server/events/RegisterClient.hpp +++ b/src/server/events/RegisterClient.hpp @@ -20,7 +20,7 @@ #include "raul/URI.hpp" #include "ingen/ClientInterface.hpp" -#include "QueuedEvent.hpp" +#include "Event.hpp" namespace Ingen { namespace Server { @@ -30,7 +30,7 @@ namespace Events { * * \ingroup engine */ -class RegisterClient : public QueuedEvent +class RegisterClient : public Event { public: RegisterClient(Engine& engine, diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp index d49d2b50..a304d245 100644 --- a/src/server/events/SetMetadata.cpp +++ b/src/server/events/SetMetadata.cpp @@ -60,7 +60,7 @@ SetMetadata::SetMetadata( const URI& subject, const Properties& properties, const Properties& remove) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) , _create_event(NULL) , _subject(subject) , _properties(properties) @@ -114,7 +114,7 @@ SetMetadata::pre_process() if (!_object && (!is_graph_object || !_create)) { _error = NOT_FOUND; - QueuedEvent::pre_process(); + Event::pre_process(); return; } @@ -263,14 +263,14 @@ SetMetadata::pre_process() _lock.release(); } - QueuedEvent::pre_process(); + Event::pre_process(); } void SetMetadata::execute(ProcessContext& context) { if (_error != NO_ERROR) { - QueuedEvent::execute(context); + Event::execute(context); return; } @@ -345,7 +345,7 @@ SetMetadata::execute(ProcessContext& context) } } - QueuedEvent::execute(context); + Event::execute(context); } void diff --git a/src/server/events/SetMetadata.hpp b/src/server/events/SetMetadata.hpp index 92987db9..d8da99c0 100644 --- a/src/server/events/SetMetadata.hpp +++ b/src/server/events/SetMetadata.hpp @@ -25,7 +25,7 @@ #include "raul/URI.hpp" #include "ControlBindings.hpp" -#include "QueuedEvent.hpp" +#include "Event.hpp" #include "ingen/shared/ResourceImpl.hpp" namespace Ingen { @@ -66,7 +66,7 @@ class SetPortValue; /** Set properties of a graph object. * \ingroup engine */ -class SetMetadata : public QueuedEvent +class SetMetadata : public Event { public: SetMetadata( @@ -105,7 +105,7 @@ private: typedef std::vector SetEvents; - QueuedEvent* _create_event; + Event* _create_event; SetEvents _set_events; std::vector _types; std::vector _remove_types; diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index dc5d1564..1b0ec373 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -51,7 +51,7 @@ SetPortValue::SetPortValue(Engine& engine, SampleCount timestamp, const Raul::Path& port_path, const Raul::Atom& value) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) , _queued(queued) , _port_path(port_path) , _value(value) @@ -65,7 +65,7 @@ SetPortValue::SetPortValue(Engine& engine, SampleCount timestamp, PortImpl* port, const Raul::Atom& value) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) , _queued(false) , _port_path(port->path()) , _value(value) @@ -103,7 +103,7 @@ SetPortValue::pre_process() _binding = _engine.control_bindings()->port_binding(_port); - QueuedEvent::pre_process(); + Event::pre_process(); } void diff --git a/src/server/events/SetPortValue.hpp b/src/server/events/SetPortValue.hpp index 13d77225..ca69c789 100644 --- a/src/server/events/SetPortValue.hpp +++ b/src/server/events/SetPortValue.hpp @@ -21,7 +21,7 @@ #include "raul/Atom.hpp" #include "ControlBindings.hpp" -#include "QueuedEvent.hpp" +#include "Event.hpp" #include "types.hpp" namespace Ingen { @@ -40,7 +40,7 @@ namespace Events { * * \ingroup engine */ -class SetPortValue : public QueuedEvent +class SetPortValue : public Event { public: SetPortValue(Engine& engine, diff --git a/src/server/events/UnregisterClient.cpp b/src/server/events/UnregisterClient.cpp index b87bfa81..e5ba1b4f 100644 --- a/src/server/events/UnregisterClient.cpp +++ b/src/server/events/UnregisterClient.cpp @@ -28,7 +28,7 @@ namespace Server { namespace Events { UnregisterClient::UnregisterClient(Engine& engine, SharedPtr request, SampleCount timestamp, const URI& uri) - : QueuedEvent(engine, request, timestamp) + : Event(engine, request, timestamp) , _uri(uri) { } diff --git a/src/server/events/UnregisterClient.hpp b/src/server/events/UnregisterClient.hpp index eefc6318..86d24e1c 100644 --- a/src/server/events/UnregisterClient.hpp +++ b/src/server/events/UnregisterClient.hpp @@ -18,7 +18,7 @@ #ifndef INGEN_EVENTS_UNREGISTERCLIENT_HPP #define INGEN_EVENTS_UNREGISTERCLIENT_HPP -#include "QueuedEvent.hpp" +#include "Event.hpp" #include "raul/URI.hpp" namespace Ingen { @@ -29,7 +29,7 @@ namespace Events { * * \ingroup engine */ -class UnregisterClient : public QueuedEvent +class UnregisterClient : public Event { public: UnregisterClient(Engine& engine, diff --git a/src/server/wscript b/src/server/wscript index 0251d7e8..4172b23e 100644 --- a/src/server/wscript +++ b/src/server/wscript @@ -33,7 +33,6 @@ def build(bld): PostProcessor.cpp ProcessContext.cpp ProcessSlave.cpp - QueuedEvent.cpp ServerInterfaceImpl.cpp events/Connect.cpp events/CreateNode.cpp -- cgit v1.2.1