diff options
author | David Robillard <d@drobilla.net> | 2006-10-16 07:28:30 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-10-16 07:28:30 +0000 |
commit | d38458e73cf7dfe02d2ea0ceb050f64df43413b8 (patch) | |
tree | 298face3d076487f61a388a85001cc01a26a7d43 /src/libs/engine | |
parent | d5049d43809c7546afcc2938791a90c7973d0fc2 (diff) | |
download | ingen-d38458e73cf7dfe02d2ea0ceb050f64df43413b8.tar.gz ingen-d38458e73cf7dfe02d2ea0ceb050f64df43413b8.tar.bz2 ingen-d38458e73cf7dfe02d2ea0ceb050f64df43413b8.zip |
Used boost::noncopyable to eliminate undefined private copy constructors spread everywhere.
git-svn-id: http://svn.drobilla.net/lad/ingen@182 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine')
33 files changed, 27 insertions, 167 deletions
diff --git a/src/libs/engine/AlsaMidiDriver.h b/src/libs/engine/AlsaMidiDriver.h index baf29da6..4d1eae4a 100644 --- a/src/libs/engine/AlsaMidiDriver.h +++ b/src/libs/engine/AlsaMidiDriver.h @@ -17,11 +17,13 @@ #ifndef ALSAMIDIDRIVER_H #define ALSAMIDIDRIVER_H +#include <boost/utility.hpp> #include <alsa/asoundlib.h> #include "List.h" #include "raul/Queue.h" #include "MidiDriver.h" + namespace Ingen { class Node; @@ -37,7 +39,7 @@ static const int MAX_MIDI_EVENT_SIZE = 3; * * \ingroup engine */ -class AlsaMidiPort : public DriverPort, public ListNode<AlsaMidiPort*> +class AlsaMidiPort : boost::noncopyable, DriverPort, ListNode<AlsaMidiPort*> { public: AlsaMidiPort(AlsaMidiDriver* driver, DuplexPort<MidiMessage>* port); @@ -55,10 +57,6 @@ public: DuplexPort<MidiMessage>* patch_port() const { return _patch_port; } private: - // Prevent copies (undefined) - AlsaMidiPort(const AlsaMidiPort&); - AlsaMidiPort& operator=(const AlsaMidiPort&); - AlsaMidiDriver* _driver; DuplexPort<MidiMessage>* _patch_port; int _port_id; @@ -74,7 +72,7 @@ private: * * \ingroup engine */ -class AlsaMidiDriver : public MidiDriver +class AlsaMidiDriver : boost::noncopyable, MidiDriver { public: AlsaMidiDriver(AudioDriver* audio_driver); @@ -96,11 +94,6 @@ public: snd_midi_event_t* event_coder() const { return _event_coder; } private: - - // Prevent copies (undefined) - AlsaMidiDriver(const AlsaMidiDriver&); - AlsaMidiDriver& operator=(const AlsaMidiDriver&); - List<AlsaMidiPort*> _in_ports; List<AlsaMidiPort*> _out_ports; diff --git a/src/libs/engine/Array.h b/src/libs/engine/Array.h index 561f3ab5..bef6ef5b 100644 --- a/src/libs/engine/Array.h +++ b/src/libs/engine/Array.h @@ -96,10 +96,6 @@ public: inline T& at(size_t i) const { assert(i < m_size); return m_elems[i]; } private: - // Disallow copies (undefined) - Array(const Array& copy); - Array& operator=(const Array& copy); - size_t m_size; size_t m_top; // points to empty element above "top" element T* m_elems; diff --git a/src/libs/engine/Connection.h b/src/libs/engine/Connection.h index e2422a33..68ab5a3d 100644 --- a/src/libs/engine/Connection.h +++ b/src/libs/engine/Connection.h @@ -18,6 +18,7 @@ #define CONNECTION_H #include <cstdlib> +#include <boost/utility.hpp> #include "MaidObject.h" #include "types.h" @@ -49,9 +50,6 @@ public: void pending_disconnection(bool b) { m_pending_disconnection = b; } protected: - // Disallow copies (undefined) - Connection(const Connection&); - Connection(Port* const src_port, Port* const dst_port); Port* const m_src_port; diff --git a/src/libs/engine/DSSINode.h b/src/libs/engine/DSSINode.h index 1ef58d58..fd5a7afc 100644 --- a/src/libs/engine/DSSINode.h +++ b/src/libs/engine/DSSINode.h @@ -65,10 +65,6 @@ public: void plugin(const Plugin* const pi) { _plugin = pi; } private: - // Prevent copies (undefined) - DSSINode(const DSSINode& copy); - DSSINode& operator=(const DSSINode& copy); - bool has_midi_input() const; // DSSI GUI messages diff --git a/src/libs/engine/Driver.h b/src/libs/engine/Driver.h index 2fd17150..61d2b830 100644 --- a/src/libs/engine/Driver.h +++ b/src/libs/engine/Driver.h @@ -18,7 +18,7 @@ #define DRIVER_H #include <string> -using std::string; +#include <boost/utility.hpp> namespace Ingen { @@ -33,7 +33,7 @@ template <typename T> class DuplexPort; * * \ingroup engine */ -class DriverPort { +class DriverPort : boost::noncopyable { public: virtual ~DriverPort() {} @@ -44,7 +44,7 @@ public: virtual void remove_from_driver() = 0; /** Set the name of the system port */ - virtual void set_name(const string& name) = 0; + virtual void set_name(const std::string& name) = 0; protected: DriverPort() {} @@ -63,7 +63,7 @@ protected: * \ingroup engine */ template <typename T> -class Driver +class Driver : boost::noncopyable { public: virtual ~Driver() {} diff --git a/src/libs/engine/DuplexPort.h b/src/libs/engine/DuplexPort.h index c7f09811..4fa22145 100644 --- a/src/libs/engine/DuplexPort.h +++ b/src/libs/engine/DuplexPort.h @@ -52,10 +52,6 @@ public: virtual bool is_output() const { return _is_output; } protected: - // Prevent copies (undefined) - DuplexPort(const DuplexPort<T>& copy); - DuplexPort& operator=(const Port&); - bool _is_output; }; diff --git a/src/libs/engine/Engine.h b/src/libs/engine/Engine.h index a8d110ca..f584ee6d 100644 --- a/src/libs/engine/Engine.h +++ b/src/libs/engine/Engine.h @@ -18,6 +18,7 @@ #define ENGINE_H #include <cassert> +#include <boost/utility.hpp> template<typename T> class Queue; class Maid; @@ -47,7 +48,7 @@ template <typename T> class Driver; * * \ingroup engine */ -class Engine +class Engine : boost::noncopyable { public: Engine(AudioDriver* audio_driver = 0); @@ -81,10 +82,6 @@ public: template<typename T> Driver<T>* driver(); private: - // Prevent copies (undefined) - Engine(const Engine&); - Engine& operator=(const Engine&); - EventSource* m_event_source; AudioDriver* m_audio_driver; MidiDriver* m_midi_driver; diff --git a/src/libs/engine/Event.h b/src/libs/engine/Event.h index 01809cfc..5ba9b2a2 100644 --- a/src/libs/engine/Event.h +++ b/src/libs/engine/Event.h @@ -64,10 +64,6 @@ public: inline SampleCount time() { return _time; } protected: - // Prevent copies - Event(const Event&); - Event& operator=(const Event&); - Event(Engine& engine, SharedPtr<Responder> responder, FrameTime time) : _engine(engine) , _responder(responder) diff --git a/src/libs/engine/GraphObject.h b/src/libs/engine/GraphObject.h index 82cef94f..8fe2a0a6 100644 --- a/src/libs/engine/GraphObject.h +++ b/src/libs/engine/GraphObject.h @@ -103,10 +103,6 @@ protected: string _name; private: - // Prevent copies (undefined) - GraphObject(const GraphObject&); - GraphObject& operator=(const GraphObject& copy); - MetadataMap _metadata; }; diff --git a/src/libs/engine/InputPort.h b/src/libs/engine/InputPort.h index 8360fd3e..d1060042 100644 --- a/src/libs/engine/InputPort.h +++ b/src/libs/engine/InputPort.h @@ -64,10 +64,6 @@ public: bool is_output() const { return false; } private: - // Prevent copies (Undefined) - InputPort<T>(const InputPort<T>& copy); - InputPort<T>& operator=(const InputPort<T>&); - void update_buffers(); List<TypedConnection<T>*> m_connections; diff --git a/src/libs/engine/InternalNode.h b/src/libs/engine/InternalNode.h index 9c95aacb..25a453b9 100644 --- a/src/libs/engine/InternalNode.h +++ b/src/libs/engine/InternalNode.h @@ -56,10 +56,6 @@ public: protected: Plugin* plugin() const { return const_cast<Plugin*>(_plugin); } - // Disallow copies (undefined) - InternalNode(const InternalNode&); - InternalNode& operator=(const InternalNode&); - bool _is_added; }; diff --git a/src/libs/engine/JackAudioDriver.h b/src/libs/engine/JackAudioDriver.h index 072434b9..3780c180 100644 --- a/src/libs/engine/JackAudioDriver.h +++ b/src/libs/engine/JackAudioDriver.h @@ -45,7 +45,7 @@ public: void add_to_driver(); void remove_from_driver(); - void set_name(const string& name) { jack_port_set_name(_jack_port, name.c_str()); }; + void set_name(const std::string& name) { jack_port_set_name(_jack_port, name.c_str()); }; void prepare_buffer(jack_nframes_t nframes); @@ -53,10 +53,6 @@ public: DuplexPort<Sample>* patch_port() const { return _patch_port; } private: - // Prevent copies (undefined) - JackAudioPort(const JackAudioPort&); - JackAudioPort& operator=(const JackAudioPort&); - JackAudioDriver* _driver; jack_port_t* _jack_port; jack_sample_t* _jack_buffer; ///< Cached for output ports @@ -104,10 +100,6 @@ public: inline SampleCount frame_time() const { return jack_frame_time(_client); } private: - // Prevent copies (undefined) - JackAudioDriver(const JackAudioDriver&); - JackAudioDriver& operator=(const JackAudioDriver&); - friend class JackAudioPort; // Functions for JackAudioPort diff --git a/src/libs/engine/JackMidiDriver.h b/src/libs/engine/JackMidiDriver.h index 7ff2ad5b..3c5fe558 100644 --- a/src/libs/engine/JackMidiDriver.h +++ b/src/libs/engine/JackMidiDriver.h @@ -46,15 +46,11 @@ public: void add_to_driver(); void remove_from_driver(); - void set_name(const string& name) { jack_port_set_name(m_jack_port, name.c_str()); }; + void set_name(const std::string& name) { jack_port_set_name(m_jack_port, name.c_str()); }; DuplexPort<MidiMessage>* patch_port() const { return m_patch_port; } private: - // Prevent copies (undefined) - JackMidiPort(const JackMidiPort&); - JackMidiPort& operator=(const JackMidiPort&); - JackMidiDriver* m_driver; jack_port_t* m_jack_port; DuplexPort<MidiMessage>* m_patch_port; @@ -90,10 +86,6 @@ public: jack_client_t* jack_client() { return m_client; } private: - // Prevent copies (undefined) - JackMidiDriver(const JackMidiDriver&); - JackMidiDriver& operator=(const JackMidiDriver&); - List<JackMidiPort*> m_in_ports; List<JackMidiPort*> m_out_ports; diff --git a/src/libs/engine/LADSPANode.h b/src/libs/engine/LADSPANode.h index 6c5d6a5d..db5102e2 100644 --- a/src/libs/engine/LADSPANode.h +++ b/src/libs/engine/LADSPANode.h @@ -49,10 +49,6 @@ public: void plugin(const Plugin* const pi) { _plugin = pi; } protected: - // Prevent copies (undefined) - LADSPANode(const LADSPANode& copy); - LADSPANode& operator=(const LADSPANode&); - //void get_port_vals(ulong port_index, PortInfo* info); void get_port_limits(unsigned long port_index, Sample& default_value, Sample& lower_bound, Sample& upper_bound); diff --git a/src/libs/engine/LV2Node.h b/src/libs/engine/LV2Node.h index 224024a3..f84ef7da 100644 --- a/src/libs/engine/LV2Node.h +++ b/src/libs/engine/LV2Node.h @@ -52,10 +52,6 @@ public: void set_port_buffer(size_t voice, size_t port_num, void* buf); protected: - // Prevent copies (undefined) - LV2Node(const LV2Node& copy); - LV2Node& operator=(const LV2Node&); - //void get_port_vals(ulong port_index, PortInfo* info); const SLV2Plugin* _lv2_plugin; diff --git a/src/libs/engine/List.h b/src/libs/engine/List.h index 2ed83d6f..7997a6c5 100644 --- a/src/libs/engine/List.h +++ b/src/libs/engine/List.h @@ -43,10 +43,6 @@ public: const T& elem() const { return m_elem; } private: - // Prevent copies (undefined) - ListNode(const ListNode& copy); - ListNode& operator=(const ListNode& copy); - T m_elem; ListNode* m_next; ListNode* m_prev; @@ -132,10 +128,6 @@ public: //const_iterator end() const; private: - // Prevent copies (undefined) - List(const List& copy); - List& operator=(const List& copy); - ListNode<T>* m_head; ListNode<T>* m_tail; size_t m_size; diff --git a/src/libs/engine/Maid.h b/src/libs/engine/Maid.h index a7e74f79..665ffa05 100644 --- a/src/libs/engine/Maid.h +++ b/src/libs/engine/Maid.h @@ -17,8 +17,9 @@ #ifndef MAID_H #define MAID_H -#include "MaidObject.h" +#include <boost/utility.hpp> #include "raul/Queue.h" +#include "MaidObject.h" /** Explicitly driven garbage collector. @@ -32,7 +33,7 @@ * * \ingroup engine */ -class Maid +class Maid : boost::noncopyable { public: Maid(size_t size); @@ -43,10 +44,6 @@ public: void cleanup(); private: - // Prevent copies - Maid(const Maid&); - Maid& operator=(const Maid&); - Queue<MaidObject*> m_objects; }; diff --git a/src/libs/engine/MaidObject.h b/src/libs/engine/MaidObject.h index 74cec239..255e0ede 100644 --- a/src/libs/engine/MaidObject.h +++ b/src/libs/engine/MaidObject.h @@ -17,21 +17,18 @@ #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 +class MaidObject : boost::noncopyable { public: MaidObject() {} virtual ~MaidObject() {} - -private: - // Prevent copies - MaidObject(const MaidObject&); - MaidObject& operator=(const MaidObject&); }; diff --git a/src/libs/engine/MidiControlNode.h b/src/libs/engine/MidiControlNode.h index b291fe9c..9b781696 100644 --- a/src/libs/engine/MidiControlNode.h +++ b/src/libs/engine/MidiControlNode.h @@ -49,10 +49,6 @@ public: void learn(MidiLearnResponseEvent* ev) { _learning = true; _learn_event = ev; } private: - // Disallow copies (undefined) - MidiControlNode(const MidiControlNode& copy); - MidiControlNode& operator=(const MidiControlNode&); - bool _learning; InputPort<MidiMessage>* _midi_in_port; diff --git a/src/libs/engine/NodeBase.h b/src/libs/engine/NodeBase.h index 78a8cab5..2159ff9d 100644 --- a/src/libs/engine/NodeBase.h +++ b/src/libs/engine/NodeBase.h @@ -87,10 +87,6 @@ public: Patch* parent_patch() const { return (Patch*)_parent; } protected: - // Disallow copies (undefined) - NodeBase(const NodeBase&); - NodeBase& operator=(const NodeBase&); - ObjectStore* _store; const Plugin* _plugin; diff --git a/src/libs/engine/OSCClientSender.h b/src/libs/engine/OSCClientSender.h index 8b465288..f45812af 100644 --- a/src/libs/engine/OSCClientSender.h +++ b/src/libs/engine/OSCClientSender.h @@ -124,10 +124,6 @@ public: uint32_t program); private: - // Prevent copies (undefined) - OSCClientSender(const OSCClientSender&); - OSCClientSender& operator=(const OSCClientSender&); - string _url; lo_address _address; diff --git a/src/libs/engine/OSCEngineReceiver.h b/src/libs/engine/OSCEngineReceiver.h index 3cba46f1..b15ffe78 100644 --- a/src/libs/engine/OSCEngineReceiver.h +++ b/src/libs/engine/OSCEngineReceiver.h @@ -67,10 +67,6 @@ public: void deactivate(); private: - // Prevent copies (undefined) - OSCEngineReceiver(const OSCEngineReceiver&); - OSCEngineReceiver& operator=(const OSCEngineReceiver&); - virtual void _run(); static void error_cb(int num, const char* msg, const char* path); diff --git a/src/libs/engine/OutputPort.h b/src/libs/engine/OutputPort.h index bd3ae999..e38aa822 100644 --- a/src/libs/engine/OutputPort.h +++ b/src/libs/engine/OutputPort.h @@ -52,11 +52,6 @@ public: bool is_input() const { return false; } bool is_output() const { return true; } - -private: - // Prevent copies (undefined) - OutputPort(const OutputPort& copy); - OutputPort<T>& operator=(const OutputPort<T>&); }; diff --git a/src/libs/engine/Patch.h b/src/libs/engine/Patch.h index b6b709c4..e02731ff 100644 --- a/src/libs/engine/Patch.h +++ b/src/libs/engine/Patch.h @@ -98,10 +98,6 @@ public: size_t internal_poly() const { return _internal_poly; } private: - // Prevent copies (undefined) - Patch(const Patch&); - Patch& operator=(const Patch&); - inline void build_process_order_recursive(Node* n, Array<Node*>* order) const; size_t _internal_poly; diff --git a/src/libs/engine/Plugin.h b/src/libs/engine/Plugin.h index a841d6ee..bdd96ed1 100644 --- a/src/libs/engine/Plugin.h +++ b/src/libs/engine/Plugin.h @@ -20,6 +20,7 @@ #include "config.h" #include <cstdlib> +#include <boost/utility.hpp> #include <dlfcn.h> #include <string> #include <iostream> @@ -45,7 +46,7 @@ class Node; * FIXME: This whole thing is a filthy mess and needs a rewrite. Probably * with derived classes for each plugin type. */ -class Plugin +class Plugin : boost::noncopyable { public: enum Type { LV2, LADSPA, DSSI, Internal, Patch }; @@ -130,10 +131,6 @@ public: Node* instantiate(const string& name, size_t poly, Ingen::Patch* parent, SampleRate srate, size_t buffer_size); private: - // Disallow copies (undefined) - Plugin(const Plugin&); - Plugin& operator=(const Plugin&); - Type _type; string _uri; ///< LV2 only string _lib_path; ///< LADSPA/DSSI only diff --git a/src/libs/engine/PluginLibrary.h b/src/libs/engine/PluginLibrary.h index 0cf44846..6f79ee57 100644 --- a/src/libs/engine/PluginLibrary.h +++ b/src/libs/engine/PluginLibrary.h @@ -18,9 +18,10 @@ #ifndef PLUGINLIBRARY_H #define PLUGINLIBRARY_H -#include <dlfcn.h> -#include <string> #include <iostream> +#include <string> +#include <boost/utility.hpp> +#include <dlfcn.h> using std::string; using std::cerr; using std::endl; @@ -33,7 +34,7 @@ namespace Ingen { * In the NodeFactory, this represents one loaded shared library instance, * which is what handle() returns. */ -class PluginLibrary +class PluginLibrary : boost::noncopyable { public: /** Construct a new PluginLibrary. @@ -85,10 +86,6 @@ public: void* handle() const { return m_handle; } private: - // Disallow copies (undefined) - PluginLibrary(const PluginLibrary&); - PluginLibrary& operator=(const PluginLibrary&); - string m_path; void* m_handle; }; diff --git a/src/libs/engine/Port.h b/src/libs/engine/Port.h index e538248b..273ff690 100644 --- a/src/libs/engine/Port.h +++ b/src/libs/engine/Port.h @@ -67,10 +67,6 @@ public: protected: Port(Node* const node, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size); - // Prevent copies (undefined) - Port(const Port&); - Port& operator=(const Port&); - size_t _index; size_t _poly; DataType _type; diff --git a/src/libs/engine/PostProcessor.h b/src/libs/engine/PostProcessor.h index 284e64c1..5b66c9fc 100644 --- a/src/libs/engine/PostProcessor.h +++ b/src/libs/engine/PostProcessor.h @@ -46,10 +46,6 @@ public: inline void push(Event* const ev) { _events.push(ev); } private: - // Prevent copies - PostProcessor(const PostProcessor&); - PostProcessor& operator=(const PostProcessor&); - Maid& _maid; Queue<Event*> _events; virtual void _whipped(); diff --git a/src/libs/engine/QueuedEvent.h b/src/libs/engine/QueuedEvent.h index bd79821b..c400da8c 100644 --- a/src/libs/engine/QueuedEvent.h +++ b/src/libs/engine/QueuedEvent.h @@ -69,10 +69,6 @@ public: bool is_prepared() { return _pre_processed; } protected: - // Prevent copies - QueuedEvent(const QueuedEvent& copy); - QueuedEvent& operator=(const QueuedEvent&); - QueuedEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, diff --git a/src/libs/engine/QueuedEventSource.h b/src/libs/engine/QueuedEventSource.h index efceaa26..db003a92 100644 --- a/src/libs/engine/QueuedEventSource.h +++ b/src/libs/engine/QueuedEventSource.h @@ -67,10 +67,6 @@ protected: virtual void _whipped(); ///< Prepare 1 event private: - // Prevent copies (undefined) - QueuedEventSource(const QueuedEventSource&); - QueuedEventSource& operator=(const QueuedEventSource&); - // Note that it's crucially important which functions access which of these // variables, to maintain threadsafeness. diff --git a/src/libs/engine/Tree.h b/src/libs/engine/Tree.h index bcc39934..8750b717 100644 --- a/src/libs/engine/Tree.h +++ b/src/libs/engine/Tree.h @@ -19,6 +19,7 @@ #include <string> #include <cassert> +#include <boost/utility.hpp> #include "MaidObject.h" using std::string; @@ -65,10 +66,6 @@ public: friend class Tree<T>; protected: - // Prevent copies (undefined) - TreeNode(const TreeNode&); - TreeNode& operator=(const TreeNode&); - TreeNode<T>* m_parent; TreeNode<T>* m_left_child; TreeNode<T>* m_right_child; @@ -92,7 +89,7 @@ protected: * of Tree<T> do not use them. */ template <typename T> -class Tree +class Tree : boost::noncopyable { public: Tree() : m_root(0), m_size(0) {} @@ -132,10 +129,6 @@ public: iterator end() const; private: - // Prevent copies (undefined) - Tree<T>(const Tree<T>&); - Tree<T>& operator=(const Tree<T>&); - void m_set_all_traversed_recursive(TreeNode<T>* root, bool b); TreeNode<T>* m_find_smallest(TreeNode<T>* root); diff --git a/src/libs/engine/TypedConnection.h b/src/libs/engine/TypedConnection.h index 8fb16676..7f142f9d 100644 --- a/src/libs/engine/TypedConnection.h +++ b/src/libs/engine/TypedConnection.h @@ -56,10 +56,6 @@ public: inline Buffer<T>* buffer(size_t voice) const; private: - // Disallow copies (undefined) - TypedConnection(const TypedConnection& copy); - TypedConnection& operator=(const TypedConnection&); - Buffer<T>* m_local_buffer; ///< Only used for poly->mono connections bool m_must_mix; size_t m_buffer_size; diff --git a/src/libs/engine/TypedPort.h b/src/libs/engine/TypedPort.h index cf4c36a2..2647d8ce 100644 --- a/src/libs/engine/TypedPort.h +++ b/src/libs/engine/TypedPort.h @@ -59,10 +59,6 @@ public: protected: TypedPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size); - // Prevent copies (undefined) - TypedPort(const TypedPort<T>& copy); - TypedPort& operator=(const Port&); - void allocate_buffers(); bool m_fixed_buffers; |