/*
This file is part of Ingen.
Copyright 2007-2016 David Robillard
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
Software Foundation, either version 3 of the License, or 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 Affero General Public License for details.
You should have received a copy of the GNU Affero General Public License
along with Ingen. If not, see .
*/
#ifndef INGEN_ENGINE_EVENTWRITER_HPP
#define INGEN_ENGINE_EVENTWRITER_HPP
#include
#include
#include
#include "ingen/Interface.hpp"
#include "ingen/Resource.hpp"
#include "ingen/types.hpp"
#include "Event.hpp"
#include "types.hpp"
namespace Ingen {
namespace Server {
class Engine;
/** An Interface that creates and enqueues Events for the Engine to execute.
*/
class EventWriter : public Interface
{
public:
explicit EventWriter(Engine& engine);
Raul::URI uri() const { return Raul::URI("ingen:/clients/event_writer"); }
virtual SPtr respondee() const {
return _respondee;
}
virtual void set_respondee(SPtr respondee) {
_respondee = respondee;
}
virtual void set_response_id(int32_t id);
void message(const Message& msg) override;
void set_event_mode(Event::Mode mode) { _event_mode = mode; }
Event::Mode get_event_mode() { return _event_mode; }
void operator()(const BundleBegin&);
void operator()(const BundleEnd&);
void operator()(const Connect&);
void operator()(const Copy&);
void operator()(const Del&);
void operator()(const Delta&);
void operator()(const Disconnect&);
void operator()(const DisconnectAll&);
void operator()(const Error&) {}
void operator()(const Get&);
void operator()(const Move&);
void operator()(const Put&);
void operator()(const Redo&);
void operator()(const Response&) {}
void operator()(const SetProperty&);
void operator()(const Undo&);
protected:
Engine& _engine;
SPtr _respondee;
int32_t _request_id;
Event::Mode _event_mode;
private:
SampleCount now() const;
};
} // namespace Server
} // namespace Ingen
#endif // INGEN_ENGINE_EVENTWRITER_HPP