CCirBufBase Class Reference

class CCirBufBase : public CBase

Base class for circular buffers.

The class is part of the implementation of circular buffers and is never instantiated.

The class provides member functions that form part of the interface.

Inherits from

Constructor & Destructor Documentation

CCirBufBase(TInt)

IMPORT_C CCirBufBase ( TInt aSize ) [protected]

Constructor taking the size of an object within the buffer.

panic
E32USER-CBase 72, if aSize is zero or negative.

Parameters

TInt aSize The size of an object in the buffer.

~CCirBufBase()

IMPORT_C ~CCirBufBase ( )

Destructor.

This frees the memory allocated to the buffer.

Member Functions Documentation

Count()

TInt Count ( ) const [inline]

Gets the current number of objects in this circular buffer.

DoAdd(const TUint8 *)

IMPORT_C TInt DoAdd ( const TUint8 * aPtr ) [protected]

Implementation function for CCirBuf::Add(const T*)

Adds a single object to the circular buffer, but only if there is space available.

panic
E32USER-CBase 74, if a call to CCirBufBase::SetLengthL() has not been made before calling this function.
CCirBuf::Add CCirBufBase::SetLengthL

Parameters

const TUint8 * aPtr A pointer to the object to be added.

DoAdd(const TUint8 *, TInt)

IMPORT_C TInt DoAdd ( const TUint8 * aPtr,
TInt aCount
) [protected]

Implementation function for CCirBuf::Add(const T*,TInt)

Adds multiple objects to the circular buffer, but only if there is space available.

panic
E32USER-CBase 74, if a call to CCirBufBase::SetLengthL() has not been made before calling this function.
panic
E32USER-CBase 75, if aCount is not a positive value.
CCirBuf::Add CCirBufBase::SetLengthL

Parameters

const TUint8 * aPtr A pointer to a set of contiguous objects to be added.
TInt aCount The number of objects to be added.

DoRemove(TUint8 *)

IMPORT_C TInt DoRemove ( TUint8 * aPtr ) [protected]

Implementation function for CCirBuf::Remove(T*)

Removes a single object from the circular buffer, but only if there are objects in the buffer.

A binary copy of the object is made to aPtr.

CCirBuf::Remove

Parameters

TUint8 * aPtr A pointer to a location supplied by the caller.

DoRemove(TUint8 *, TInt)

IMPORT_C TInt DoRemove ( TUint8 * aPtr,
TInt aCount
) [protected]

Implementation function for CCirBuf::Remove(T*,TInt)

Attempts to remove aCount objects from the circular buffer, but only if there are objects in the buffer.

A binary copy of the objects is made to aPtr.

panic
E32USER-CBase 76, if aCount is not a positive value.
CCirBuf::Remove

Parameters

TUint8 * aPtr A pointer to a location supplied by the caller capable of holding aCount objects.
TInt aCount The number of objects to be removed from the circular buffer.

Length()

TInt Length ( ) const [inline]

Gets the maximum capacity of this circular buffer.

The capacity is the maximum number of elements that the buffer can hold.

Use SetLengthL() to change the capacity of the circular buffer.

CCirBufBase::SetLengthL

Reset()

IMPORT_C void Reset ( )

Empties the buffer.

SetLengthL(TInt)

IMPORT_C void SetLengthL ( TInt aLength )

Sets the maximum capacity of this circular buffer, and resets all of the buffer pointers.

The capacity is the maximum number of elements that the buffer can hold.

The buffer itself is allocated as a result of a call to this function. If the function has previously been called, then any existing buffer is freed and any information in it is lost.

Notes:

1. This function must be called before attempting to add any objects to the buffer.

2. The function can leave if there is insufficient memory available to allocate the buffer.

panic
E32USER-CBase 73, if aLength is zero or negative.

Parameters

TInt aLength The maximum capacity of the circular buffer.

Member Data Documentation

TInt iCount

TInt iCount [protected]

TUint8 * iHead

TUint8 * iHead [protected]

TInt iLength

TInt iLength [protected]

TUint8 * iPtr

TUint8 * iPtr [protected]

TUint8 * iPtrE

TUint8 * iPtrE [protected]

TInt iSize

TInt iSize [protected]

TUint8 * iTail

TUint8 * iTail [protected]