diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2009-02-10 22:06:56 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2009-02-10 22:06:56 +0000 |
commit | 494e7feec64f8b9de42a08ae8e43c7e9df019255 (patch) | |
tree | fa07dd59de53f82e8c36d5305b93c53c4069ced4 /libs/evoral/evoral/EventRingBuffer.hpp | |
parent | 7666413e1837214f2350330ce1d257a499a9344f (diff) |
* Code readability: Template parameter <T> -> <Time>
git-svn-id: svn://localhost/ardour2/branches/3.0@4521 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/evoral/evoral/EventRingBuffer.hpp')
-rw-r--r-- | libs/evoral/evoral/EventRingBuffer.hpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/libs/evoral/evoral/EventRingBuffer.hpp b/libs/evoral/evoral/EventRingBuffer.hpp index 92d366387f..1ff1a8fe15 100644 --- a/libs/evoral/evoral/EventRingBuffer.hpp +++ b/libs/evoral/evoral/EventRingBuffer.hpp @@ -34,8 +34,8 @@ namespace Evoral { * This packs a timestamp, size, and size bytes of data flat into the buffer. * Useful for MIDI events, OSC messages, etc. */ -template<typename T> -class EventRingBuffer : public Evoral::RingBuffer<uint8_t>, public Evoral::EventSink<T> { +template<typename Time> +class EventRingBuffer : public Evoral::RingBuffer<uint8_t>, public Evoral::EventSink<Time> { public: /** @param capacity Ringbuffer capacity in bytes. @@ -45,27 +45,27 @@ public: size_t capacity() const { return _size; } - bool peek_time(T* time); + bool peek_time(Time* time); - uint32_t write(T time, EventType type, uint32_t size, const uint8_t* buf); - bool read (T* time, EventType* type, uint32_t* size, uint8_t* buf); + uint32_t write(Time time, EventType type, uint32_t size, const uint8_t* buf); + bool read (Time* time, EventType* type, uint32_t* size, uint8_t* buf); }; -template<typename T> +template<typename Time> inline bool -EventRingBuffer<T>::peek_time(T* time) +EventRingBuffer<Time>::peek_time(Time* time) { - bool success = RingBuffer<uint8_t>::full_peek(sizeof(T), (uint8_t*)time); + bool success = RingBuffer<uint8_t>::full_peek(sizeof(Time), (uint8_t*)time); return success; } -template<typename T> +template<typename Time> inline bool -EventRingBuffer<T>::read(T* time, EventType* type, uint32_t* size, uint8_t* buf) +EventRingBuffer<Time>::read(Time* time, EventType* type, uint32_t* size, uint8_t* buf) { - bool success = RingBuffer<uint8_t>::full_read(sizeof(T), (uint8_t*)time); + bool success = RingBuffer<uint8_t>::full_read(sizeof(Time), (uint8_t*)time); if (success) success = RingBuffer<uint8_t>::full_read(sizeof(EventType), (uint8_t*)type); if (success) @@ -77,14 +77,14 @@ EventRingBuffer<T>::read(T* time, EventType* type, uint32_t* size, uint8_t* buf) } -template<typename T> +template<typename Time> inline uint32_t -EventRingBuffer<T>::write(T time, EventType type, uint32_t size, const uint8_t* buf) +EventRingBuffer<Time>::write(Time time, EventType type, uint32_t size, const uint8_t* buf) { - if (write_space() < (sizeof(T) + sizeof(EventType) + sizeof(uint32_t) + size)) { + if (write_space() < (sizeof(Time) + sizeof(EventType) + sizeof(uint32_t) + size)) { return 0; } else { - RingBuffer<uint8_t>::write(sizeof(T), (uint8_t*)&time); + RingBuffer<uint8_t>::write(sizeof(Time), (uint8_t*)&time); RingBuffer<uint8_t>::write(sizeof(EventType), (uint8_t*)&type); RingBuffer<uint8_t>::write(sizeof(uint32_t), (uint8_t*)&size); RingBuffer<uint8_t>::write(size, buf); |