254 |
* allows to read from a RingBuffer without being forced to free read |
* allows to read from a RingBuffer without being forced to free read |
255 |
* data while reading / positioning. |
* data while reading / positioning. |
256 |
*/ |
*/ |
257 |
template<class _T> |
template<class T1> |
258 |
class _NonVolatileReader { |
class _NonVolatileReader { |
259 |
public: |
public: |
260 |
int read_space() { |
int read_space() { |
363 |
} |
} |
364 |
|
|
365 |
protected: |
protected: |
366 |
_NonVolatileReader(RingBuffer<_T>* pBuf) { |
_NonVolatileReader(RingBuffer<T1>* pBuf) { |
367 |
this->pBuf = pBuf; |
this->pBuf = pBuf; |
368 |
this->read_ptr = atomic_read(&pBuf->read_ptr); |
this->read_ptr = atomic_read(&pBuf->read_ptr); |
369 |
} |
} |
370 |
|
|
371 |
RingBuffer<_T>* pBuf; |
RingBuffer<T1>* pBuf; |
372 |
int read_ptr; |
int read_ptr; |
373 |
|
|
374 |
friend class RingBuffer<_T>; |
friend class RingBuffer<T1>; |
375 |
}; |
}; |
376 |
|
|
377 |
typedef _NonVolatileReader<T> NonVolatileReader; |
typedef _NonVolatileReader<T> NonVolatileReader; |