diff options
author | David Robillard <d@drobilla.net> | 2007-02-09 22:39:56 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-02-09 22:39:56 +0000 |
commit | e343345cf54172720f3494ccef87d62b2c688d0a (patch) | |
tree | 67c6b3f95e9393110f78b6fa0cf44cbd12f935a4 /src/libs | |
parent | c50fe49fea7e32b3194b163b77ee5a52480ffa33 (diff) | |
download | ingen-e343345cf54172720f3494ccef87d62b2c688d0a.tar.gz ingen-e343345cf54172720f3494ccef87d62b2c688d0a.tar.bz2 ingen-e343345cf54172720f3494ccef87d62b2c688d0a.zip |
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
Diffstat (limited to 'src/libs')
59 files changed, 252 insertions, 891 deletions
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<MidiMessage>* patch_port) : DriverPort(patch_port->is_input()), - ListNode<AlsaMidiPort*>(this), + Raul::ListNode<AlsaMidiPort*>(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<AlsaMidiPort*>::iterator i = _in_ports.begin(); i != _in_ports.end(); ++i) + for (Raul::List<AlsaMidiPort*>::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<AlsaMidiPort*>::iterator i = _in_ports.begin(); i != _in_ports.end(); ++i) + for (Raul::List<AlsaMidiPort*>::iterator i = _in_ports.begin(); i != _in_ports.end(); ++i) if ((*i)->patch_port()->path() == path) return _in_ports.remove(i)->elem(); - for (List<AlsaMidiPort*>::iterator i = _out_ports.begin(); i != _out_ports.end(); ++i) + for (Raul::List<AlsaMidiPort*>::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<AlsaMidiPort*>::iterator i = ad->_in_ports.begin(); i != ad->_in_ports.end(); ++i) + for (Raul::List<AlsaMidiPort*>::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 <boost/utility.hpp> #include <alsa/asoundlib.h> -#include "List.h" -#include "raul/SRSWQueue.h" +#include <raul/List.h> +#include <raul/SRSWQueue.h> #include "MidiDriver.h" @@ -40,7 +40,7 @@ static const int MAX_MIDI_EVENT_SIZE = 3; * * \ingroup engine */ -class AlsaMidiPort : public DriverPort, public ListNode<AlsaMidiPort*> +class AlsaMidiPort : public DriverPort, public Raul::ListNode<AlsaMidiPort*> { public: AlsaMidiPort(AlsaMidiDriver* driver, DuplexPort<MidiMessage>* port); @@ -96,8 +96,8 @@ public: snd_midi_event_t* event_coder() const { return _event_coder; } private: - List<AlsaMidiPort*> _in_ports; - List<AlsaMidiPort*> _out_ports; + Raul::List<AlsaMidiPort*> _in_ports; + Raul::List<AlsaMidiPort*> _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 <http://drobilla.net> - * - * 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 <cassert> -#include <cstdlib> -#include "types.h" - - -/** An array. - * - * Has a stack-like push_back() too, for find_process_order... - */ -template <class T> -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<T>& 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 <raul/List.h> +#include <raul/Path.h> 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 <cstdlib> #include <boost/utility.hpp> -#include "MaidObject.h" +#include <raul/Deletable.h> #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<Port*>(_descriptor->PortCount + 1); + _ports = new Raul::Array<Port*>(_descriptor->PortCount + 1); _midi_in_port = new InputPort<MidiMessage>(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 <string> #include "types.h" -#include "Array.h" +#include <raul/Array.h> #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 <raul/Deletable.h> #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 <cassert> #include "raul/SharedPtr.h" #include "types.h" -#include "MaidObject.h" +#include <raul/Deletable.h> #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 <map> #include <cstddef> #include <cassert> -#include "MaidObject.h" +#include <raul/Deletable.h> #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<string, Atom> 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<MidiMessage>::InputPort(Node* parent, const string& name, siz */ template<typename T> void -InputPort<T>::add_connection(ListNode<TypedConnection<T>*>* const c) +InputPort<T>::add_connection(Raul::ListNode<TypedConnection<T>*>* const c) { _connections.push_back(c); @@ -78,23 +78,23 @@ InputPort<T>::add_connection(ListNode<TypedConnection<T>*>* const c) //assert( ! _is_tied || _tied_port != NULL); //assert( ! _is_tied || _buffers.at(0)->data() == _tied_port->buffer(0)->data()); } -template void InputPort<Sample>::add_connection(ListNode<TypedConnection<Sample>*>* const c); -template void InputPort<MidiMessage>::add_connection(ListNode<TypedConnection<MidiMessage>*>* const c); +template void InputPort<Sample>::add_connection(Raul::ListNode<TypedConnection<Sample>*>* const c); +template void InputPort<MidiMessage>::add_connection(Raul::ListNode<TypedConnection<MidiMessage>*>* const c); /** Remove a connection. Realtime safe. */ template <typename T> -ListNode<TypedConnection<T>*>* +Raul::ListNode<TypedConnection<T>*>* InputPort<T>::remove_connection(const OutputPort<T>* const src_port) { bool modify_buffers = !_fixed_buffers; //if (modify_buffers && _is_tied) // modify_buffers = !_tied_port->fixed_buffers(); - typedef typename List<TypedConnection<T>*>::iterator TypedConnectionListIterator; + typedef typename Raul::List<TypedConnection<T>*>::iterator TypedConnectionListIterator; bool found = false; - ListNode<TypedConnection<T>*>* connection = NULL; + Raul::ListNode<TypedConnection<T>*>* 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<T>::remove_connection(const OutputPort<T>* const src_port) return connection; } -template ListNode<TypedConnection<Sample>*>* +template Raul::ListNode<TypedConnection<Sample>*>* InputPort<Sample>::remove_connection(const OutputPort<Sample>* const src_port); -template ListNode<TypedConnection<MidiMessage>*>* +template Raul::ListNode<TypedConnection<MidiMessage>*>* InputPort<MidiMessage>::remove_connection(const OutputPort<MidiMessage>* const src_port); @@ -145,7 +145,7 @@ template <typename T> bool InputPort<T>::is_connected_to(const OutputPort<T>* const port) const { - typedef typename List<TypedConnection<T>*>::const_iterator TypedConnectionListIterator; + typedef typename Raul::List<TypedConnection<T>*>::const_iterator TypedConnectionListIterator; for (TypedConnectionListIterator i = _connections.begin(); i != _connections.end(); ++i) if ((*i)->src_port() == port) return true; @@ -165,7 +165,7 @@ InputPort<Sample>::process(SampleCount nframes, FrameTime start, FrameTime end) { //assert(!_is_tied || _tied_port != NULL); - typedef List<TypedConnection<Sample>*>::iterator TypedConnectionListIterator; + typedef Raul::List<TypedConnection<Sample>*>::iterator TypedConnectionListIterator; bool do_mixdown = true; if (_connections.size() == 0) return; @@ -233,7 +233,7 @@ InputPort<MidiMessage>::process(SampleCount nframes, FrameTime start, FrameTime assert(num_ins == 0 || num_ins == 1); - typedef List<TypedConnection<MidiMessage>*>::iterator TypedConnectionListIterator; + typedef Raul::List<TypedConnection<MidiMessage>*>::iterator TypedConnectionListIterator; assert(_poly == 1); for (TypedConnectionListIterator c = _connections.begin(); c != _connections.end(); ++c) @@ -307,7 +307,7 @@ InputPort<T>::set_buffer_size(size_t size) TypedPort<T>::set_buffer_size(size); assert(_buffer_size = size); - for (typename List<TypedConnection<T>*>::iterator c = _connections.begin(); c != _connections.end(); ++c) + for (typename Raul::List<TypedConnection<T>*>::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 <string> #include <cstdlib> #include <cassert> +#include <raul/List.h> #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<TypedConnection<T>*>* const c); - ListNode<TypedConnection<T>*>* remove_connection(const OutputPort<T>* const src_port); + void add_connection(Raul::ListNode<TypedConnection<T>*>* const c); + Raul::ListNode<TypedConnection<T>*>* remove_connection(const OutputPort<T>* const src_port); - const List<TypedConnection<T>*>& connections() { return _connections; } + const Raul::List<TypedConnection<T>*>& connections() { return _connections; } void process(SampleCount nframes, FrameTime start, FrameTime end); @@ -68,7 +68,7 @@ public: private: - List<TypedConnection<T>*> _connections; + Raul::List<TypedConnection<T>*> _connections; // This is just stupid... using TypedPort<T>::_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 <iostream> #include <cstdlib> +#include <raul/List.h> #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<Sample>* patch_port) : DriverPort(patch_port->is_input()), - ListNode<JackAudioPort*>(this), + Raul::ListNode<JackAudioPort*>(this), _driver(driver), _jack_port(NULL), _jack_buffer(NULL), @@ -194,7 +194,7 @@ JackAudioDriver::deactivate() jack_deactivate(_client); _is_activated = false; - for (List<JackAudioPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i) + for (Raul::List<JackAudioPort*>::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<JackAudioPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i) + for (Raul::List<JackAudioPort*>::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<JackAudioPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i) + for (Raul::List<JackAudioPort*>::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<JackAudioPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i) { + for (Raul::List<JackAudioPort*>::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 <jack/jack.h> #include <jack/transport.h> -#include "raul/Thread.h" -#include "raul/Path.h" -#include "List.h" +#include <raul/Thread.h> +#include <raul/Path.h> +#include <raul/List.h> #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<JackAudioPort*> +class JackAudioPort : public DriverPort, public Raul::ListNode<JackAudioPort*> { public: JackAudioPort(JackAudioDriver* driver, DuplexPort<Sample>* patch_port); @@ -135,7 +135,7 @@ private: jack_position_t _position; jack_transport_state_t _transport_state; - List<JackAudioPort*> _ports; + Raul::List<JackAudioPort*> _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<MidiMessage>* patch_port) : DriverPort(patch_port->is_input()), - ListNode<JackMidiPort*>(this), + Raul::ListNode<JackMidiPort*>(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<JackMidiPort*>::iterator i = _in_ports.begin(); i != _in_ports.end(); ++i) + for (Raul::List<JackMidiPort*>::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<JackMidiPort*>::iterator i = _in_ports.begin(); i != _in_ports.end(); ++i) + for (Raul::List<JackMidiPort*>::iterator i = _in_ports.begin(); i != _in_ports.end(); ++i) if ((*i)->patch_port()->path() == path) return _in_ports.remove(i)->elem(); - for (List<JackMidiPort*>::iterator i = _out_ports.begin(); i != _out_ports.end(); ++i) + for (Raul::List<JackMidiPort*>::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 <jack/jack.h> #include <jack/midiport.h> +#include <raul/List.h> #include "config.h" -#include "List.h" #include "MidiDriver.h" namespace Ingen { @@ -36,7 +36,7 @@ template <typename T> class DuplexPort; * * \ingroup engine */ -class JackMidiPort : public DriverPort, public ListNode<JackMidiPort*> +class JackMidiPort : public DriverPort, public Raul::ListNode<JackMidiPort*> { public: JackMidiPort(JackMidiDriver* driver, DuplexPort<MidiMessage>* port); @@ -87,13 +87,13 @@ public: jack_client_t* jack_client() { return _client; } private: - List<JackMidiPort*> _in_ports; - List<JackMidiPort*> _out_ports; + Raul::List<JackMidiPort*> _in_ports; + Raul::List<JackMidiPort*> _out_ports; friend class JackMidiPort; - void add_output(ListNode<JackMidiPort*>* port); - ListNode<JackMidiPort*>* remove_output(JackMidiPort* port); + void add_output(Raul::ListNode<JackMidiPort*>* port); + Raul::ListNode<JackMidiPort*>* 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<Port*>(_descriptor->PortCount); + _ports = new Raul::Array<Port*>(_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<Port*>(num_ports); + _ports = new Raul::Array<Port*>(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 <http://drobilla.net> - * - * 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 <cassert> -#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 <typename T> -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 <typename T> -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<T>* elem); - ListNode<T>* 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<T>* 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<T>; - - private: - const List<T>* const _list; - const ListNode<T>* _listnode; - const ListNode<T>* _next; // use this instead of _listnode->next() to allow deleting - }; - - - /** Realtime safe iterator for a List. */ - class iterator - { - public: - iterator(List<T>* 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<T>; - friend class List<T>::const_iterator; - - private: - const List<T>* _list; - ListNode<T>* _listnode; - ListNode<T>* _next; // use this instead of _listnode->next() to allow deleting - }; - - - ListNode<T>* remove(const iterator iter); - - iterator begin(); - const iterator end() const; - - const_iterator begin() const; - //const_iterator end() const; - -private: - ListNode<T>* _head; - ListNode<T>* _tail; - size_t _size; - iterator _end_iter; - const_iterator _const_end_iter; -}; - - - - -template <typename T> -List<T>::~List<T>() -{ - clear(); -} - - -/** Clear the list, deleting all ListNodes contained (but NOT their contents!) - * - * Not realtime safe. - */ -template <typename T> -void -List<T>::clear() -{ - if (_head == NULL) return; - - ListNode<T>* node = _head; - ListNode<T>* 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 <typename T> -void -List<T>::push_back(ListNode<T>* 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 <typename T> -ListNode<T>* -List<T>::remove(const T elem) -{ - // FIXME: atomicity? - ListNode<T>* 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 <typename T> -ListNode<T>* -List<T>::remove(const iterator iter) -{ - ListNode<T>* 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 <typename T> -List<T>::iterator::iterator(List<T>* list) -: _list(list), - _listnode(NULL), - _next(NULL) -{ -} - - -template <typename T> -T& -List<T>::iterator::operator*() -{ - assert(_listnode != NULL); - return _listnode->elem(); -} - - -template <typename T> -inline typename List<T>::iterator& -List<T>::iterator::operator++() -{ - assert(_listnode != NULL); - _listnode = _next; - if (_next != NULL) - _next = _next->next(); - else - _next = NULL; - - return *this; -} - - -template <typename T> -inline bool -List<T>::iterator::operator!=(const iterator& iter) const -{ - return (_listnode != iter._listnode); -} - - -template <typename T> -inline bool -List<T>::iterator::operator!=(const const_iterator& iter) const -{ - return (_listnode != iter._listnode); -} - - -template <typename T> -inline typename List<T>::iterator -List<T>::begin() -{ - typename List<T>::iterator iter(this); - iter._listnode = _head; - if (_head != NULL) - iter._next = _head->next(); - else - iter._next = NULL; - return iter; -} - - -template <typename T> -inline const typename List<T>::iterator -List<T>::end() const -{ - /*typename List<T>::iterator iter(this); - iter._listnode = NULL; - iter._next = NULL; - return iter;*/ - return _end_iter; -} - - - -/// const_iterator stuff /// - - -template <typename T> -List<T>::const_iterator::const_iterator(const List<T>* const list) -: _list(list), - _listnode(NULL), - _next(NULL) -{ -} - - -template <typename T> -const T& -List<T>::const_iterator::operator*() -{ - assert(_listnode != NULL); - return _listnode->elem(); -} - - -template <typename T> -inline typename List<T>::const_iterator& -List<T>::const_iterator::operator++() -{ - assert(_listnode != NULL); - _listnode = _next; - if (_next != NULL) - _next = _next->next(); - else - _next = NULL; - - return *this; -} - - -template <typename T> -inline bool -List<T>::const_iterator::operator!=(const const_iterator& iter) const -{ - return (_listnode != iter._listnode); -} - - -template <typename T> -inline bool -List<T>::const_iterator::operator!=(const iterator& iter) const -{ - return (_listnode != iter._listnode); -} - - -template <typename T> -inline typename List<T>::const_iterator -List<T>::begin() const -{ - typename List<T>::const_iterator iter(this); - iter._listnode = _head; - if (_head != NULL) - iter._next = _head->next(); - else - iter._next = NULL; - return iter; -} - -#if 0 -template <typename T> -inline typename List<T>::const_iterator -List<T>::end() const -{ - /*typename List<T>::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 <raul/Deletable.h> 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 <boost/utility.hpp> #include "raul/SRSWQueue.h" -#include "MaidObject.h" +#include <raul/Deletable.h> /** 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<MaidObject*> _objects; + Raul::SRSWQueue<Raul::Deletable*> _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 <http://drobilla.net> - * - * 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 <boost/utility.hpp> - - -/** 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<Port*>(7); + _ports = new Raul::Array<Port*>(7); _midi_in_port = new InputPort<MidiMessage>(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 <iostream> 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 <cmath> #include <iostream> +#include <raul/Array.h> #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<Port*>(5); + _ports = new Raul::Array<Port*>(5); _midi_in_port = new InputPort<MidiMessage>(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<Port*>(5); + _ports = new Raul::Array<Port*>(5); _midi_in_port = new InputPort<MidiMessage>(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 <string> +#include <raul/Array.h> #include "types.h" #include "GraphObject.h" -#include "Array.h" + using std::string; -template <typename T> class List; +namespace Raul { template <typename T> 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<Port*>& ports() const = 0; + virtual const Raul::Array<Port*>& 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<Node*>* providers() = 0; - virtual void providers(List<Node*>* l) = 0; + virtual Raul::List<Node*>* providers() = 0; + virtual void providers(Raul::List<Node*>* l) = 0; /** Nodes are are connected to this Node's outputs. * (They depend on this Node) */ - virtual List<Node*>* dependants() = 0; - virtual void dependants(List<Node*>* l) = 0; + virtual Raul::List<Node*>* dependants() = 0; + virtual void dependants(Raul::List<Node*>* 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 <cassert> #include <iostream> #include <stdint.h> +#include <raul/List.h> +#include <raul/Array.h> #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<Node*>()), - _dependants(new List<Node*>()) + _providers(new Raul::List<Node*>()), + _dependants(new Raul::List<Node*>()) { 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<Port*>& ports() const { return *_ports; } + const Raul::Array<Port*>& ports() const { return *_ports; } - virtual List<Node*>* providers() { return _providers; } - virtual void providers(List<Node*>* l) { _providers = l; } + virtual Raul::List<Node*>* providers() { return _providers; } + virtual void providers(Raul::List<Node*>* l) { _providers = l; } - virtual List<Node*>* dependants() { return _dependants; } - virtual void dependants(List<Node*>* l) { _dependants = l; } + virtual Raul::List<Node*>* dependants() { return _dependants; } + virtual void dependants(Raul::List<Node*>* l) { _dependants = l; } virtual const Plugin* plugin() const { return _plugin; } @@ -95,11 +95,11 @@ protected: size_t _buffer_size; bool _activated; - Array<Port*>* _ports; ///< Access in audio thread only + Raul::Array<Port*>* _ports; ///< Access in audio thread only bool _traversed; ///< Flag for process order algorithm - List<Node*>* _providers; ///< Nodes connected to this one's input ports - List<Node*>* _dependants; ///< Nodes this one's output ports are connected to + Raul::List<Node*>* _providers; ///< Nodes connected to this one's input ports + Raul::List<Node*>* _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<Port*>& ports = node->ports(); + const Raul::Array<Port*>& 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<Node*>::const_iterator j = patch->nodes().begin(); + for (Raul::List<Node*>::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<Connection*>::const_iterator j = patch->connections().begin(); + for (Raul::List<Connection*>::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<Port*>& ports = node->ports(); + const Raul::Array<Port*>& 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 <raul/List.h> +#include <raul/Path.h> #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<GraphObject*>* 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<Connection*>::iterator i = _connections.begin(); i != _connections.end(); ++i) { + for (Raul::List<Connection*>::iterator i = _connections.begin(); i != _connections.end(); ++i) { delete (*i); delete _connections.remove(i); } - for (List<Node*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i) { + for (Raul::List<Node*>::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<Node*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i) + for (Raul::List<Node*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i) (*i)->activate(); assert(_activated); @@ -85,7 +85,7 @@ Patch::deactivate() NodeBase::deactivate(); - for (List<Node*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i) { + for (Raul::List<Node*>::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<InternalNode*>::iterator i = _bridge_nodes.begin(); i != _bridge_nodes.end(); ++i) { + /*for (Raul::List<InternalNode*>::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<Port*>::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) + for (Raul::List<Port*>::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<Port*>::iterator i = _input_ports.begin(); i != _input_ports.end(); ++i) + for (Raul::List<Port*>::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<Port*>::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) + for (Raul::List<Port*>::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<Node*>::iterator j = _nodes.begin(); j != _nodes.end(); ++j) + for (Raul::List<Node*>::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<Node*>::iterator j = _nodes.begin(); j != _nodes.end(); ++j) + for (Raul::List<Node*>::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<Node*>::iterator j = _nodes.begin(); j != _nodes.end(); ++j) + for (Raul::List<Node*>::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<Node*>* ln) +Patch::add_node(Raul::ListNode<Node*>* ln) { assert(ln != NULL); assert(ln->elem() != NULL); @@ -193,10 +193,10 @@ Patch::add_node(ListNode<Node*>* ln) /** Remove a node. * Realtime Safe. Preprocessing thread. */ -ListNode<Node*>* +Raul::ListNode<Node*>* Patch::remove_node(const string& name) { - for (List<Node*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i) + for (Raul::List<Node*>::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<Connection*>* +Raul::ListNode<Connection*>* Patch::remove_connection(const Port* src_port, const Port* dst_port) { bool found = false; - ListNode<Connection*>* connection = NULL; - for (List<Connection*>::iterator i = _connections.begin(); i != _connections.end(); ++i) { + Raul::ListNode<Connection*>* connection = NULL; + for (Raul::List<Connection*>::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<InternalNode*>* +Raul::ListNode<InternalNode*>* Patch::remove_bridge_node(const InternalNode* node) { bool found = false; - ListNode<InternalNode*>* bridge_node = NULL; - for (List<InternalNode*>::iterator i = _bridge_nodes.begin(); i != _bridge_nodes.end(); ++i) { + Raul::ListNode<InternalNode*>* bridge_node = NULL; + for (Raul::List<InternalNode*>::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<Port*>* +Raul::ListNode<Port*>* Patch::remove_port(const string& name) { assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); bool found = false; - ListNode<Port*>* ret = NULL; - for (List<Port*>::iterator i = _input_ports.begin(); i != _input_ports.end(); ++i) { + Raul::ListNode<Port*>* ret = NULL; + for (Raul::List<Port*>::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<Port*>::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) { + for (Raul::List<Port*>::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<Port*>* +Raul::Array<Port*>* Patch::build_ports_array() const { assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); - Array<Port*>* const result = new Array<Port*>(_input_ports.size() + _output_ports.size()); + Raul::Array<Port*>* const result = new Raul::Array<Port*>(_input_ports.size() + _output_ports.size()); size_t i = 0; - for (List<Port*>::const_iterator p = _input_ports.begin(); p != _input_ports.end(); ++p,++i) + for (Raul::List<Port*>::const_iterator p = _input_ports.begin(); p != _input_ports.end(); ++p,++i) result->at(i) = *p; - for (List<Port*>::const_iterator p = _output_ports.begin(); p != _output_ports.end(); ++p,++i) + for (Raul::List<Port*>::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<Node*>* +Raul::Array<Node*>* Patch::build_process_order() const { assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); cerr << "*********** Building process order for " << path() << endl; - Array<Node*>* const process_order = new Array<Node*>(_nodes.size(), NULL); + Raul::Array<Node*>* const process_order = new Raul::Array<Node*>(_nodes.size(), NULL); // FIXME: tweak algorithm so it just ends up like this and save the cost of iteration? - for (List<Node*>::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) + for (Raul::List<Node*>::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) (*i)->traversed(false); // Traverse backwards starting at outputs - //for (List<Port*>::const_iterator p = _output_ports.begin(); p != _output_ports.end(); ++p) { + //for (Raul::List<Port*>::const_iterator p = _output_ports.begin(); p != _output_ports.end(); ++p) { /*const Port* const port = (*p); - for (List<Connection*>::const_iterator c = port->connections().begin(); + for (Raul::List<Connection*>::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<Node*>::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) { + for (Raul::List<Node*>::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<Node*>::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) { + /*for (Raul::List<Node*>::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<Node*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i) + for (Raul::List<Node*>::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 <cstdlib> #include <string> +#include <raul/List.h> #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<Node*>* tn); - ListNode<Node*>* remove_node(const string& name); + void add_node(Raul::ListNode<Node*>* tn); + Raul::ListNode<Node*>* remove_node(const string& name); - List<Node*>& nodes() { return _nodes; } - List<Connection*>& connections() { return _connections; } + Raul::List<Node*>& nodes() { return _nodes; } + Raul::List<Connection*>& connections() { return _connections; } - const List<Node*>& nodes() const { return _nodes; } - const List<Connection*>& connections() const { return _connections; } + const Raul::List<Node*>& nodes() const { return _nodes; } + const Raul::List<Connection*>& 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*>* port) { _input_ports.push_back(port); } ///< Preprocesser thread - void add_output(ListNode<Port*>* port) { _output_ports.push_back(port); } ///< Preprocessor thread - ListNode<Port*>* remove_port(const string& name); + void add_input(Raul::ListNode<Port*>* port) { _input_ports.push_back(port); } ///< Preprocesser thread + void add_output(Raul::ListNode<Port*>* port) { _output_ports.push_back(port); } ///< Preprocessor thread + Raul::ListNode<Port*>* remove_port(const string& name); - void add_connection(ListNode<Connection*>* c) { _connections.push_back(c); } - ListNode<Connection*>* remove_connection(const Port* src_port, const Port* dst_port); + void add_connection(Raul::ListNode<Connection*>* c) { _connections.push_back(c); } + Raul::ListNode<Connection*>* remove_connection(const Port* src_port, const Port* dst_port); - Array<Node*>* process_order() { return _process_order; } - void process_order(Array<Node*>* po) { _process_order = po; } + Raul::Array<Node*>* process_order() { return _process_order; } + void process_order(Raul::Array<Node*>* po) { _process_order = po; } - Array<Port*>* external_ports() { return _ports; } - void external_ports(Array<Port*>* pa) { _ports = pa; } + Raul::Array<Port*>* external_ports() { return _ports; } + void external_ports(Raul::Array<Port*>* pa) { _ports = pa; } - Array<Node*>* build_process_order() const; - Array<Port*>* build_ports_array() const; + Raul::Array<Node*>* build_process_order() const; + Raul::Array<Port*>* 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<Node*>* order) const; + inline void build_process_order_recursive(Node* n, Raul::Array<Node*>* order) const; size_t _internal_poly; - Array<Node*>* _process_order; ///< Accessed in audio thread only - List<Connection*> _connections; ///< Accessed in audio thread only - List<Port*> _input_ports; ///< Accessed in preprocessing thread only - List<Port*> _output_ports; ///< Accessed in preprocessing thread only - List<Node*> _nodes; ///< Accessed in preprocessing thread only + Raul::Array<Node*>* _process_order; ///< Accessed in audio thread only + Raul::List<Connection*> _connections; ///< Accessed in audio thread only + Raul::List<Port*> _input_ports; ///< Accessed in preprocessing thread only + Raul::List<Port*> _output_ports; ///< Accessed in preprocessing thread only + Raul::List<Node*> _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<Node*>* order) const +Patch::build_process_order_recursive(Node* n, Raul::Array<Node*>* order) const { if (n == NULL || n->traversed()) return; n->traversed(true); assert(order != NULL); - for (List<Node*>::iterator i = n->providers()->begin(); i != n->providers()->end(); ++i) + for (Raul::List<Node*>::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 <string> #include <cassert> #include <boost/utility.hpp> -#include "MaidObject.h" +#include <raul/Deletable.h> using std::string; template<typename T> class Tree; @@ -30,7 +30,7 @@ template<typename T> class Tree; /** A node in a Tree. */ template <typename T> -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 <string> #include "types.h" -#include "Array.h" +#include <raul/Array.h> #include "Port.h" #include "Buffer.h" @@ -67,7 +67,7 @@ protected: bool _fixed_buffers; - Array<Buffer<T>*> _buffers; + Raul::Array<Buffer<T>*> _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*>(_node)); + _patch->add_node(new Raul::ListNode<Node*>(_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 <string> using std::string; -template <typename T> class Array; +namespace Raul { template <typename T> class Array; } template<typename T> class TreeNode; namespace Ingen { @@ -71,7 +71,7 @@ private: bool _poly; Patch* _patch; Node* _node; - Array<Node*>* _process_order; ///< Patch's new process order + Raul::Array<Node*>* _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 <raul/List.h> #include "Driver.h" #include "DuplexPort.h" -#include "Array.h" +#include <raul/Array.h> namespace Ingen { @@ -97,14 +97,14 @@ AddPortEvent::pre_process() if (_patch_port) { if (_is_output) - _patch->add_output(new ListNode<Port*>(_patch_port)); + _patch->add_output(new Raul::ListNode<Port*>(_patch_port)); else - _patch->add_input(new ListNode<Port*>(_patch_port)); + _patch->add_input(new Raul::ListNode<Port*>(_patch_port)); if (_patch->external_ports()) - _ports_array = new Array<Port*>(old_num_ports + 1, *_patch->external_ports()); + _ports_array = new Raul::Array<Port*>(old_num_ports + 1, *_patch->external_ports()); else - _ports_array = new Array<Port*>(old_num_ports + 1, NULL); + _ports_array = new Raul::Array<Port*>(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 <raul/Path.h> +#include <raul/Array.h> #include "DataType.h" -#include "Array.h" #include <string> using std::string; @@ -55,7 +55,7 @@ private: DataType _data_type; Patch* _patch; Port* _patch_port; - Array<Port*>* _ports_array; ///< New (external) ports array for Patch + Raul::Array<Port*>* _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<MidiInNode*>::iterator j = _patch->midi_in_nodes().begin(); j != _patch->midi_in_nodes().end(); ++j) + // for (Raul::List<MidiInNode*>::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<Node*>::const_iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i) + for (Raul::List<Node*>::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<Node*>::const_iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i) + //for (Raul::List<Node*>::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<Node*>::iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i) { + for (Raul::List<Node*>::iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i) { (*i)->deactivate(); delete *i; } _patch->nodes().clear(); // Delete all connections - for (List<Connection*>::iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) + for (Raul::List<Connection*>::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 <string> +#include <raul/Array.h> #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<T>::pre_process() } _connection = new TypedConnection<T>(_src_port, _dst_port); - _port_listnode = new ListNode<TypedConnection<T>*>(_connection); - _patch_listnode = new ListNode<Connection*>(_connection); + _port_listnode = new Raul::ListNode<TypedConnection<T>*>(_connection); + _patch_listnode = new Raul::ListNode<Connection*>(_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<Node*>(src_node)); - src_node->dependants()->push_back(new ListNode<Node*>(dst_node)); + dst_node->providers()->push_back(new Raul::ListNode<Node*>(src_node)); + src_node->dependants()->push_back(new Raul::ListNode<Node*>(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 <typename T> class ListNode; -template <typename T> class Array; +namespace Raul { + template <typename T> class ListNode; + template <typename T> class Array; +} namespace Ingen { @@ -92,10 +94,10 @@ private: InputPort<T>* _dst_port; Patch* _patch; - Array<Node*>* _process_order; ///< New process order for Patch + Raul::Array<Node*>* _process_order; ///< New process order for Patch TypedConnection<T>* _connection; - ListNode<Connection*>* _patch_listnode; - ListNode<TypedConnection<T>*>* _port_listnode; + Raul::ListNode<Connection*>* _patch_listnode; + Raul::ListNode<TypedConnection<T>*>* _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<Node*>(_patch)); + _parent->add_node(new Raul::ListNode<Node*>(_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 <string> +#include <raul/Path.h> +#include "QueuedEvent.h" + using std::string; -template<typename T> class Array; +namespace Raul { template<typename T> class Array; } template<typename T> class TreeNode; namespace Ingen { @@ -52,7 +53,7 @@ private: Path _path; Patch* _patch; Patch* _parent; - Array<Node*>* _process_order; + Raul::Array<Node*>* _process_order; TreeNode<Node*>* _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 <string> +#include <raul/Path.h> +#include "QueuedEvent.h" + using std::string; -template<typename T> class Array; -template<typename T> class ListNode; +namespace Raul { + template<typename T> class Array; + template<typename T> class ListNode; +} template<typename T> 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<Node*>* _patch_node_listnode; - ListNode<Port*>* _patch_port_listnode; + Raul::ListNode<Node*>* _patch_node_listnode; + Raul::ListNode<Port*>* _patch_port_listnode; TreeNode<GraphObject*>* _store_treenode; - Array<Port*>* _ports_array; ///< New (external) ports array for Patch - Array<Node*>* _process_order; ///< Patch's new process order + Raul::Array<Port*>* _ports_array; ///< New (external) ports array for Patch + Raul::Array<Node*>* _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 <iostream> +#include <raul/List.h> +#include <raul/Array.h> #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<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) + for (Raul::List<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) delete (*i); } @@ -73,7 +73,7 @@ DisconnectNodeEvent::~DisconnectNodeEvent() void DisconnectNodeEvent::pre_process() { - typedef List<Connection*>::const_iterator ConnectionListIterator; + typedef Raul::List<Connection*>::const_iterator ConnectionListIterator; // cerr << "Preparing disconnection event...\n"; @@ -102,7 +102,7 @@ DisconnectNodeEvent::pre_process() DisconnectionEvent* ev = new DisconnectionEvent(_engine, SharedPtr<Responder>(new Responder()), _time, c->src_port(), c->dst_port()); ev->pre_process(); - _disconnection_events.push_back(new ListNode<DisconnectionEvent*>(ev)); + _disconnection_events.push_back(new Raul::ListNode<DisconnectionEvent*>(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<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) + for (Raul::List<DisconnectionEvent*>::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<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) + for (Raul::List<DisconnectionEvent*>::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 <string> -#include "raul/Path.h" +#include <raul/List.h> +#include <raul/Path.h> #include "QueuedEvent.h" -#include "List.h" + using std::string; namespace Ingen { @@ -55,7 +56,7 @@ private: Path _node_path; Patch* _patch; Node* _node; - List<DisconnectionEvent*> _disconnection_events; + Raul::List<DisconnectionEvent*> _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 <raul/List.h> #include "Node.h" #include "Connection.h" #include "DisconnectionEvent.h" #include "Port.h" -#include "Array.h" +#include <raul/Array.h> #include "InputPort.h" #include "OutputPort.h" #include "Patch.h" @@ -66,7 +66,7 @@ DisconnectPortEvent::DisconnectPortEvent(Engine& engine, Port* port) DisconnectPortEvent::~DisconnectPortEvent() { - for (List<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) + for (Raul::List<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) delete (*i); } @@ -101,13 +101,13 @@ DisconnectPortEvent::pre_process() } Connection* c = NULL; - for (List<Connection*>::const_iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) { + for (Raul::List<Connection*>::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<Responder>(new Responder()), _time, c->src_port(), c->dst_port()); ev->pre_process(); - _disconnection_events.push_back(new ListNode<DisconnectionEvent*>(ev)); + _disconnection_events.push_back(new Raul::ListNode<DisconnectionEvent*>(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<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) + for (Raul::List<DisconnectionEvent*>::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<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i) + for (Raul::List<DisconnectionEvent*>::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 <string> #include "raul/Path.h" #include "QueuedEvent.h" -#include "List.h" +#include <raul/List.h> -template <typename T> class Array; +namespace Raul { template <typename T> class Array; } namespace Ingen { @@ -56,9 +56,9 @@ private: Path _port_path; Patch* _patch; Port* _port; - List<DisconnectionEvent*> _disconnection_events; + Raul::List<DisconnectionEvent*> _disconnection_events; - Array<Node*>* _process_order; // Patch's new process order + Raul::Array<Node*>* _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<T>::pre_process() return; } - for (List<Node*>::iterator i = dst_node->providers()->begin(); i != dst_node->providers()->end(); ++i) + for (Raul::List<Node*>::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<Node*>::iterator i = src_node->dependants()->begin(); i != src_node->dependants()->end(); ++i) + for (Raul::List<Node*>::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<T>::execute(SampleCount nframes, FrameTime start, FrameT if (_succeeded) { - ListNode<TypedConnection<T>*>* const port_connection + Raul::ListNode<TypedConnection<T>*>* const port_connection = _dst_port->remove_connection(_src_port); if (port_connection != NULL) { - ListNode<Connection*>* const patch_connection + Raul::ListNode<Connection*>* 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 <string> -#include "raul/Path.h" +#include <raul/Path.h> #include "QueuedEvent.h" #include "types.h" using std::string; -template <typename T> class ListNode; -template <typename T> class Array; +namespace Raul { + template <typename T> class ListNode; + template <typename T> class Array; +} namespace Ingen { @@ -94,7 +96,7 @@ private: InputPort<T>* _dst_port; Patch* _patch; - Array<Node*>* _process_order; ///< New process order for Patch + Raul::Array<Node*>* _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 <typename T> class Array; +namespace Raul { template <typename T> class Array; } namespace Ingen { @@ -47,7 +47,7 @@ public: private: string _patch_path; Patch* _patch; - Array<Node*>* _process_order; // Patch's new process order + Raul::Array<Node*>* _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 <string> +#include "QueuedEvent.h" +#include <raul/Path.h> + using std::string; template<typename T> 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 <iostream> -#include <cstddef> - -using std::cout; using std::endl; - - -int main() -{ - List<int> l; - - l.push_back(new ListNode<int>(1)); - l.push_back(new ListNode<int>(2)); - l.push_back(new ListNode<int>(3)); - l.push_back(new ListNode<int>(4)); - l.push_back(new ListNode<int>(5)); - l.push_back(new ListNode<int>(6)); - l.push_back(new ListNode<int>(7)); - l.push_back(new ListNode<int>(8)); - - cout << "List:" << endl; - for (List<int>::iterator i = l.begin(); i != l.end(); ++i) { - cout << *i << endl; - } - cout << endl; - - - for (List<int>::iterator i = l.begin(); i != l.end(); ++i) { - if ((*i) == 4) - l.remove(i); - } - - std::cerr << "Removed 4 (by iterator)...\n"; - for (List<int>::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<int>::iterator i = l.begin(); i != l.end(); ++i) { - cout << *i << endl; - } - cout << endl; - - for (List<int>::iterator i = l.begin(); i != l.end(); ++i) { - if ((*i) == 2) - l.remove(i); - } - - std::cerr << "Removed 2 (head) (by iterator)...\n"; - for (List<int>::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<int>::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<int>::iterator i = l.begin(); i != l.end(); ++i) { - cout << *i << endl; - } - cout << endl; - - for (List<int>::iterator i = l.begin(); i != l.end(); ++i) { - if ((*i) == 7) - l.remove(i); - } - - std::cerr << "Removed 7 (tail) (by iterator)...\n"; - for (List<int>::iterator i = l.begin(); i != l.end(); ++i) { - cout << *i << endl; - } - cout << endl; - - List<int> r; - r.push_back(new ListNode<int>(9)); - r.remove(9); - std::cerr << "Should not see ANY numbers:\n"; - for (List<int>::iterator i = r.begin(); i != r.end(); ++i) { - cout << *i << endl; - } - return 0; -} |