From 0f80d5ca3b360b267c0bb62df93a4b7a7f803c17 Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 19 Jun 2006 16:59:01 +0000 Subject: [PATCH] Added missing DuplexPot files git-svn-id: http://svn.drobilla.net/lad@63 a436a847-0d15-0410-975c-d299462d15a1 --- grauph/src/libs/engine/DuplexPort.cpp | 46 ++++++++++++++++++ grauph/src/libs/engine/DuplexPort.h | 68 +++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 grauph/src/libs/engine/DuplexPort.cpp create mode 100644 grauph/src/libs/engine/DuplexPort.h diff --git a/grauph/src/libs/engine/DuplexPort.cpp b/grauph/src/libs/engine/DuplexPort.cpp new file mode 100644 index 00000000..27be5056 --- /dev/null +++ b/grauph/src/libs/engine/DuplexPort.cpp @@ -0,0 +1,46 @@ +/* This file is part of Om. Copyright (C) 2006 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 + */ + +#include "DuplexPort.h" +#include +#include +#include +#include "TypedConnection.h" +#include "OutputPort.h" +#include "Node.h" +#include "Om.h" +#include "util.h" + +using std::cerr; using std::cout; using std::endl; + + +namespace Om { + + +template +DuplexPort::DuplexPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size, bool is_output) +: TypedPort(parent, name, index, poly, type, buffer_size) +, InputPort(parent, name, index, poly, type, buffer_size) +, OutputPort(parent, name, index, poly, type, buffer_size) +, _is_output(is_output) +{ +} +template DuplexPort::DuplexPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size, bool is_output); +template DuplexPort::DuplexPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size, bool is_output); + + +} // namespace Om + diff --git a/grauph/src/libs/engine/DuplexPort.h b/grauph/src/libs/engine/DuplexPort.h new file mode 100644 index 00000000..1abf6a4d --- /dev/null +++ b/grauph/src/libs/engine/DuplexPort.h @@ -0,0 +1,68 @@ +/* This file is part of Om. Copyright (C) 2006 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 DUPLEXPORT_H +#define DUPLEXPORT_H + +#include +#include "types.h" +#include "Array.h" +#include "Buffer.h" +#include "InputPort.h" +#include "OutputPort.h" +using std::string; + +namespace Om { + +class MidiMessage; +class Node; + + +/** A duplex port (which is both an InputPort and an OutputPort) + * + * This is used for Patch ports, since they need to appear as both an input + * and an output port based on context. Eg. a patch output appears as an + * input inside the patch, so nodes inside the patch can feed it data. + * + * \ingroup engine + */ +template +class DuplexPort : public InputPort, public OutputPort +{ +public: + DuplexPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size, bool is_output); + virtual ~DuplexPort() {} + + virtual void prepare_buffers(size_t nframes) {} + + virtual bool is_input() const { return !_is_output; } + virtual bool is_output() const { return _is_output; } + +protected: + // Prevent copies (undefined) + DuplexPort(const DuplexPort& copy); + DuplexPort& operator=(const Port&); + + bool _is_output; +}; + + +template class DuplexPort; +template class DuplexPort; + +} // namespace Om + +#endif // DUPLEXPORT_H