libsdr  0.1.0
A simple SDR library
Public Member Functions | Protected Attributes | List of all members
sdr::RawBuffer Class Reference

Base class of all buffers, represents an untyped array of bytes. More...

#include <buffer.hh>

Inheritance diagram for sdr::RawBuffer:
sdr::Buffer< CScalar > sdr::Buffer< CSScalar > sdr::Buffer< float > sdr::Buffer< int8_t > sdr::Buffer< oScalar > sdr::Buffer< Scalar > sdr::Buffer< SScalar > sdr::Buffer< std::complex< double > > sdr::Buffer< std::complex< float > > sdr::Buffer< std::complex< oScalar > > sdr::Buffer< std::complex< Scalar > > sdr::Buffer< std::complex< SScalar > > sdr::Buffer< uint8_t > sdr::Buffer< T > sdr::RawRingBuffer

Public Member Functions

 RawBuffer ()
 Constructs an empty buffer. More...
 
 RawBuffer (char *data, size_t offset, size_t len)
 Constructor from unowned data. More...
 
 RawBuffer (size_t N, BufferOwner *owner=0)
 Constructs a buffer and allocates N bytes. More...
 
 RawBuffer (const RawBuffer &other)
 Copy constructor. More...
 
 RawBuffer (const RawBuffer &other, size_t offset, size_t len)
 Creates a new view on the buffer. More...
 
virtual ~RawBuffer ()
 Destructor. More...
 
const RawBufferoperator= (const RawBuffer &other)
 Assignment. More...
 
char * ptr () const
 Returns the pointer to the data (w/o view). More...
 
char * data () const
 Returns the pointer to the data of the buffer view. More...
 
size_t bytesOffset () const
 Returns the offset of the data by the view. More...
 
size_t bytesLen () const
 Returns the size of the buffer by the view. More...
 
size_t storageSize () const
 Returns the raw buffer size in bytes. More...
 
bool isEmpty () const
 Returns true if the buffer is invalid/empty. More...
 
void ref () const
 Increment reference counter. More...
 
void unref ()
 Dereferences the buffer. More...
 
int refCount () const
 Returns the reference counter. More...
 
bool isUnused () const
 We assume here that buffers are owned by one object: A buffer is therefore "unused" if the owner holds the only reference to the buffer. More...
 

Protected Attributes

char * _ptr
 Holds the pointer to the data or 0, if buffer is empty. More...
 
size_t _storage_size
 Holds the size of the buffer in bytes. More...
 
size_t _b_offset
 Holds the offset of the buffer in bytes. More...
 
size_t _b_length
 Holds the length of the buffer (view) in bytes. More...
 
int * _refcount
 The reference counter. More...
 
BufferOwner_owner
 Holds a weak reference the buffer owner. More...
 

Detailed Description

Base class of all buffers, represents an untyped array of bytes.

Constructor & Destructor Documentation

RawBuffer::RawBuffer ( )

Constructs an empty buffer.

An empty buffer cannot be owned.

RawBuffer::RawBuffer ( char *  data,
size_t  offset,
size_t  len 
)

Constructor from unowned data.

RawBuffer::RawBuffer ( size_t  N,
BufferOwner owner = 0 
)

Constructs a buffer and allocates N bytes.

RawBuffer::RawBuffer ( const RawBuffer other)

Copy constructor.

RawBuffer::RawBuffer ( const RawBuffer other,
size_t  offset,
size_t  len 
)

Creates a new view on the buffer.

RawBuffer::~RawBuffer ( )
virtual

Destructor.

Member Function Documentation

size_t sdr::RawBuffer::bytesLen ( ) const
inline

Returns the size of the buffer by the view.

size_t sdr::RawBuffer::bytesOffset ( ) const
inline

Returns the offset of the data by the view.

char* sdr::RawBuffer::data ( ) const
inline

Returns the pointer to the data of the buffer view.

bool sdr::RawBuffer::isEmpty ( ) const
inline

Returns true if the buffer is invalid/empty.

bool sdr::RawBuffer::isUnused ( ) const
inline

We assume here that buffers are owned by one object: A buffer is therefore "unused" if the owner holds the only reference to the buffer.

const RawBuffer& sdr::RawBuffer::operator= ( const RawBuffer other)
inline

Assignment.

char* sdr::RawBuffer::ptr ( ) const
inline

Returns the pointer to the data (w/o view).

void RawBuffer::ref ( ) const

Increment reference counter.

int sdr::RawBuffer::refCount ( ) const
inline

Returns the reference counter.

size_t sdr::RawBuffer::storageSize ( ) const
inline

Returns the raw buffer size in bytes.

void RawBuffer::unref ( )

Dereferences the buffer.

Member Data Documentation

size_t sdr::RawBuffer::_b_length
protected

Holds the length of the buffer (view) in bytes.

size_t sdr::RawBuffer::_b_offset
protected

Holds the offset of the buffer in bytes.

BufferOwner* sdr::RawBuffer::_owner
protected

Holds a weak reference the buffer owner.

char* sdr::RawBuffer::_ptr
protected

Holds the pointer to the data or 0, if buffer is empty.

int* sdr::RawBuffer::_refcount
protected

The reference counter.

size_t sdr::RawBuffer::_storage_size
protected

Holds the size of the buffer in bytes.


The documentation for this class was generated from the following files: