From 47246db7e9d71ba694b719001033fba1766a58c4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 10 Jun 2006 02:43:54 +0000 Subject: More juggling git-svn-id: http://svn.drobilla.net/lad/grauph@16 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/OSCModelEngineInterface.h | 117 ++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 src/libs/client/OSCModelEngineInterface.h (limited to 'src/libs/client/OSCModelEngineInterface.h') diff --git a/src/libs/client/OSCModelEngineInterface.h b/src/libs/client/OSCModelEngineInterface.h new file mode 100644 index 00000000..4400a1b4 --- /dev/null +++ b/src/libs/client/OSCModelEngineInterface.h @@ -0,0 +1,117 @@ +/* This file is part of Om. Copyright (C) 2005 Dave Robillard. + * + * Om 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. + * + * Om 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., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef OSCCONTROLLER_H +#define OSCCONTROLLER_H + +#include +#include +#include "util/Semaphore.h" +#include "interface/EngineInterface.h" +#include "OSCEngineInterface.h" +#include "ModelEngineInterface.h" +using std::string; + +/** \defgroup libomclient Client Library + */ + +namespace LibOmClient { + +class NodeModel; +class PresetModel; +class PatchModel; +class OSCListener; +class ModelClientInterface; + + +/** Old model-based OSC engine command interface. + * + * This is an old class from before when the well-defined interfaces between + * engine and client were defined. I've wrapped it around OSCEngineInterface + * so all the common functions are implemented there, and implemented the + * remaining functions using those, for compatibility. Hopefully something + * better gets figured out and this can go away completely, but for now this + * gets the existing clients working through EngineInterface in the easiest + * way possible. This class needs to die. + * + * Old comment: + * Handles all OSC communication on the "control band". For the time being, + * manages the OSCListener which handles the "notification band", but this + * will change in the future (for complete separation). See OSC namespace + * documentation for more details. + * + * \ingroup libomclient + */ +class OSCModelEngineInterface : public OSCEngineInterface, public ModelEngineInterface +{ +public: + //OSCModelEngineInterface(ModelClientInterface* const client_hooks, const string& engine_url); + OSCModelEngineInterface(const string& engine_url); + ~OSCModelEngineInterface(); + + void attach(bool block = true); + void detach(); + + bool is_attached() { return m_is_attached; } + + // FIXME: reimplement + void set_wait_response_id(int32_t id) {} + bool wait_for_response() { return false; } + int get_next_request_id() { return m_request_id++; } + + /* *** Model alternatives to EngineInterface functions below *** */ + + void create_patch_from_model(const PatchModel* pm); + void create_node_from_model(const NodeModel* nm); + + void set_all_metadata(const NodeModel* nm); + void set_preset(const string& patch_path, const PresetModel* const pm); + +protected: + void start_listen_thread(); + + int m_request_id; + + bool m_is_attached; + bool m_is_registered; + /* + bool m_blocking; + bool m_waiting_for_response; + int m_wait_response_id; + bool m_response_received; + bool m_wait_response_was_affirmative; + + Semaphore m_response_semaphore; + */ +private: + // Prevent copies + OSCModelEngineInterface(const OSCModelEngineInterface& copy); + OSCModelEngineInterface& operator=(const OSCModelEngineInterface& copy); +}; +/* +inline int +OSCModelEngineInterface::om_response_ok_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* comm) { + return ((OSCModelEngineInterface*)comm)->m_om_response_ok_cb(path, types, argv, argc, data); +} + +inline int +OSCModelEngineInterface::om_response_error_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* comm) { + return ((OSCModelEngineInterface*)comm)->m_om_response_error_cb(path, types, argv, argc, data); +} +*/ +} // namespace LibOmClient + +#endif // OSCCONTROLLER_H -- cgit v1.2.1