diff options
author | David Robillard <d@drobilla.net> | 2009-02-17 03:49:32 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-02-17 03:49:32 +0000 |
commit | 3f24977735b06f9b39a82d66c216ba27e3a302d5 (patch) | |
tree | f8c436d7350da2a14546aa047cf9cfbe83ecceff /libs/ardour/ardour/buffer_set.h | |
parent | 4fced02c0b9805e7b25dd91bf871d2dfe7350393 (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/buffer_set.h')
-rw-r--r-- | libs/ardour/ardour/buffer_set.h | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/libs/ardour/ardour/buffer_set.h b/libs/ardour/ardour/buffer_set.h index 3f7a6e7665..dbdf41b87a 100644 --- a/libs/ardour/ardour/buffer_set.h +++ b/libs/ardour/ardour/buffer_set.h @@ -32,7 +32,6 @@ class AudioBuffer; class MidiBuffer; class PortSet; - /** A set of buffers of various types. * * These are mainly accessed from Session and passed around as scratch buffers @@ -69,32 +68,26 @@ public: size_t buffer_capacity(DataType type) const; - Buffer& get(DataType type, size_t i) - { + Buffer& get(DataType type, size_t i) { assert(i <= _count.get(type)); return *_buffers[type][i]; } - AudioBuffer& get_audio(size_t i) - { + AudioBuffer& get_audio(size_t i) { return (AudioBuffer&)get(DataType::AUDIO, i); } - MidiBuffer& get_midi(size_t i) - { + MidiBuffer& get_midi(size_t i) { return (MidiBuffer&)get(DataType::MIDI, i); } void read_from(BufferSet& in, jack_nframes_t nframes, jack_nframes_t offset=0); // ITERATORS - - // FIXME: this is a filthy copy-and-paste mess - // FIXME: litter these with assertions + // FIXME: possible to combine these? templates? class audio_iterator { public: - AudioBuffer& operator*() { return _set.get_audio(_index); } AudioBuffer* operator->() { return &_set.get_audio(_index); } audio_iterator& operator++() { ++_index; return *this; } // yes, prefix only @@ -113,15 +106,17 @@ public: audio_iterator audio_begin() { return audio_iterator(*this, 0); } audio_iterator audio_end() { return audio_iterator(*this, _count.n_audio()); } + class iterator { public: - Buffer& operator*() { return _set.get(_type, _index); } Buffer* operator->() { return &_set.get(_type, _index); } iterator& operator++() { ++_index; return *this; } // yes, prefix only bool operator==(const iterator& other) { return (_index == other._index); } bool operator!=(const iterator& other) { return (_index != other._index); } - iterator operator=(const iterator& other) { _set = other._set; _type = other._type; _index = other._index; return *this; } + iterator operator=(const iterator& other) { + _set = other._set; _type = other._type; _index = other._index; return *this; + } private: friend class BufferSet; @@ -136,7 +131,6 @@ public: iterator begin(DataType type) { return iterator(*this, type, 0); } iterator end(DataType type) { return iterator(*this, type, _count.get(type)); } - private: typedef std::vector<Buffer*> BufferVec; |