From d7bc67f9752a90abf165c875839294befb42ef90 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 21 Oct 2011 23:11:27 +0000 Subject: Merge Request into Event. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3574 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/Event.hpp | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) (limited to 'src/server/Event.hpp') diff --git a/src/server/Event.hpp b/src/server/Event.hpp index 64e93b8b..f887ce66 100644 --- a/src/server/Event.hpp +++ b/src/server/Event.hpp @@ -18,20 +18,21 @@ #ifndef INGEN_ENGINE_EVENT_HPP #define INGEN_ENGINE_EVENT_HPP -#include - -#include "raul/SharedPtr.hpp" +#include "raul/AtomicPtr.hpp" #include "raul/Deletable.hpp" +#include "raul/Noncopyable.hpp" #include "raul/Path.hpp" -#include "raul/AtomicPtr.hpp" +#include "raul/SharedPtr.hpp" #include "types.hpp" namespace Ingen { + +class ClientInterface; + namespace Server { class Engine; -class Request; class ProcessContext; /** An event (command) to perform some action on Ingen. @@ -46,7 +47,7 @@ class ProcessContext; * * \ingroup engine */ -class Event : public Raul::Deletable +class Event : public Raul::Deletable, public Raul::Noncopyable { public: virtual ~Event() {} @@ -60,19 +61,32 @@ public: /** Post-process event after execution (non-realtime). */ virtual void post_process(); - inline bool is_prepared() const { return _pre_processed; } - inline SampleCount time() const { return _time; } + /** Return true iff this event has been pre-processed. */ + inline bool is_prepared() const { return _pre_processed; } + + /** Return the time stamp of this event. */ + inline SampleCount time() const { return _time; } + + /** Get the next event to be processed after this one. */ + Event* next() const { return _next.get(); } + + /** Set the next event to be processed after this one. */ + void next(Event* ev) { _next = ev; } - /** Get the next event in the event process list. */ - Event* next() const { return _next.get(); } - void next(Event* ev) { _next = ev; } + /** Return the error status of this event. */ + int error() const { return _error; } - int error() { return _error; } + /** Respond to the originating client successfully. */ + void respond_ok(); + /** Respond to the originating client with an error. */ + void respond_error(const std::string& msg); + protected: - Event(Engine& engine, SharedPtr request, FrameTime time) + Event(Engine& engine, ClientInterface* client, int32_t id, FrameTime time) : _engine(engine) - , _request(request) + , _request_client(client) + , _request_id(id) , _time(time) , _error(0) // success , _pre_processed(false) @@ -82,6 +96,8 @@ protected: /** Constructor for internal events only */ explicit Event(Engine& engine) : _engine(engine) + , _request_client(NULL) + , _request_id(-1) , _time(0) , _error(0) // success , _pre_processed(false) @@ -89,8 +105,9 @@ protected: {} Engine& _engine; - SharedPtr _request; Raul::AtomicPtr _next; + ClientInterface* _request_client; + int32_t _request_id; FrameTime _time; int _error; bool _pre_processed; -- cgit v1.2.1