summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/port_set.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-02-17 03:49:32 +0000
committerDavid Robillard <d@drobilla.net>2009-02-17 03:49:32 +0000
commit3f24977735b06f9b39a82d66c216ba27e3a302d5 (patch)
treef8c436d7350da2a14546aa047cf9cfbe83ecceff /libs/ardour/ardour/port_set.h
parent4fced02c0b9805e7b25dd91bf871d2dfe7350393 (diff)
Make a bunch of stuff boost::noncopyable.
Clean up. git-svn-id: svn://localhost/ardour2/branches/3.0@4613 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour/port_set.h')
-rw-r--r--libs/ardour/ardour/port_set.h27
1 files changed, 10 insertions, 17 deletions
diff --git a/libs/ardour/ardour/port_set.h b/libs/ardour/ardour/port_set.h
index 7b9e716e4a..92591389d9 100644
--- a/libs/ardour/ardour/port_set.h
+++ b/libs/ardour/ardour/port_set.h
@@ -21,6 +21,7 @@
#include <vector>
#include <ardour/chan_count.h>
+#include <boost/utility.hpp>
namespace ARDOUR {
@@ -34,7 +35,7 @@ class MidiPort;
* the nth port of a given type. Note that port(n) and nth_audio_port(n) may
* NOT return the same port.
*/
-class PortSet {
+class PortSet : public boost::noncopyable {
public:
PortSet();
@@ -66,12 +67,10 @@ public:
bool empty() const { return (_count.n_total() == 0); }
// ITERATORS
-
- // FIXME: this is a filthy copy-and-paste mess
+ // FIXME: possible to combine these? templates?
class iterator {
public:
-
Port& operator*() { return *_set.port(_type, _index); }
Port* operator->() { return _set.port(_type, _index); }
iterator& operator++() { ++_index; return *this; } // yes, prefix only
@@ -89,19 +88,18 @@ public:
size_t _index;
};
- iterator begin(DataType type = DataType::NIL)
- { return iterator(*this, type, 0); }
+ iterator begin(DataType type = DataType::NIL) {
+ return iterator(*this, type, 0);
+ }
- iterator end(DataType type = DataType::NIL)
- {
+ iterator end(DataType type = DataType::NIL) {
return iterator(*this, type,
(type == DataType::NIL) ? _count.n_total() : _count.get(type));
}
- // FIXME: typeify
+
class const_iterator {
public:
-
const Port& operator*() { return *_set.port(_index); }
const Port* operator->() { return _set.port(_index); }
const_iterator& operator++() { ++_index; return *this; } // yes, prefix only
@@ -114,7 +112,7 @@ public:
const_iterator(const PortSet& list, size_t index) : _set(list), _index(index) {}
const PortSet& _set;
- size_t _index;
+ size_t _index;
};
const_iterator begin() const { return const_iterator(*this, 0); }
@@ -123,7 +121,6 @@ public:
class audio_iterator {
public:
-
AudioPort& operator*() { return *_set.nth_audio_port(_index); }
AudioPort* operator->() { return _set.nth_audio_port(_index); }
audio_iterator& operator++() { ++_index; return *this; } // yes, prefix only
@@ -136,17 +133,13 @@ public:
audio_iterator(PortSet& list, size_t index) : _set(list), _index(index) {}
PortSet& _set;
- size_t _index;
+ size_t _index;
};
audio_iterator audio_begin() { return audio_iterator(*this, 0); }
audio_iterator audio_end() { return audio_iterator(*this, _count.n_audio()); }
private:
- // Prevent copies (undefined)
- PortSet(const PortSet& copy);
- void operator=(const PortSet& other);
-
typedef std::vector<Port*> PortVec;
// Vector of vectors, indexed by DataType::to_index()