Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <mmfdatabuffer.h>
Link against: mmfserverbaseclasses.lib

Class CMMFPtrBuffer

class CMMFPtrBuffer : public CMMFDataBuffer;

Description

This class is a wrapper class intended to provide support for shared I/O buffers under EKA2 This class, unlike other data buffers does not own memory - rather it contains a pointer to already allocated memory The purpose of this class is that components such as codecs can use CMMFDataBuffers transparently without having to be concerned with whether the buffer is a standard buffer or memory residing in shared I/O

Users of this class need to be very careful when using buffers of this type. It cannot be assumed that a buffer of this type can be written/read by any process other than the current one - example - handing CMMFPtrBuffer to the file server may not work since the file server's process may not have access to write data buffer.

Derivation

Members

Defined in CMMFPtrBuffer:

Inherited from CBase:

Inherited from CMMFBuffer:

Inherited from CMMFDataBuffer:


Construction and destruction


NewL()

IMPORT_C static CMMFPtrBuffer* NewL();

Description

Function to instantiate a CMMFPtrBuffer. This NewL creates an unititalised CMMFPtrBuffer.

Return value

CMMFPtrBuffer *

A pointer to a new CMMFPtrBuffer.


NewL(const TPtr8 &)

IMPORT_C static CMMFPtrBuffer* NewL(const TPtr8 &aPtr);

Description

Function to instantiate a CMMFPtrBuffer. This NewL creates a CMMFPtrBuffer which owns a TPtr8.

Parameters

const TPtr8 &aPtr

A reference to a TPtr containing the CMMFPtrBuffer data.

Return value

CMMFPtrBuffer *

A pointer to a new CMMFPtrBuffer.


~CMMFPtrBuffer()

IMPORT_C ~CMMFPtrBuffer();

Description

Destructor.

Destructor does no deletion, as this buffer class does not own the memory.

[Top]


Member functions


SetPtr(const TPtr8 &)

IMPORT_C void SetPtr(const TPtr8 &aPtr);

Description

Takes a TPtr8 to pre-allocated memory.

Parameters

const TPtr8 &aPtr

The pointer refernce.


Data()

virtual TDes8& Data();

Description

Returns a descriptor to the data contained in the CMMFPtrBuffer.

Return value

TDes8 &

A reference to a TPtr containing the CMMFPtrBuffer data.


Data()const

virtual const TDesC8& Data() const;

Description

Returns a descriptor to the data contained in the CMMFPtrBuffer.

Return value

const TDesC8 &

A const reference to a TPtr containing the CMMFPtrBuffer data.


SetStatus(TBufferStatus)

virtual void SetStatus(TBufferStatus aStatus);

Description

Overriden method to set the status. Resets the data size to 0 when the buffer becomes available.

Parameters

TBufferStatus aStatus

The buffer status. See enum TBufferStatus.


SetRequestSizeL(TInt)

virtual void SetRequestSizeL(TInt aSize);

Description

Sets the request size.

This method is used in cases where a component (eg. a data source) may not be able or be desirable to write to the entire max length of the buffer (eg. variable bit rate codecs). In this case, the CMMFPtrBuffer::SetRequestSizeL(TInt) can be set which can be read by the CMMFBuffer::RequestSize()const function in the component so that it knows to only write data upto the requested size and not fill the buffer up to its maximum length.

Parameters

TInt aSize

The request size.


BufferSize()const

virtual TUint BufferSize() const;

Description

Returns the actual data size (ie. not the max length) of the data contained in the CMMFPtrBuffer.

Return value

TUint

The size in bytes of the data contained in the CMMFPtrBuffer.


SetPosition(TUint)

virtual void SetPosition(TUint aPosition);

Description

Sets the position.

This function is used by components (eg. codecs) which read data from a buffer and wish to store a read position marker for further reads.

Note: The position cannot exceed the size of the actual data not the maximum length.

Parameters

TUint aPosition

The position.