From e343345cf54172720f3494ccef87d62b2c688d0a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 9 Feb 2007 22:39:56 +0000 Subject: Moved Deletable (formerly MaidObject), List, and Array from Ingen to Raul. git-svn-id: http://svn.drobilla.net/lad/ingen@294 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/AlsaMidiDriver.cpp | 10 +- src/libs/engine/AlsaMidiDriver.h | 10 +- src/libs/engine/Array.h | 106 ------- src/libs/engine/AudioDriver.h | 4 +- src/libs/engine/Connection.h | 4 +- src/libs/engine/DSSINode.cpp | 2 +- src/libs/engine/DuplexPort.h | 2 +- src/libs/engine/Engine.cpp | 2 +- src/libs/engine/Event.h | 4 +- src/libs/engine/GraphObject.h | 6 +- src/libs/engine/InputPort.cpp | 24 +- src/libs/engine/InputPort.h | 10 +- src/libs/engine/JackAudioDriver.cpp | 12 +- src/libs/engine/JackAudioDriver.h | 10 +- src/libs/engine/JackMidiDriver.cpp | 8 +- src/libs/engine/JackMidiDriver.h | 12 +- src/libs/engine/LADSPANode.cpp | 2 +- src/libs/engine/LV2Node.cpp | 2 +- src/libs/engine/List.h | 409 ------------------------- src/libs/engine/Maid.cpp | 4 +- src/libs/engine/Maid.h | 8 +- src/libs/engine/MaidObject.h | 36 --- src/libs/engine/Makefile.am | 3 - src/libs/engine/MidiControlNode.cpp | 2 +- src/libs/engine/MidiDriver.h | 1 + src/libs/engine/MidiNoteNode.cpp | 4 +- src/libs/engine/MidiTriggerNode.cpp | 2 +- src/libs/engine/Node.h | 15 +- src/libs/engine/NodeBase.cpp | 8 +- src/libs/engine/NodeBase.h | 16 +- src/libs/engine/OSCClientSender.cpp | 2 +- src/libs/engine/ObjectSender.cpp | 6 +- src/libs/engine/ObjectStore.cpp | 6 +- src/libs/engine/Patch.cpp | 72 ++--- src/libs/engine/Patch.h | 52 ++-- src/libs/engine/Tree.h | 4 +- src/libs/engine/TypedPort.h | 4 +- src/libs/engine/events/AddNodeEvent.cpp | 2 +- src/libs/engine/events/AddNodeEvent.h | 4 +- src/libs/engine/events/AddPortEvent.cpp | 12 +- src/libs/engine/events/AddPortEvent.h | 6 +- src/libs/engine/events/AllNotesOffEvent.cpp | 2 +- src/libs/engine/events/ClearPatchEvent.cpp | 8 +- src/libs/engine/events/ClearPatchEvent.h | 2 +- src/libs/engine/events/ConnectionEvent.cpp | 8 +- src/libs/engine/events/ConnectionEvent.h | 12 +- src/libs/engine/events/CreatePatchEvent.cpp | 2 +- src/libs/engine/events/CreatePatchEvent.h | 9 +- src/libs/engine/events/DestroyEvent.h | 19 +- src/libs/engine/events/DisconnectNodeEvent.cpp | 14 +- src/libs/engine/events/DisconnectNodeEvent.h | 7 +- src/libs/engine/events/DisconnectPortEvent.cpp | 14 +- src/libs/engine/events/DisconnectPortEvent.h | 8 +- src/libs/engine/events/DisconnectionEvent.cpp | 8 +- src/libs/engine/events/DisconnectionEvent.h | 10 +- src/libs/engine/events/EnablePatchEvent.h | 4 +- src/libs/engine/events/RenameEvent.h | 5 +- src/libs/engine/tests/Makefile.am | 10 +- src/libs/engine/tests/list_test.cpp | 93 ------ 59 files changed, 252 insertions(+), 891 deletions(-) delete mode 100644 src/libs/engine/Array.h delete mode 100644 src/libs/engine/List.h delete mode 100644 src/libs/engine/MaidObject.h delete mode 100644 src/libs/engine/tests/list_test.cpp (limited to 'src/libs') diff --git a/src/libs/engine/AlsaMidiDriver.cpp b/src/libs/engine/AlsaMidiDriver.cpp index 1d24f318..47566880 100644 --- a/src/libs/engine/AlsaMidiDriver.cpp +++ b/src/libs/engine/AlsaMidiDriver.cpp @@ -37,7 +37,7 @@ namespace Ingen { AlsaMidiPort::AlsaMidiPort(AlsaMidiDriver* driver, DuplexPort* patch_port) : DriverPort(patch_port->is_input()), - ListNode(this), + Raul::ListNode(this), _driver(driver), _patch_port(patch_port), _port_id(0), @@ -280,7 +280,7 @@ AlsaMidiDriver::deactivate() void AlsaMidiDriver::prepare_block(const SampleCount block_start, const SampleCount block_end) { - for (List::iterator i = _in_ports.begin(); i != _in_ports.end(); ++i) + for (Raul::List::iterator i = _in_ports.begin(); i != _in_ports.end(); ++i) (*i)->prepare_block(block_start, block_end); } @@ -320,11 +320,11 @@ AlsaMidiDriver::remove_port(const Path& path) // FIXME: duplex? - for (List::iterator i = _in_ports.begin(); i != _in_ports.end(); ++i) + for (Raul::List::iterator i = _in_ports.begin(); i != _in_ports.end(); ++i) if ((*i)->patch_port()->path() == path) return _in_ports.remove(i)->elem(); - for (List::iterator i = _out_ports.begin(); i != _out_ports.end(); ++i) + for (Raul::List::iterator i = _out_ports.begin(); i != _out_ports.end(); ++i) if ((*i)->patch_port()->path() == path) return _out_ports.remove(i)->elem(); @@ -349,7 +349,7 @@ AlsaMidiDriver::process_midi_in(void* alsa_driver) while ( ! _midi_thread_exit_flag) if (poll(&pfd, npfd, 100000) > 0) while (snd_seq_event_input(ad->_seq_handle, &ev) > 0) - for (List::iterator i = ad->_in_ports.begin(); i != ad->_in_ports.end(); ++i) + for (Raul::List::iterator i = ad->_in_ports.begin(); i != ad->_in_ports.end(); ++i) if ((*i)->port_id() == ev->dest.port) (*i)->event(ev); diff --git a/src/libs/engine/AlsaMidiDriver.h b/src/libs/engine/AlsaMidiDriver.h index 98123753..85d975b9 100644 --- a/src/libs/engine/AlsaMidiDriver.h +++ b/src/libs/engine/AlsaMidiDriver.h @@ -20,8 +20,8 @@ #include #include -#include "List.h" -#include "raul/SRSWQueue.h" +#include +#include #include "MidiDriver.h" @@ -40,7 +40,7 @@ static const int MAX_MIDI_EVENT_SIZE = 3; * * \ingroup engine */ -class AlsaMidiPort : public DriverPort, public ListNode +class AlsaMidiPort : public DriverPort, public Raul::ListNode { public: AlsaMidiPort(AlsaMidiDriver* driver, DuplexPort* port); @@ -96,8 +96,8 @@ public: snd_midi_event_t* event_coder() const { return _event_coder; } private: - List _in_ports; - List _out_ports; + Raul::List _in_ports; + Raul::List _out_ports; friend class AlsaMidiPort; diff --git a/src/libs/engine/Array.h b/src/libs/engine/Array.h deleted file mode 100644 index 6c63d44c..00000000 --- a/src/libs/engine/Array.h +++ /dev/null @@ -1,106 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave 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 ARRAY_H -#define ARRAY_H - -#include "MaidObject.h" -#include -#include -#include "types.h" - - -/** An array. - * - * Has a stack-like push_back() too, for find_process_order... - */ -template -class Array : public MaidObject -{ -public: - Array(size_t size = 0) : _size(size), _top(0), _elems(NULL) { - if (size > 0) - _elems = new T[size]; - } - - Array(size_t size, T initial_value) : _size(size), _top(0), _elems(NULL) { - if (size > 0) { - _elems = new T[size]; - for (size_t i=0; i < size; ++i) - _elems[i] = initial_value; - } - } - - Array(size_t size, const Array& contents) : _size(size), _top(size+1) { - _elems = new T[size]; - if (size <= contents.size()) - memcpy(_elems, contents._elems, size * sizeof(T)); - else - memcpy(_elems, contents._elems, contents.size() * sizeof(T)); - } - - ~Array() { - free(); - } - - void alloc(size_t num_elems) { - assert(num_elems > 0); - - delete[] _elems; - _size = num_elems; - _top = 0; - - _elems = new T[num_elems]; - } - - void alloc(size_t num_elems, T initial_value) { - assert(num_elems > 0); - - delete[] _elems; - _size = num_elems; - _top = 0; - - _elems = new T[num_elems]; - for (size_t i=0; i < _size; ++i) - _elems[i] = initial_value; - } - - void free() { - delete[] _elems; - _size = 0; - _top = 0; - } - - void push_back(T n) { - assert(_top < _size); - _elems[_top++] = n; - } - - inline size_t size() const { return _size; } - - inline T& operator[](size_t i) const { assert(i < _size); return _elems[i]; } - - inline T& at(size_t i) const { assert(i < _size); return _elems[i]; } - -private: - size_t _size; - size_t _top; // points to empty element above "top" element - T* _elems; -}; - - -#endif // ARRAY_H diff --git a/src/libs/engine/AudioDriver.h b/src/libs/engine/AudioDriver.h index b449843c..9128c2ed 100644 --- a/src/libs/engine/AudioDriver.h +++ b/src/libs/engine/AudioDriver.h @@ -20,8 +20,8 @@ #include "Driver.h" #include "types.h" -#include "List.h" -#include "raul/Path.h" +#include +#include namespace Ingen { diff --git a/src/libs/engine/Connection.h b/src/libs/engine/Connection.h index 2f0fed21..a7a2b3fa 100644 --- a/src/libs/engine/Connection.h +++ b/src/libs/engine/Connection.h @@ -20,7 +20,7 @@ #include #include -#include "MaidObject.h" +#include #include "types.h" namespace Ingen { @@ -38,7 +38,7 @@ class Port; * * \ingroup engine */ -class Connection : public MaidObject +class Connection : public Raul::Deletable { public: virtual ~Connection() {} diff --git a/src/libs/engine/DSSINode.cpp b/src/libs/engine/DSSINode.cpp index e3a2091e..bf81f5ec 100644 --- a/src/libs/engine/DSSINode.cpp +++ b/src/libs/engine/DSSINode.cpp @@ -62,7 +62,7 @@ DSSINode::instantiate() assert(!_ports); if (has_midi_input()) { - _ports = new Array(_descriptor->PortCount + 1); + _ports = new Raul::Array(_descriptor->PortCount + 1); _midi_in_port = new InputPort(this, "MIDI_In", _ports->size()-1, 1, DataType::MIDI, _buffer_size); _ports->at(_ports->size()-1) = _midi_in_port; } diff --git a/src/libs/engine/DuplexPort.h b/src/libs/engine/DuplexPort.h index d1b8847b..1c4e738d 100644 --- a/src/libs/engine/DuplexPort.h +++ b/src/libs/engine/DuplexPort.h @@ -20,7 +20,7 @@ #include #include "types.h" -#include "Array.h" +#include #include "Buffer.h" #include "InputPort.h" #include "OutputPort.h" diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp index 9781b5af..bf880c11 100644 --- a/src/libs/engine/Engine.cpp +++ b/src/libs/engine/Engine.cpp @@ -28,7 +28,7 @@ #include "ClientBroadcaster.h" #include "Patch.h" #include "ObjectStore.h" -#include "MaidObject.h" +#include #include "Maid.h" #include "MidiDriver.h" #include "QueuedEventSource.h" diff --git a/src/libs/engine/Event.h b/src/libs/engine/Event.h index 628b774b..f0fd170a 100644 --- a/src/libs/engine/Event.h +++ b/src/libs/engine/Event.h @@ -21,7 +21,7 @@ #include #include "raul/SharedPtr.h" #include "types.h" -#include "MaidObject.h" +#include #include "Responder.h" #include "ThreadManager.h" @@ -44,7 +44,7 @@ class Engine; * * \ingroup engine */ -class Event : public MaidObject +class Event : public Raul::Deletable { public: virtual ~Event() {} diff --git a/src/libs/engine/GraphObject.h b/src/libs/engine/GraphObject.h index aaf20e25..8754c28a 100644 --- a/src/libs/engine/GraphObject.h +++ b/src/libs/engine/GraphObject.h @@ -22,7 +22,7 @@ #include #include #include -#include "MaidObject.h" +#include #include "raul/Path.h" #include "raul/Atom.h" #include "types.h" @@ -41,13 +41,13 @@ class ObjectStore; /** An object on the audio graph - Patch, Node, Port, etc. * - * Each of these is a MaidObject and so can be deleted in a realtime safe + * Each of these is a Raul::Deletable and so can be deleted in a realtime safe * way from anywhere, and they all have a map of metadata for clients to store * arbitrary values in (which the engine puts no significance to whatsoever). * * \ingroup engine */ -class GraphObject : public MaidObject +class GraphObject : public Raul::Deletable { public: typedef std::map MetadataMap; diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp index 92a62a0e..cf0be342 100644 --- a/src/libs/engine/InputPort.cpp +++ b/src/libs/engine/InputPort.cpp @@ -46,7 +46,7 @@ template InputPort::InputPort(Node* parent, const string& name, siz */ template void -InputPort::add_connection(ListNode*>* const c) +InputPort::add_connection(Raul::ListNode*>* const c) { _connections.push_back(c); @@ -78,23 +78,23 @@ InputPort::add_connection(ListNode*>* const c) //assert( ! _is_tied || _tied_port != NULL); //assert( ! _is_tied || _buffers.at(0)->data() == _tied_port->buffer(0)->data()); } -template void InputPort::add_connection(ListNode*>* const c); -template void InputPort::add_connection(ListNode*>* const c); +template void InputPort::add_connection(Raul::ListNode*>* const c); +template void InputPort::add_connection(Raul::ListNode*>* const c); /** Remove a connection. Realtime safe. */ template -ListNode*>* +Raul::ListNode*>* InputPort::remove_connection(const OutputPort* const src_port) { bool modify_buffers = !_fixed_buffers; //if (modify_buffers && _is_tied) // modify_buffers = !_tied_port->fixed_buffers(); - typedef typename List*>::iterator TypedConnectionListIterator; + typedef typename Raul::List*>::iterator TypedConnectionListIterator; bool found = false; - ListNode*>* connection = NULL; + Raul::ListNode*>* connection = NULL; for (TypedConnectionListIterator i = _connections.begin(); i != _connections.end(); ++i) { if ((*i)->src_port()->path() == src_port->path()) { connection = _connections.remove(i); @@ -133,9 +133,9 @@ InputPort::remove_connection(const OutputPort* const src_port) return connection; } -template ListNode*>* +template Raul::ListNode*>* InputPort::remove_connection(const OutputPort* const src_port); -template ListNode*>* +template Raul::ListNode*>* InputPort::remove_connection(const OutputPort* const src_port); @@ -145,7 +145,7 @@ template bool InputPort::is_connected_to(const OutputPort* const port) const { - typedef typename List*>::const_iterator TypedConnectionListIterator; + typedef typename Raul::List*>::const_iterator TypedConnectionListIterator; for (TypedConnectionListIterator i = _connections.begin(); i != _connections.end(); ++i) if ((*i)->src_port() == port) return true; @@ -165,7 +165,7 @@ InputPort::process(SampleCount nframes, FrameTime start, FrameTime end) { //assert(!_is_tied || _tied_port != NULL); - typedef List*>::iterator TypedConnectionListIterator; + typedef Raul::List*>::iterator TypedConnectionListIterator; bool do_mixdown = true; if (_connections.size() == 0) return; @@ -233,7 +233,7 @@ InputPort::process(SampleCount nframes, FrameTime start, FrameTime assert(num_ins == 0 || num_ins == 1); - typedef List*>::iterator TypedConnectionListIterator; + typedef Raul::List*>::iterator TypedConnectionListIterator; assert(_poly == 1); for (TypedConnectionListIterator c = _connections.begin(); c != _connections.end(); ++c) @@ -307,7 +307,7 @@ InputPort::set_buffer_size(size_t size) TypedPort::set_buffer_size(size); assert(_buffer_size = size); - for (typename List*>::iterator c = _connections.begin(); c != _connections.end(); ++c) + for (typename Raul::List*>::iterator c = _connections.begin(); c != _connections.end(); ++c) (*c)->set_buffer_size(size); } diff --git a/src/libs/engine/InputPort.h b/src/libs/engine/InputPort.h index 0f96546f..14efd605 100644 --- a/src/libs/engine/InputPort.h +++ b/src/libs/engine/InputPort.h @@ -21,8 +21,8 @@ #include #include #include +#include #include "TypedPort.h" -#include "List.h" #include "MidiMessage.h" using std::string; @@ -51,10 +51,10 @@ public: InputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size); virtual ~InputPort() {} - void add_connection(ListNode*>* const c); - ListNode*>* remove_connection(const OutputPort* const src_port); + void add_connection(Raul::ListNode*>* const c); + Raul::ListNode*>* remove_connection(const OutputPort* const src_port); - const List*>& connections() { return _connections; } + const Raul::List*>& connections() { return _connections; } void process(SampleCount nframes, FrameTime start, FrameTime end); @@ -68,7 +68,7 @@ public: private: - List*> _connections; + Raul::List*> _connections; // This is just stupid... using TypedPort::_buffers; diff --git a/src/libs/engine/JackAudioDriver.cpp b/src/libs/engine/JackAudioDriver.cpp index 6775fd46..da2c056a 100644 --- a/src/libs/engine/JackAudioDriver.cpp +++ b/src/libs/engine/JackAudioDriver.cpp @@ -20,6 +20,7 @@ #include "tuning.h" #include #include +#include #include "Engine.h" #include "util.h" #include "Event.h" @@ -31,7 +32,6 @@ #include "Patch.h" #include "Port.h" #include "MidiDriver.h" -#include "List.h" #include "DuplexPort.h" #include "EventSource.h" #ifdef HAVE_LASH @@ -48,7 +48,7 @@ namespace Ingen { JackAudioPort::JackAudioPort(JackAudioDriver* driver, DuplexPort* patch_port) : DriverPort(patch_port->is_input()), - ListNode(this), + Raul::ListNode(this), _driver(driver), _jack_port(NULL), _jack_buffer(NULL), @@ -194,7 +194,7 @@ JackAudioDriver::deactivate() jack_deactivate(_client); _is_activated = false; - for (List::iterator i = _ports.begin(); i != _ports.end(); ++i) + for (Raul::List::iterator i = _ports.begin(); i != _ports.end(); ++i) jack_port_unregister(_client, (*i)->jack_port()); _ports.clear(); @@ -236,7 +236,7 @@ JackAudioDriver::remove_port(const Path& path) { assert(ThreadManager::current_thread_id() == THREAD_PROCESS); - for (List::iterator i = _ports.begin(); i != _ports.end(); ++i) + for (Raul::List::iterator i = _ports.begin(); i != _ports.end(); ++i) if ((*i)->patch_port()->path() == path) return _ports.remove(i)->elem(); @@ -248,7 +248,7 @@ JackAudioDriver::remove_port(const Path& path) DriverPort* JackAudioDriver::port(const Path& path) { - for (List::iterator i = _ports.begin(); i != _ports.end(); ++i) + for (Raul::List::iterator i = _ports.begin(); i != _ports.end(); ++i) if ((*i)->patch_port()->path() == path) return (*i); @@ -299,7 +299,7 @@ JackAudioDriver::_process_cb(jack_nframes_t nframes) _engine.event_source()->process(*_engine.post_processor(), nframes, start_of_last_cycle, start_of_current_cycle); // Set buffers of patch ports to Jack port buffers (zero-copy processing) - for (List::iterator i = _ports.begin(); i != _ports.end(); ++i) { + for (Raul::List::iterator i = _ports.begin(); i != _ports.end(); ++i) { assert(*i); (*i)->prepare_buffer(nframes); } diff --git a/src/libs/engine/JackAudioDriver.h b/src/libs/engine/JackAudioDriver.h index 769cb716..8629335e 100644 --- a/src/libs/engine/JackAudioDriver.h +++ b/src/libs/engine/JackAudioDriver.h @@ -20,9 +20,9 @@ #include #include -#include "raul/Thread.h" -#include "raul/Path.h" -#include "List.h" +#include +#include +#include #include "AudioDriver.h" #include "Buffer.h" @@ -40,7 +40,7 @@ typedef jack_default_audio_sample_t jack_sample_t; * * A Jack port always has a one-to-one association with a Patch port. */ -class JackAudioPort : public DriverPort, public ListNode +class JackAudioPort : public DriverPort, public Raul::ListNode { public: JackAudioPort(JackAudioDriver* driver, DuplexPort* patch_port); @@ -135,7 +135,7 @@ private: jack_position_t _position; jack_transport_state_t _transport_state; - List _ports; + Raul::List _ports; Patch* _root_patch; }; diff --git a/src/libs/engine/JackMidiDriver.cpp b/src/libs/engine/JackMidiDriver.cpp index 8414ff55..743d0fda 100644 --- a/src/libs/engine/JackMidiDriver.cpp +++ b/src/libs/engine/JackMidiDriver.cpp @@ -38,7 +38,7 @@ namespace Ingen { JackMidiPort::JackMidiPort(JackMidiDriver* driver, DuplexPort* patch_port) : DriverPort(patch_port->is_input()), - ListNode(this), + Raul::ListNode(this), _driver(driver), _jack_port(NULL), _patch_port(patch_port) @@ -146,7 +146,7 @@ JackMidiDriver::deactivate() void JackMidiDriver::prepare_block(const SampleCount block_start, const SampleCount block_end) { - for (List::iterator i = _in_ports.begin(); i != _in_ports.end(); ++i) + for (Raul::List::iterator i = _in_ports.begin(); i != _in_ports.end(); ++i) (*i)->prepare_block(block_start, block_end); } @@ -186,11 +186,11 @@ JackMidiDriver::remove_port(const Path& path) // FIXME: duplex? - for (List::iterator i = _in_ports.begin(); i != _in_ports.end(); ++i) + for (Raul::List::iterator i = _in_ports.begin(); i != _in_ports.end(); ++i) if ((*i)->patch_port()->path() == path) return _in_ports.remove(i)->elem(); - for (List::iterator i = _out_ports.begin(); i != _out_ports.end(); ++i) + for (Raul::List::iterator i = _out_ports.begin(); i != _out_ports.end(); ++i) if ((*i)->patch_port()->path() == path) return _out_ports.remove(i)->elem(); diff --git a/src/libs/engine/JackMidiDriver.h b/src/libs/engine/JackMidiDriver.h index 67c70e02..d6d2cf51 100644 --- a/src/libs/engine/JackMidiDriver.h +++ b/src/libs/engine/JackMidiDriver.h @@ -20,8 +20,8 @@ #include #include +#include #include "config.h" -#include "List.h" #include "MidiDriver.h" namespace Ingen { @@ -36,7 +36,7 @@ template class DuplexPort; * * \ingroup engine */ -class JackMidiPort : public DriverPort, public ListNode +class JackMidiPort : public DriverPort, public Raul::ListNode { public: JackMidiPort(JackMidiDriver* driver, DuplexPort* port); @@ -87,13 +87,13 @@ public: jack_client_t* jack_client() { return _client; } private: - List _in_ports; - List _out_ports; + Raul::List _in_ports; + Raul::List _out_ports; friend class JackMidiPort; - void add_output(ListNode* port); - ListNode* remove_output(JackMidiPort* port); + void add_output(Raul::ListNode* port); + Raul::ListNode* remove_output(JackMidiPort* port); // MIDI thread static void* process_midi_in(void* me); diff --git a/src/libs/engine/LADSPANode.cpp b/src/libs/engine/LADSPANode.cpp index 6a04abd1..d9b350b4 100644 --- a/src/libs/engine/LADSPANode.cpp +++ b/src/libs/engine/LADSPANode.cpp @@ -56,7 +56,7 @@ LADSPANode::instantiate() { // Note that a DSSI plugin might tack more on to the end of this if (!_ports) - _ports = new Array(_descriptor->PortCount); + _ports = new Raul::Array(_descriptor->PortCount); _instances = new LADSPA_Handle[_poly]; diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp index 5fd5008c..3e88efc5 100644 --- a/src/libs/engine/LV2Node.cpp +++ b/src/libs/engine/LV2Node.cpp @@ -61,7 +61,7 @@ LV2Node::instantiate() size_t num_ports = slv2_plugin_get_num_ports(_lv2_plugin); assert(num_ports > 0); - _ports = new Array(num_ports); + _ports = new Raul::Array(num_ports); _instances = new SLV2Instance*[_poly]; diff --git a/src/libs/engine/List.h b/src/libs/engine/List.h deleted file mode 100644 index a051b037..00000000 --- a/src/libs/engine/List.h +++ /dev/null @@ -1,409 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave 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 LIST_H -#define LIST_H - -#include -#include "types.h" -#include "MaidObject.h" - - -/** A node in a List. - * - * This class is (unusually) exposed to the user to allow list operations - * to be realtime safe (ie so events can allocate list nodes in other threads - * and then insert them in the realtime thread. - */ -template -class ListNode : public MaidObject -{ -public: - ListNode(T elem) : _elem(elem), _next(NULL), _prev(NULL) {} - virtual ~ListNode() {} - - ListNode* next() const { return _next; } - void next(ListNode* ln) { _next = ln; } - ListNode* prev() const { return _prev; } - void prev(ListNode* ln) { _prev = ln; } - T& elem() { return _elem;} - const T& elem() const { return _elem; } - -private: - T _elem; - ListNode* _next; - ListNode* _prev; -}; - - - -/** A realtime safe, (partially) thread safe doubly linked list. - * - * Elements can be added safely while another thread is reading the list. See - * documentation for specific functions for realtime/thread safeness. - */ -template -class List : public MaidObject -{ -public: - List() : _head(NULL), _tail(NULL), _size(0), _end_iter(this), _const_end_iter(this) - { - _end_iter._listnode = NULL; - _end_iter._next = NULL; - _const_end_iter._listnode = NULL; - _const_end_iter._next = NULL; - } - ~List(); - - void push_back(ListNode* elem); - ListNode* remove(const T elem); - - void clear(); - size_t size() const { return _size; } - - class iterator; - - /** Realtime safe const iterator for a List. */ - class const_iterator - { - public: - const_iterator(const List* const list); - const_iterator(const iterator& i) - : _list(i._list), _listnode(i._listnode), _next(i._next) {} - - inline const T& operator*(); - inline const_iterator& operator++(); - inline bool operator!=(const const_iterator& iter) const; - inline bool operator!=(const iterator& iter) const; - - friend class List; - - private: - const List* const _list; - const ListNode* _listnode; - const ListNode* _next; // use this instead of _listnode->next() to allow deleting - }; - - - /** Realtime safe iterator for a List. */ - class iterator - { - public: - iterator(List* const list); - - inline T& operator*(); - inline iterator& operator++(); - inline bool operator!=(const iterator& iter) const; - inline bool operator!=(const const_iterator& iter) const; - - friend class List; - friend class List::const_iterator; - - private: - const List* _list; - ListNode* _listnode; - ListNode* _next; // use this instead of _listnode->next() to allow deleting - }; - - - ListNode* remove(const iterator iter); - - iterator begin(); - const iterator end() const; - - const_iterator begin() const; - //const_iterator end() const; - -private: - ListNode* _head; - ListNode* _tail; - size_t _size; - iterator _end_iter; - const_iterator _const_end_iter; -}; - - - - -template -List::~List() -{ - clear(); -} - - -/** Clear the list, deleting all ListNodes contained (but NOT their contents!) - * - * Not realtime safe. - */ -template -void -List::clear() -{ - if (_head == NULL) return; - - ListNode* node = _head; - ListNode* next = NULL; - - while (node != NULL) { - next = node->next(); - delete node; - node = next; - } - _tail = _head = NULL; - _size = 0; -} - - -/** Add an element to the list. - * - * This method can be called while another thread is reading the list. - * Realtime safe. - */ -template -void -List::push_back(ListNode* const ln) -{ - assert(ln != NULL); - - ln->next(NULL); - // FIXME: atomicity? relevant? - if (_head == NULL) { - ln->prev(NULL); - _head = _tail = ln; - } else { - ln->prev(_tail); - _tail->next(ln); - _tail = ln; - } - ++_size; -} - - -/** Remove an element from the list. - * - * This function is realtime safe - it is the caller's responsibility to - * delete the returned ListNode, or there will be a leak. - */ -template -ListNode* -List::remove(const T elem) -{ - // FIXME: atomicity? - ListNode* n = _head; - while (n != NULL) { - if (n->elem() == elem) - break; - n = n->next(); - } - if (n != NULL) { - if (n == _head) _head = _head->next(); - if (n == _tail) _tail = _tail->prev(); - if (n->prev() != NULL) - n->prev()->next(n->next()); - if (n->next() != NULL) - n->next()->prev(n->prev()); - --_size; - if (_size == 0) _head = _tail = NULL; // FIXME: Shouldn't be necessary - return n; - } - return NULL; -} - - -/** Remove an element from the list using an iterator. - * - * This function is realtime safe - it is the caller's responsibility to - * delete the returned ListNode, or there will be a leak. - */ -template -ListNode* -List::remove(const iterator iter) -{ - ListNode* n = iter._listnode; - if (n != NULL) { - if (n == _head) _head = _head->next(); - if (n == _tail) _tail = _tail->prev(); - if (n->prev() != NULL) - n->prev()->next(n->next()); - if (n->next() != NULL) - n->next()->prev(n->prev()); - --_size; - if (_size == 0) _head = _tail = NULL; // FIXME: Shouldn't be necessary - return n; - } - return NULL; -} - - -//// Iterator stuff //// - -template -List::iterator::iterator(List* list) -: _list(list), - _listnode(NULL), - _next(NULL) -{ -} - - -template -T& -List::iterator::operator*() -{ - assert(_listnode != NULL); - return _listnode->elem(); -} - - -template -inline typename List::iterator& -List::iterator::operator++() -{ - assert(_listnode != NULL); - _listnode = _next; - if (_next != NULL) - _next = _next->next(); - else - _next = NULL; - - return *this; -} - - -template -inline bool -List::iterator::operator!=(const iterator& iter) const -{ - return (_listnode != iter._listnode); -} - - -template -inline bool -List::iterator::operator!=(const const_iterator& iter) const -{ - return (_listnode != iter._listnode); -} - - -template -inline typename List::iterator -List::begin() -{ - typename List::iterator iter(this); - iter._listnode = _head; - if (_head != NULL) - iter._next = _head->next(); - else - iter._next = NULL; - return iter; -} - - -template -inline const typename List::iterator -List::end() const -{ - /*typename List::iterator iter(this); - iter._listnode = NULL; - iter._next = NULL; - return iter;*/ - return _end_iter; -} - - - -/// const_iterator stuff /// - - -template -List::const_iterator::const_iterator(const List* const list) -: _list(list), - _listnode(NULL), - _next(NULL) -{ -} - - -template -const T& -List::const_iterator::operator*() -{ - assert(_listnode != NULL); - return _listnode->elem(); -} - - -template -inline typename List::const_iterator& -List::const_iterator::operator++() -{ - assert(_listnode != NULL); - _listnode = _next; - if (_next != NULL) - _next = _next->next(); - else - _next = NULL; - - return *this; -} - - -template -inline bool -List::const_iterator::operator!=(const const_iterator& iter) const -{ - return (_listnode != iter._listnode); -} - - -template -inline bool -List::const_iterator::operator!=(const iterator& iter) const -{ - return (_listnode != iter._listnode); -} - - -template -inline typename List::const_iterator -List::begin() const -{ - typename List::const_iterator iter(this); - iter._listnode = _head; - if (_head != NULL) - iter._next = _head->next(); - else - iter._next = NULL; - return iter; -} - -#if 0 -template -inline typename List::const_iterator -List::end() const -{ - /*typename List::const_iterator iter(this); - iter._listnode = NULL; - iter._next = NULL; - return iter;*/ - return _const_end_iter; -} -#endif - -#endif // LIST_H diff --git a/src/libs/engine/Maid.cpp b/src/libs/engine/Maid.cpp index 583db51f..d745e587 100644 --- a/src/libs/engine/Maid.cpp +++ b/src/libs/engine/Maid.cpp @@ -16,7 +16,7 @@ */ #include "Maid.h" -#include "MaidObject.h" +#include Maid::Maid(size_t size) @@ -36,7 +36,7 @@ Maid::~Maid() void Maid::cleanup() { - MaidObject* obj = NULL; + Raul::Deletable* obj = NULL; while (!_objects.empty()) { obj = _objects.front(); diff --git a/src/libs/engine/Maid.h b/src/libs/engine/Maid.h index 38d8d86c..038c0a5e 100644 --- a/src/libs/engine/Maid.h +++ b/src/libs/engine/Maid.h @@ -20,7 +20,7 @@ #include #include "raul/SRSWQueue.h" -#include "MaidObject.h" +#include /** Explicitly driven garbage collector. @@ -40,19 +40,19 @@ public: Maid(size_t size); ~Maid(); - inline void push(MaidObject* obj); + inline void push(Raul::Deletable* obj); void cleanup(); private: - Raul::SRSWQueue _objects; + Raul::SRSWQueue _objects; }; /** Push an event to be deleted. Realtime safe. */ inline void -Maid::push(MaidObject* obj) +Maid::push(Raul::Deletable* obj) { if (obj != NULL) _objects.push(obj); diff --git a/src/libs/engine/MaidObject.h b/src/libs/engine/MaidObject.h deleted file mode 100644 index f646832d..00000000 --- a/src/libs/engine/MaidObject.h +++ /dev/null @@ -1,36 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave 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 MAIDOBJECT_H -#define MAIDOBJECT_H - -#include - - -/** An object that can be passed to the maid for deletion. - * - * \ingroup engine - */ -class MaidObject : boost::noncopyable -{ -public: - MaidObject() {} - virtual ~MaidObject() {} -}; - - -#endif // MAIDOBJECT_H diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index 3eb30f9d..c2a6edf4 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -66,14 +66,11 @@ libingen_la_SOURCES = \ GraphObject.cpp \ Maid.h \ Maid.cpp \ - MaidObject.h \ Tree.h \ TreeImplementation.h \ PluginLibrary.h \ Plugin.h \ Plugin.cpp \ - Array.h \ - List.h \ PostProcessor.h \ PostProcessor.cpp \ Connection.h \ diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp index 4c9f8293..82db9b06 100644 --- a/src/libs/engine/MidiControlNode.cpp +++ b/src/libs/engine/MidiControlNode.cpp @@ -33,7 +33,7 @@ MidiControlNode::MidiControlNode(const string& path, size_t poly, Patch* parent, : InternalNode(new Plugin(Plugin::Internal, "ingen:control_node"), path, 1, parent, srate, buffer_size), _learning(false) { - _ports = new Array(7); + _ports = new Raul::Array(7); _midi_in_port = new InputPort(this, "MIDI_In", 0, 1, DataType::MIDI, _buffer_size); _ports->at(0) = _midi_in_port; diff --git a/src/libs/engine/MidiDriver.h b/src/libs/engine/MidiDriver.h index fba99177..1458aca5 100644 --- a/src/libs/engine/MidiDriver.h +++ b/src/libs/engine/MidiDriver.h @@ -18,6 +18,7 @@ #ifndef MIDIDRIVER_H #define MIDIDRIVER_H +#include "types.h" #include "Driver.h" #include using std::cout; using std::endl; diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp index ac84a19e..d0c14e23 100644 --- a/src/libs/engine/MidiNoteNode.cpp +++ b/src/libs/engine/MidiNoteNode.cpp @@ -18,11 +18,11 @@ #include "MidiNoteNode.h" #include #include +#include #include "MidiMessage.h" #include "InputPort.h" #include "OutputPort.h" #include "Plugin.h" -#include "Array.h" #include "AudioDriver.h" #include "util.h" #include "midi.h" @@ -38,7 +38,7 @@ MidiNoteNode::MidiNoteNode(const string& path, size_t poly, Patch* parent, Sampl _voices(new Voice[poly]), _sustain(false) { - _ports = new Array(5); + _ports = new Raul::Array(5); _midi_in_port = new InputPort(this, "MIDI_In", 0, 1, DataType::MIDI, _buffer_size); _ports->at(0) = _midi_in_port; diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp index b618ccd7..3a7d1762 100644 --- a/src/libs/engine/MidiTriggerNode.cpp +++ b/src/libs/engine/MidiTriggerNode.cpp @@ -29,7 +29,7 @@ namespace Ingen { MidiTriggerNode::MidiTriggerNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) : InternalNode(new Plugin(Plugin::Internal, "ingen:trigger_node"), path, 1, parent, srate, buffer_size) { - _ports = new Array(5); + _ports = new Raul::Array(5); _midi_in_port = new InputPort(this, "MIDI_In", 0, 1, DataType::MIDI, _buffer_size); _ports->at(0) = _midi_in_port; diff --git a/src/libs/engine/Node.h b/src/libs/engine/Node.h index 4dc28ffc..852751fb 100644 --- a/src/libs/engine/Node.h +++ b/src/libs/engine/Node.h @@ -19,13 +19,14 @@ #define NODE_H #include +#include #include "types.h" #include "GraphObject.h" -#include "Array.h" + using std::string; -template class List; +namespace Raul { template class List; } namespace Ingen { @@ -75,7 +76,7 @@ public: virtual void set_port_buffer(size_t voice, size_t port_num, void* buf) = 0; // FIXME: Only used by client senders. Remove? - virtual const Array& ports() const = 0; + virtual const Raul::Array& ports() const = 0; virtual size_t num_ports() const = 0; virtual size_t poly() const = 0; @@ -87,14 +88,14 @@ public: /** Nodes that are connected to this Node's inputs. * (This Node depends on them) */ - virtual List* providers() = 0; - virtual void providers(List* l) = 0; + virtual Raul::List* providers() = 0; + virtual void providers(Raul::List* l) = 0; /** Nodes are are connected to this Node's outputs. * (They depend on this Node) */ - virtual List* dependants() = 0; - virtual void dependants(List* l) = 0; + virtual Raul::List* dependants() = 0; + virtual void dependants(Raul::List* l) = 0; /** The Patch this Node belongs to. */ virtual Patch* parent_patch() const = 0; diff --git a/src/libs/engine/NodeBase.cpp b/src/libs/engine/NodeBase.cpp index 9f212c70..7f9fe23b 100644 --- a/src/libs/engine/NodeBase.cpp +++ b/src/libs/engine/NodeBase.cpp @@ -19,12 +19,12 @@ #include #include #include +#include +#include #include "util.h" -#include "Array.h" #include "Plugin.h" #include "ClientBroadcaster.h" #include "Port.h" -#include "List.h" #include "Patch.h" #include "ObjectStore.h" @@ -42,8 +42,8 @@ NodeBase::NodeBase(const Plugin* plugin, const string& name, size_t poly, Patch* _activated(false), _ports(NULL), _traversed(false), - _providers(new List()), - _dependants(new List()) + _providers(new Raul::List()), + _dependants(new Raul::List()) { assert(_plugin); assert(_poly > 0); diff --git a/src/libs/engine/NodeBase.h b/src/libs/engine/NodeBase.h index 3782c9eb..e78aaab2 100644 --- a/src/libs/engine/NodeBase.h +++ b/src/libs/engine/NodeBase.h @@ -71,13 +71,13 @@ public: bool traversed() const { return _traversed; } void traversed(bool b) { _traversed = b; } - const Array& ports() const { return *_ports; } + const Raul::Array& ports() const { return *_ports; } - virtual List* providers() { return _providers; } - virtual void providers(List* l) { _providers = l; } + virtual Raul::List* providers() { return _providers; } + virtual void providers(Raul::List* l) { _providers = l; } - virtual List* dependants() { return _dependants; } - virtual void dependants(List* l) { _dependants = l; } + virtual Raul::List* dependants() { return _dependants; } + virtual void dependants(Raul::List* l) { _dependants = l; } virtual const Plugin* plugin() const { return _plugin; } @@ -95,11 +95,11 @@ protected: size_t _buffer_size; bool _activated; - Array* _ports; ///< Access in audio thread only + Raul::Array* _ports; ///< Access in audio thread only bool _traversed; ///< Flag for process order algorithm - List* _providers; ///< Nodes connected to this one's input ports - List* _dependants; ///< Nodes this one's output ports are connected to + Raul::List* _providers; ///< Nodes connected to this one's input ports + Raul::List* _dependants; ///< Nodes this one's output ports are connected to }; diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp index 52c7099c..ee4653e5 100644 --- a/src/libs/engine/OSCClientSender.cpp +++ b/src/libs/engine/OSCClientSender.cpp @@ -259,7 +259,7 @@ void OSCClientSender::new_node(string plugin_uri, /* - const Array& ports = node->ports(); + const Raul::Array& ports = node->ports(); Port* port; PortInfo* info; for (size_t j=0; j < ports.size(); ++j) { diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index 8d8fc769..ce480316 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -36,7 +36,7 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch, bool recur if (recursive) { // Send nodes - for (List::const_iterator j = patch->nodes().begin(); + for (Raul::List::const_iterator j = patch->nodes().begin(); j != patch->nodes().end(); ++j) { const Node* const node = (*j); @@ -52,7 +52,7 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch, bool recur } // Send connections - for (List::const_iterator j = patch->connections().begin(); + for (Raul::List::const_iterator j = patch->connections().begin(); j != patch->connections().end(); ++j) { client->connection((*j)->src_port()->path(), (*j)->dst_port()->path()); @@ -97,7 +97,7 @@ ObjectSender::send_node(ClientInterface* client, const Node* node, bool recursiv // FIXME: bundleify //client->bundle_begin(); - const Array& ports = node->ports(); + const Raul::Array& ports = node->ports(); client->new_node(node->plugin()->uri(), node->path(), polyphonic, ports.size()); diff --git a/src/libs/engine/ObjectStore.cpp b/src/libs/engine/ObjectStore.cpp index af7f219c..709e3823 100644 --- a/src/libs/engine/ObjectStore.cpp +++ b/src/libs/engine/ObjectStore.cpp @@ -15,12 +15,12 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include +#include #include "ObjectStore.h" #include "Patch.h" #include "Node.h" #include "Port.h" -#include "List.h" -#include "raul/Path.h" #include "Tree.h" namespace Ingen { @@ -87,7 +87,7 @@ ObjectStore::add(TreeNode* tn) /** Remove a patch from the store. * - * It it the caller's responsibility to delete the returned ListNode. + * It it the caller's responsibility to delete the returned Raul::ListNode. * * @returns TreeNode containing object removed on success, NULL if not found. */ diff --git a/src/libs/engine/Patch.cpp b/src/libs/engine/Patch.cpp index c8ccc59c..8ebb35e6 100644 --- a/src/libs/engine/Patch.cpp +++ b/src/libs/engine/Patch.cpp @@ -51,12 +51,12 @@ Patch::~Patch() { assert(!_activated); - for (List::iterator i = _connections.begin(); i != _connections.end(); ++i) { + for (Raul::List::iterator i = _connections.begin(); i != _connections.end(); ++i) { delete (*i); delete _connections.remove(i); } - for (List::iterator i = _nodes.begin(); i != _nodes.end(); ++i) { + for (Raul::List::iterator i = _nodes.begin(); i != _nodes.end(); ++i) { assert(!(*i)->activated()); delete (*i); delete _nodes.remove(i); @@ -71,7 +71,7 @@ Patch::activate() { NodeBase::activate(); - for (List::iterator i = _nodes.begin(); i != _nodes.end(); ++i) + for (Raul::List::iterator i = _nodes.begin(); i != _nodes.end(); ++i) (*i)->activate(); assert(_activated); @@ -85,7 +85,7 @@ Patch::deactivate() NodeBase::deactivate(); - for (List::iterator i = _nodes.begin(); i != _nodes.end(); ++i) { + for (Raul::List::iterator i = _nodes.begin(); i != _nodes.end(); ++i) { if ((*i)->activated()) (*i)->deactivate(); assert(!(*i)->activated()); @@ -99,11 +99,11 @@ void Patch::disable() { // Write output buffers to 0 - /*for (List::iterator i = _bridge_nodes.begin(); i != _bridge_nodes.end(); ++i) { + /*for (Raul::List::iterator i = _bridge_nodes.begin(); i != _bridge_nodes.end(); ++i) { assert((*i)->as_port() != NULL); if ((*i)->as_port()->port_info()->is_output()) (*i)->as_port()->clear_buffers();*/ - for (List::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) + for (Raul::List::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) (*i)->clear_buffers(); _process = false; @@ -123,7 +123,7 @@ Patch::process(SampleCount nframes, FrameTime start, FrameTime end) // FIXME: This is far too slow, too much checking every cycle // Prepare input ports for nodes to consume - for (List::iterator i = _input_ports.begin(); i != _input_ports.end(); ++i) + for (Raul::List::iterator i = _input_ports.begin(); i != _input_ports.end(); ++i) (*i)->process(nframes, start, end); // Run all nodes (consume input ports) @@ -135,7 +135,7 @@ Patch::process(SampleCount nframes, FrameTime start, FrameTime end) } // Prepare output ports (for caller to consume) - for (List::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) + for (Raul::List::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) (*i)->process(nframes, start, end); } @@ -146,7 +146,7 @@ Patch::set_buffer_size(size_t size) NodeBase::set_buffer_size(size); assert(_buffer_size == size); - for (List::iterator j = _nodes.begin(); j != _nodes.end(); ++j) + for (Raul::List::iterator j = _nodes.begin(); j != _nodes.end(); ++j) (*j)->set_buffer_size(size); } @@ -158,7 +158,7 @@ Patch::add_to_store(ObjectStore* store) NodeBase::add_to_store(store); // Add nodes - for (List::iterator j = _nodes.begin(); j != _nodes.end(); ++j) + for (Raul::List::iterator j = _nodes.begin(); j != _nodes.end(); ++j) (*j)->add_to_store(store); } @@ -170,7 +170,7 @@ Patch::remove_from_store() NodeBase::remove_from_store(); // Remove nodes - for (List::iterator j = _nodes.begin(); j != _nodes.end(); ++j) + for (Raul::List::iterator j = _nodes.begin(); j != _nodes.end(); ++j) (*j)->remove_from_store(); } @@ -179,7 +179,7 @@ Patch::remove_from_store() void -Patch::add_node(ListNode* ln) +Patch::add_node(Raul::ListNode* ln) { assert(ln != NULL); assert(ln->elem() != NULL); @@ -193,10 +193,10 @@ Patch::add_node(ListNode* ln) /** Remove a node. * Realtime Safe. Preprocessing thread. */ -ListNode* +Raul::ListNode* Patch::remove_node(const string& name) { - for (List::iterator i = _nodes.begin(); i != _nodes.end(); ++i) + for (Raul::List::iterator i = _nodes.begin(); i != _nodes.end(); ++i) if ((*i)->name() == name) return _nodes.remove(i); @@ -206,12 +206,12 @@ Patch::remove_node(const string& name) /** Remove a connection. Realtime safe. */ -ListNode* +Raul::ListNode* Patch::remove_connection(const Port* src_port, const Port* dst_port) { bool found = false; - ListNode* connection = NULL; - for (List::iterator i = _connections.begin(); i != _connections.end(); ++i) { + Raul::ListNode* connection = NULL; + for (Raul::List::iterator i = _connections.begin(); i != _connections.end(); ++i) { if ((*i)->src_port() == src_port && (*i)->dst_port() == dst_port) { connection = _connections.remove(i); found = true; @@ -227,12 +227,12 @@ Patch::remove_connection(const Port* src_port, const Port* dst_port) #if 0 /** Remove a bridge_node. Realtime safe. */ -ListNode* +Raul::ListNode* Patch::remove_bridge_node(const InternalNode* node) { bool found = false; - ListNode* bridge_node = NULL; - for (List::iterator i = _bridge_nodes.begin(); i != _bridge_nodes.end(); ++i) { + Raul::ListNode* bridge_node = NULL; + for (Raul::List::iterator i = _bridge_nodes.begin(); i != _bridge_nodes.end(); ++i) { if ((*i) == node) { bridge_node = _bridge_nodes.remove(i); found = true; @@ -288,14 +288,14 @@ Patch::create_port(const string& name, DataType type, size_t buffer_size, bool i * * Realtime safe. Preprocessing thread only. */ -ListNode* +Raul::ListNode* Patch::remove_port(const string& name) { assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); bool found = false; - ListNode* ret = NULL; - for (List::iterator i = _input_ports.begin(); i != _input_ports.end(); ++i) { + Raul::ListNode* ret = NULL; + for (Raul::List::iterator i = _input_ports.begin(); i != _input_ports.end(); ++i) { if ((*i)->name() == name) { ret = _input_ports.remove(i); found = true; @@ -303,7 +303,7 @@ Patch::remove_port(const string& name) } if (!found) - for (List::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) { + for (Raul::List::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) { if ((*i)->name() == name) { ret = _output_ports.remove(i); found = true; @@ -317,19 +317,19 @@ Patch::remove_port(const string& name) } -Array* +Raul::Array* Patch::build_ports_array() const { assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); - Array* const result = new Array(_input_ports.size() + _output_ports.size()); + Raul::Array* const result = new Raul::Array(_input_ports.size() + _output_ports.size()); size_t i = 0; - for (List::const_iterator p = _input_ports.begin(); p != _input_ports.end(); ++p,++i) + for (Raul::List::const_iterator p = _input_ports.begin(); p != _input_ports.end(); ++p,++i) result->at(i) = *p; - for (List::const_iterator p = _output_ports.begin(); p != _output_ports.end(); ++p,++i) + for (Raul::List::const_iterator p = _output_ports.begin(); p != _output_ports.end(); ++p,++i) result->at(i) = *p; return result; @@ -346,24 +346,24 @@ Patch::build_ports_array() const * * Not realtime safe. */ -Array* +Raul::Array* Patch::build_process_order() const { assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); cerr << "*********** Building process order for " << path() << endl; - Array* const process_order = new Array(_nodes.size(), NULL); + Raul::Array* const process_order = new Raul::Array(_nodes.size(), NULL); // FIXME: tweak algorithm so it just ends up like this and save the cost of iteration? - for (List::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) + for (Raul::List::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) (*i)->traversed(false); // Traverse backwards starting at outputs - //for (List::const_iterator p = _output_ports.begin(); p != _output_ports.end(); ++p) { + //for (Raul::List::const_iterator p = _output_ports.begin(); p != _output_ports.end(); ++p) { /*const Port* const port = (*p); - for (List::const_iterator c = port->connections().begin(); + for (Raul::List::const_iterator c = port->connections().begin(); c != port->connections().end(); ++c) { const Connection* const connection = (*c); assert(connection->dst_port() == port); @@ -373,7 +373,7 @@ Patch::build_process_order() const }*/ //} - for (List::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) { + for (Raul::List::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) { Node* const node = (*i); // Either a sink or connected to our output ports: if ( ( ! node->traversed()) && node->dependants()->size() == 0) @@ -382,7 +382,7 @@ Patch::build_process_order() const // Add any (disjoint) nodes that weren't hit by the traversal // FIXME: this shouldn't be necessary - /*for (List::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) { + /*for (Raul::List::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) { Node* const node = (*i); if ( ! node->traversed()) { process_order->push_back(*i); @@ -417,7 +417,7 @@ Patch::set_path(const Path& new_path) const Path old_path = path(); // Update nodes - for (List::iterator i = _nodes.begin(); i != _nodes.end(); ++i) + for (Raul::List::iterator i = _nodes.begin(); i != _nodes.end(); ++i) (*i)->set_path(new_path.base() + (*i)->name()); // Update self diff --git a/src/libs/engine/Patch.h b/src/libs/engine/Patch.h index 7fc3a1bb..55a2be83 100644 --- a/src/libs/engine/Patch.h +++ b/src/libs/engine/Patch.h @@ -20,9 +20,9 @@ #include #include +#include #include "NodeBase.h" #include "Plugin.h" -#include "List.h" #include "DataType.h" using std::string; @@ -68,33 +68,33 @@ public: // Patch specific stuff not inherited from Node - void add_node(ListNode* tn); - ListNode* remove_node(const string& name); + void add_node(Raul::ListNode* tn); + Raul::ListNode* remove_node(const string& name); - List& nodes() { return _nodes; } - List& connections() { return _connections; } + Raul::List& nodes() { return _nodes; } + Raul::List& connections() { return _connections; } - const List& nodes() const { return _nodes; } - const List& connections() const { return _connections; } + const Raul::List& nodes() const { return _nodes; } + const Raul::List& connections() const { return _connections; } size_t num_ports() const; Port* create_port(const string& name, DataType type, size_t buffer_size, bool is_output); - void add_input(ListNode* port) { _input_ports.push_back(port); } ///< Preprocesser thread - void add_output(ListNode* port) { _output_ports.push_back(port); } ///< Preprocessor thread - ListNode* remove_port(const string& name); + void add_input(Raul::ListNode* port) { _input_ports.push_back(port); } ///< Preprocesser thread + void add_output(Raul::ListNode* port) { _output_ports.push_back(port); } ///< Preprocessor thread + Raul::ListNode* remove_port(const string& name); - void add_connection(ListNode* c) { _connections.push_back(c); } - ListNode* remove_connection(const Port* src_port, const Port* dst_port); + void add_connection(Raul::ListNode* c) { _connections.push_back(c); } + Raul::ListNode* remove_connection(const Port* src_port, const Port* dst_port); - Array* process_order() { return _process_order; } - void process_order(Array* po) { _process_order = po; } + Raul::Array* process_order() { return _process_order; } + void process_order(Raul::Array* po) { _process_order = po; } - Array* external_ports() { return _ports; } - void external_ports(Array* pa) { _ports = pa; } + Raul::Array* external_ports() { return _ports; } + void external_ports(Raul::Array* pa) { _ports = pa; } - Array* build_process_order() const; - Array* build_ports_array() const; + Raul::Array* build_process_order() const; + Raul::Array* build_ports_array() const; /** Whether to run this patch's DSP bits in the audio thread */ bool enabled() const { return _process; } @@ -104,14 +104,14 @@ public: size_t internal_poly() const { return _internal_poly; } private: - inline void build_process_order_recursive(Node* n, Array* order) const; + inline void build_process_order_recursive(Node* n, Raul::Array* order) const; size_t _internal_poly; - Array* _process_order; ///< Accessed in audio thread only - List _connections; ///< Accessed in audio thread only - List _input_ports; ///< Accessed in preprocessing thread only - List _output_ports; ///< Accessed in preprocessing thread only - List _nodes; ///< Accessed in preprocessing thread only + Raul::Array* _process_order; ///< Accessed in audio thread only + Raul::List _connections; ///< Accessed in audio thread only + Raul::List _input_ports; ///< Accessed in preprocessing thread only + Raul::List _output_ports; ///< Accessed in preprocessing thread only + Raul::List _nodes; ///< Accessed in preprocessing thread only bool _process; }; @@ -119,13 +119,13 @@ private: /** Private helper for build_process_order */ inline void -Patch::build_process_order_recursive(Node* n, Array* order) const +Patch::build_process_order_recursive(Node* n, Raul::Array* order) const { if (n == NULL || n->traversed()) return; n->traversed(true); assert(order != NULL); - for (List::iterator i = n->providers()->begin(); i != n->providers()->end(); ++i) + for (Raul::List::iterator i = n->providers()->begin(); i != n->providers()->end(); ++i) if ( ! (*i)->traversed() ) build_process_order_recursive((*i), order); diff --git a/src/libs/engine/Tree.h b/src/libs/engine/Tree.h index 9c03070f..e2ef785b 100644 --- a/src/libs/engine/Tree.h +++ b/src/libs/engine/Tree.h @@ -21,7 +21,7 @@ #include #include #include -#include "MaidObject.h" +#include using std::string; template class Tree; @@ -30,7 +30,7 @@ template class Tree; /** A node in a Tree. */ template -class TreeNode : public MaidObject +class TreeNode : public Raul::Deletable { public: TreeNode(const string& key) diff --git a/src/libs/engine/TypedPort.h b/src/libs/engine/TypedPort.h index 8c9ab149..2dc687a5 100644 --- a/src/libs/engine/TypedPort.h +++ b/src/libs/engine/TypedPort.h @@ -20,7 +20,7 @@ #include #include "types.h" -#include "Array.h" +#include #include "Port.h" #include "Buffer.h" @@ -67,7 +67,7 @@ protected: bool _fixed_buffers; - Array*> _buffers; + Raul::Array*> _buffers; }; diff --git a/src/libs/engine/events/AddNodeEvent.cpp b/src/libs/engine/events/AddNodeEvent.cpp index 485bd1cd..146ca3b6 100644 --- a/src/libs/engine/events/AddNodeEvent.cpp +++ b/src/libs/engine/events/AddNodeEvent.cpp @@ -94,7 +94,7 @@ AddNodeEvent::pre_process() // This can be done here because the audio thread doesn't touch the // node tree - just the process order array - _patch->add_node(new ListNode(_node)); + _patch->add_node(new Raul::ListNode(_node)); _node->add_to_store(_engine.object_store()); // FIXME: not really necessary to build process order since it's not connected, diff --git a/src/libs/engine/events/AddNodeEvent.h b/src/libs/engine/events/AddNodeEvent.h index 8ac88b08..6b68f627 100644 --- a/src/libs/engine/events/AddNodeEvent.h +++ b/src/libs/engine/events/AddNodeEvent.h @@ -23,7 +23,7 @@ #include using std::string; -template class Array; +namespace Raul { template class Array; } template class TreeNode; namespace Ingen { @@ -71,7 +71,7 @@ private: bool _poly; Patch* _patch; Node* _node; - Array* _process_order; ///< Patch's new process order + Raul::Array* _process_order; ///< Patch's new process order bool _node_already_exists; }; diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp index 74345df5..c775fe04 100644 --- a/src/libs/engine/events/AddPortEvent.cpp +++ b/src/libs/engine/events/AddPortEvent.cpp @@ -31,10 +31,10 @@ #include "Port.h" #include "AudioDriver.h" #include "MidiDriver.h" -#include "List.h" +#include #include "Driver.h" #include "DuplexPort.h" -#include "Array.h" +#include namespace Ingen { @@ -97,14 +97,14 @@ AddPortEvent::pre_process() if (_patch_port) { if (_is_output) - _patch->add_output(new ListNode(_patch_port)); + _patch->add_output(new Raul::ListNode(_patch_port)); else - _patch->add_input(new ListNode(_patch_port)); + _patch->add_input(new Raul::ListNode(_patch_port)); if (_patch->external_ports()) - _ports_array = new Array(old_num_ports + 1, *_patch->external_ports()); + _ports_array = new Raul::Array(old_num_ports + 1, *_patch->external_ports()); else - _ports_array = new Array(old_num_ports + 1, NULL); + _ports_array = new Raul::Array(old_num_ports + 1, NULL); _ports_array->at(_patch->num_ports()-1) = _patch_port; diff --git a/src/libs/engine/events/AddPortEvent.h b/src/libs/engine/events/AddPortEvent.h index 46c013ca..84302029 100644 --- a/src/libs/engine/events/AddPortEvent.h +++ b/src/libs/engine/events/AddPortEvent.h @@ -19,9 +19,9 @@ #define ADDPORTEVENT_H #include "QueuedEvent.h" -#include "raul/Path.h" +#include +#include #include "DataType.h" -#include "Array.h" #include using std::string; @@ -55,7 +55,7 @@ private: DataType _data_type; Patch* _patch; Port* _patch_port; - Array* _ports_array; ///< New (external) ports array for Patch + Raul::Array* _ports_array; ///< New (external) ports array for Patch DriverPort* _driver_port; ///< Driver (eg Jack) port if this is a toplevel port bool _succeeded; }; diff --git a/src/libs/engine/events/AllNotesOffEvent.cpp b/src/libs/engine/events/AllNotesOffEvent.cpp index 16e54fc5..6c87e52a 100644 --- a/src/libs/engine/events/AllNotesOffEvent.cpp +++ b/src/libs/engine/events/AllNotesOffEvent.cpp @@ -51,7 +51,7 @@ AllNotesOffEvent::execute(SampleCount nframes, FrameTime start, FrameTime end) _patch = _engine.object_store()->find_patch(_patch_path); //if (_patch != NULL) - // for (List::iterator j = _patch->midi_in_nodes().begin(); j != _patch->midi_in_nodes().end(); ++j) + // for (Raul::List::iterator j = _patch->midi_in_nodes().begin(); j != _patch->midi_in_nodes().end(); ++j) // (*j)->all_notes_off(offset); } diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp index d300e2ff..d776df8b 100644 --- a/src/libs/engine/events/ClearPatchEvent.cpp +++ b/src/libs/engine/events/ClearPatchEvent.cpp @@ -49,7 +49,7 @@ ClearPatchEvent::pre_process() _process = _patch->enabled(); - for (List::const_iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i) + for (Raul::List::const_iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i) (*i)->remove_from_store(); } @@ -66,7 +66,7 @@ ClearPatchEvent::execute(SampleCount nframes, FrameTime start, FrameTime end) _patch->disable(); cerr << "FIXME: CLEAR PATCH\n"; - //for (List::const_iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i) + //for (Raul::List::const_iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i) // (*i)->remove_from_patch(); if (_patch->process_order() != NULL) { @@ -82,14 +82,14 @@ ClearPatchEvent::post_process() { if (_patch != NULL) { // Delete all nodes - for (List::iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i) { + for (Raul::List::iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i) { (*i)->deactivate(); delete *i; } _patch->nodes().clear(); // Delete all connections - for (List::iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) + for (Raul::List::iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) delete *i; _patch->connections().clear(); diff --git a/src/libs/engine/events/ClearPatchEvent.h b/src/libs/engine/events/ClearPatchEvent.h index e50f599e..c3570518 100644 --- a/src/libs/engine/events/ClearPatchEvent.h +++ b/src/libs/engine/events/ClearPatchEvent.h @@ -19,8 +19,8 @@ #define CLEARPATCHEVENT_H #include +#include #include "QueuedEvent.h" -#include "Array.h" using std::string; diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp index fef7892b..c0dcc18c 100644 --- a/src/libs/engine/events/ConnectionEvent.cpp +++ b/src/libs/engine/events/ConnectionEvent.cpp @@ -214,14 +214,14 @@ TypedConnectionEvent::pre_process() } _connection = new TypedConnection(_src_port, _dst_port); - _port_listnode = new ListNode*>(_connection); - _patch_listnode = new ListNode(_connection); + _port_listnode = new Raul::ListNode*>(_connection); + _patch_listnode = new Raul::ListNode(_connection); // Need to be careful about patch port connections here and adding a node's // parent as a dependant/provider, or adding a patch as it's own provider... if (src_node != dst_node && src_node->parent() == dst_node->parent()) { - dst_node->providers()->push_back(new ListNode(src_node)); - src_node->dependants()->push_back(new ListNode(dst_node)); + dst_node->providers()->push_back(new Raul::ListNode(src_node)); + src_node->dependants()->push_back(new Raul::ListNode(dst_node)); } if (_patch->enabled()) diff --git a/src/libs/engine/events/ConnectionEvent.h b/src/libs/engine/events/ConnectionEvent.h index b0c81923..79ffeaa3 100644 --- a/src/libs/engine/events/ConnectionEvent.h +++ b/src/libs/engine/events/ConnectionEvent.h @@ -24,8 +24,10 @@ #include "types.h" using std::string; -template class ListNode; -template class Array; +namespace Raul { + template class ListNode; + template class Array; +} namespace Ingen { @@ -92,10 +94,10 @@ private: InputPort* _dst_port; Patch* _patch; - Array* _process_order; ///< New process order for Patch + Raul::Array* _process_order; ///< New process order for Patch TypedConnection* _connection; - ListNode* _patch_listnode; - ListNode*>* _port_listnode; + Raul::ListNode* _patch_listnode; + Raul::ListNode*>* _port_listnode; bool _succeeded; }; diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp index 53837255..96d9c8e3 100644 --- a/src/libs/engine/events/CreatePatchEvent.cpp +++ b/src/libs/engine/events/CreatePatchEvent.cpp @@ -72,7 +72,7 @@ CreatePatchEvent::pre_process() _patch = new Patch(_path.name(), poly, _parent, _engine.audio_driver()->sample_rate(), _engine.audio_driver()->buffer_size(), _poly); if (_parent != NULL) { - _parent->add_node(new ListNode(_patch)); + _parent->add_node(new Raul::ListNode(_patch)); if (_parent->enabled()) _process_order = _parent->build_process_order(); diff --git a/src/libs/engine/events/CreatePatchEvent.h b/src/libs/engine/events/CreatePatchEvent.h index 88eb780b..dd492a33 100644 --- a/src/libs/engine/events/CreatePatchEvent.h +++ b/src/libs/engine/events/CreatePatchEvent.h @@ -18,12 +18,13 @@ #ifndef CREATEPATCHEVENT_H #define CREATEPATCHEVENT_H -#include "raul/Path.h" -#include "QueuedEvent.h" #include +#include +#include "QueuedEvent.h" + using std::string; -template class Array; +namespace Raul { template class Array; } template class TreeNode; namespace Ingen { @@ -52,7 +53,7 @@ private: Path _path; Patch* _patch; Patch* _parent; - Array* _process_order; + Raul::Array* _process_order; TreeNode* _patch_treenode; int _poly; ErrorType _error; diff --git a/src/libs/engine/events/DestroyEvent.h b/src/libs/engine/events/DestroyEvent.h index 49c7b074..435736aa 100644 --- a/src/libs/engine/events/DestroyEvent.h +++ b/src/libs/engine/events/DestroyEvent.h @@ -18,14 +18,17 @@ #ifndef DESTROYEVENT_H #define DESTROYEVENT_H -#include "raul/Path.h" -#include "QueuedEvent.h" #include +#include +#include "QueuedEvent.h" + using std::string; -template class Array; -template class ListNode; +namespace Raul { + template class Array; + template class ListNode; +} template class TreeNode; namespace Ingen { @@ -61,11 +64,11 @@ private: Node* _node; ///< Same as _object if it is a Node, otherwise NULL Port* _port; ///< Same as _object if it is a Port, otherwise NULL DriverPort* _driver_port; - ListNode* _patch_node_listnode; - ListNode* _patch_port_listnode; + Raul::ListNode* _patch_node_listnode; + Raul::ListNode* _patch_port_listnode; TreeNode* _store_treenode; - Array* _ports_array; ///< New (external) ports array for Patch - Array* _process_order; ///< Patch's new process order + Raul::Array* _ports_array; ///< New (external) ports array for Patch + Raul::Array* _process_order; ///< Patch's new process order DisconnectNodeEvent* _disconnect_node_event; DisconnectPortEvent* _disconnect_port_event; }; diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp index 6be22572..1dc5121f 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.cpp +++ b/src/libs/engine/events/DisconnectNodeEvent.cpp @@ -17,15 +17,15 @@ #include "DisconnectNodeEvent.h" #include +#include +#include #include "Responder.h" #include "Engine.h" #include "Maid.h" -#include "List.h" #include "Node.h" #include "TypedConnection.h" #include "DisconnectionEvent.h" #include "Port.h" -#include "Array.h" #include "InputPort.h" #include "OutputPort.h" #include "Patch.h" @@ -65,7 +65,7 @@ DisconnectNodeEvent::DisconnectNodeEvent(Engine& engine, Node* node) DisconnectNodeEvent::~DisconnectNodeEvent() { - for (List::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) + for (Raul::List::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) delete (*i); } @@ -73,7 +73,7 @@ DisconnectNodeEvent::~DisconnectNodeEvent() void DisconnectNodeEvent::pre_process() { - typedef List::const_iterator ConnectionListIterator; + typedef Raul::List::const_iterator ConnectionListIterator; // cerr << "Preparing disconnection event...\n"; @@ -102,7 +102,7 @@ DisconnectNodeEvent::pre_process() DisconnectionEvent* ev = new DisconnectionEvent(_engine, SharedPtr(new Responder()), _time, c->src_port(), c->dst_port()); ev->pre_process(); - _disconnection_events.push_back(new ListNode(ev)); + _disconnection_events.push_back(new Raul::ListNode(ev)); c->pending_disconnection(true); } } @@ -118,7 +118,7 @@ DisconnectNodeEvent::execute(SampleCount nframes, FrameTime start, FrameTime end QueuedEvent::execute(nframes, start, end); if (_succeeded) { - for (List::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) + for (Raul::List::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) (*i)->execute(nframes, start, end); } } @@ -130,7 +130,7 @@ DisconnectNodeEvent::post_process() if (_succeeded) { if (_responder) _responder->respond_ok(); - for (List::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) + for (Raul::List::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) (*i)->post_process(); } else { if (_responder) diff --git a/src/libs/engine/events/DisconnectNodeEvent.h b/src/libs/engine/events/DisconnectNodeEvent.h index 7a028aca..bf4644ad 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.h +++ b/src/libs/engine/events/DisconnectNodeEvent.h @@ -19,9 +19,10 @@ #define DISCONNECTNODEEVENT_H #include -#include "raul/Path.h" +#include +#include #include "QueuedEvent.h" -#include "List.h" + using std::string; namespace Ingen { @@ -55,7 +56,7 @@ private: Path _node_path; Patch* _patch; Node* _node; - List _disconnection_events; + Raul::List _disconnection_events; bool _succeeded; bool _lookup; diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp index 9f4d7b74..76c95ef9 100644 --- a/src/libs/engine/events/DisconnectPortEvent.cpp +++ b/src/libs/engine/events/DisconnectPortEvent.cpp @@ -20,12 +20,12 @@ #include "Responder.h" #include "Engine.h" #include "Maid.h" -#include "List.h" +#include #include "Node.h" #include "Connection.h" #include "DisconnectionEvent.h" #include "Port.h" -#include "Array.h" +#include #include "InputPort.h" #include "OutputPort.h" #include "Patch.h" @@ -66,7 +66,7 @@ DisconnectPortEvent::DisconnectPortEvent(Engine& engine, Port* port) DisconnectPortEvent::~DisconnectPortEvent() { - for (List::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) + for (Raul::List::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) delete (*i); } @@ -101,13 +101,13 @@ DisconnectPortEvent::pre_process() } Connection* c = NULL; - for (List::const_iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) { + for (Raul::List::const_iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) { c = (*i); if ((c->src_port() == _port || c->dst_port() == _port) && !c->pending_disconnection()) { DisconnectionEvent* ev = new DisconnectionEvent(_engine, SharedPtr(new Responder()), _time, c->src_port(), c->dst_port()); ev->pre_process(); - _disconnection_events.push_back(new ListNode(ev)); + _disconnection_events.push_back(new Raul::ListNode(ev)); c->pending_disconnection(true); } } @@ -123,7 +123,7 @@ DisconnectPortEvent::execute(SampleCount nframes, FrameTime start, FrameTime end QueuedEvent::execute(nframes, start, end); if (_succeeded) { - for (List::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) + for (Raul::List::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) (*i)->execute(nframes, start, end); } } @@ -135,7 +135,7 @@ DisconnectPortEvent::post_process() if (_succeeded) { if (_responder) _responder->respond_ok(); - for (List::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) + for (Raul::List::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) (*i)->post_process(); } else { if (_responder) diff --git a/src/libs/engine/events/DisconnectPortEvent.h b/src/libs/engine/events/DisconnectPortEvent.h index e09688a1..f3058fa1 100644 --- a/src/libs/engine/events/DisconnectPortEvent.h +++ b/src/libs/engine/events/DisconnectPortEvent.h @@ -21,9 +21,9 @@ #include #include "raul/Path.h" #include "QueuedEvent.h" -#include "List.h" +#include -template class Array; +namespace Raul { template class Array; } namespace Ingen { @@ -56,9 +56,9 @@ private: Path _port_path; Patch* _patch; Port* _port; - List _disconnection_events; + Raul::List _disconnection_events; - Array* _process_order; // Patch's new process order + Raul::Array* _process_order; // Patch's new process order bool _succeeded; bool _lookup; diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp index 20c1b371..84ca49ff 100644 --- a/src/libs/engine/events/DisconnectionEvent.cpp +++ b/src/libs/engine/events/DisconnectionEvent.cpp @@ -214,13 +214,13 @@ TypedDisconnectionEvent::pre_process() return; } - for (List::iterator i = dst_node->providers()->begin(); i != dst_node->providers()->end(); ++i) + for (Raul::List::iterator i = dst_node->providers()->begin(); i != dst_node->providers()->end(); ++i) if ((*i) == src_node) { delete dst_node->providers()->remove(i); break; } - for (List::iterator i = src_node->dependants()->begin(); i != src_node->dependants()->end(); ++i) + for (Raul::List::iterator i = src_node->dependants()->begin(); i != src_node->dependants()->end(); ++i) if ((*i) == dst_node) { delete src_node->dependants()->remove(i); break; @@ -242,11 +242,11 @@ TypedDisconnectionEvent::execute(SampleCount nframes, FrameTime start, FrameT if (_succeeded) { - ListNode*>* const port_connection + Raul::ListNode*>* const port_connection = _dst_port->remove_connection(_src_port); if (port_connection != NULL) { - ListNode* const patch_connection + Raul::ListNode* const patch_connection = _patch->remove_connection(_src_port, _dst_port); assert(patch_connection); diff --git a/src/libs/engine/events/DisconnectionEvent.h b/src/libs/engine/events/DisconnectionEvent.h index e8802017..01a72e85 100644 --- a/src/libs/engine/events/DisconnectionEvent.h +++ b/src/libs/engine/events/DisconnectionEvent.h @@ -19,13 +19,15 @@ #define DISCONNECTIONEVENT_H #include -#include "raul/Path.h" +#include #include "QueuedEvent.h" #include "types.h" using std::string; -template class ListNode; -template class Array; +namespace Raul { + template class ListNode; + template class Array; +} namespace Ingen { @@ -94,7 +96,7 @@ private: InputPort* _dst_port; Patch* _patch; - Array* _process_order; ///< New process order for Patch + Raul::Array* _process_order; ///< New process order for Patch bool _succeeded; }; diff --git a/src/libs/engine/events/EnablePatchEvent.h b/src/libs/engine/events/EnablePatchEvent.h index 9d2a8db6..350c9f3e 100644 --- a/src/libs/engine/events/EnablePatchEvent.h +++ b/src/libs/engine/events/EnablePatchEvent.h @@ -23,7 +23,7 @@ using std::string; -template class Array; +namespace Raul { template class Array; } namespace Ingen { @@ -47,7 +47,7 @@ public: private: string _patch_path; Patch* _patch; - Array* _process_order; // Patch's new process order + Raul::Array* _process_order; // Patch's new process order }; diff --git a/src/libs/engine/events/RenameEvent.h b/src/libs/engine/events/RenameEvent.h index 56232640..9cba840d 100644 --- a/src/libs/engine/events/RenameEvent.h +++ b/src/libs/engine/events/RenameEvent.h @@ -18,9 +18,10 @@ #ifndef RENAMEEVENT_H #define RENAMEEVENT_H -#include "QueuedEvent.h" -#include "raul/Path.h" #include +#include "QueuedEvent.h" +#include + using std::string; template class TreeNode; diff --git a/src/libs/engine/tests/Makefile.am b/src/libs/engine/tests/Makefile.am index 993c9831..c9d1e0c9 100644 --- a/src/libs/engine/tests/Makefile.am +++ b/src/libs/engine/tests/Makefile.am @@ -1,14 +1,10 @@ if BUILD_UNIT_TESTS -AM_CXXFLAGS = @JACK_CFLAGS@ @LOSC_CFLAGS@ @ALSA_CFLAGS@ -I../../common -common_ldadd = @JACK_LIBS@ @LOSC_LIBS@ @ALSA_LIBS@ -lrt +AM_CXXFLAGS = @JACK_CFLAGS@ @RAUL_CFLAGS@ @LOSC_CFLAGS@ @ALSA_CFLAGS@ -I../../common +common_ldadd = @JACK_LIBS@ @RAUL_LIBS@ @LOSC_LIBS@ @ALSA_LIBS@ -lrt node_tree_test_LDADD = $(common_ldadd) -bin_PROGRAMS = node_tree_test list_test - -list_test_SOURCES = \ - ../List.h \ - list_test.cpp +bin_PROGRAMS = node_tree_test node_tree_test_SOURCES = \ node_tree_test.cpp diff --git a/src/libs/engine/tests/list_test.cpp b/src/libs/engine/tests/list_test.cpp deleted file mode 100644 index d2f91c9d..00000000 --- a/src/libs/engine/tests/list_test.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "../List.h" -#include -#include - -using std::cout; using std::endl; - - -int main() -{ - List l; - - l.push_back(new ListNode(1)); - l.push_back(new ListNode(2)); - l.push_back(new ListNode(3)); - l.push_back(new ListNode(4)); - l.push_back(new ListNode(5)); - l.push_back(new ListNode(6)); - l.push_back(new ListNode(7)); - l.push_back(new ListNode(8)); - - cout << "List:" << endl; - for (List::iterator i = l.begin(); i != l.end(); ++i) { - cout << *i << endl; - } - cout << endl; - - - for (List::iterator i = l.begin(); i != l.end(); ++i) { - if ((*i) == 4) - l.remove(i); - } - - std::cerr << "Removed 4 (by iterator)...\n"; - for (List::iterator i = l.begin(); i != l.end(); ++i) { - cout << *i << endl; - } - cout << endl; - - l.remove(1); - - std::cerr << "Removed 1 (head) (by value)...\n"; - for (List::iterator i = l.begin(); i != l.end(); ++i) { - cout << *i << endl; - } - cout << endl; - - for (List::iterator i = l.begin(); i != l.end(); ++i) { - if ((*i) == 2) - l.remove(i); - } - - std::cerr << "Removed 2 (head) (by iterator)...\n"; - for (List::iterator i = l.begin(); i != l.end(); ++i) { - cout << *i << endl; - } - cout << endl; - - l.remove(5); - - std::cerr << "Removed 5 (by value)...\n"; - for (List::iterator i = l.begin(); i != l.end(); ++i) { - cout << *i << endl; - } - cout << endl; - - l.remove(8); - - std::cerr << "Removed 8 (tail) (by value)...\n"; - for (List::iterator i = l.begin(); i != l.end(); ++i) { - cout << *i << endl; - } - cout << endl; - - for (List::iterator i = l.begin(); i != l.end(); ++i) { - if ((*i) == 7) - l.remove(i); - } - - std::cerr << "Removed 7 (tail) (by iterator)...\n"; - for (List::iterator i = l.begin(); i != l.end(); ++i) { - cout << *i << endl; - } - cout << endl; - - List r; - r.push_back(new ListNode(9)); - r.remove(9); - std::cerr << "Should not see ANY numbers:\n"; - for (List::iterator i = r.begin(); i != r.end(); ++i) { - cout << *i << endl; - } - return 0; -} -- cgit v1.2.1