sipxmedialib  Version 3.3
Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
MpArrayBuf Struct Reference

Stores data right after the header. More...

#include <MpArrayBuf.h>

Inheritance diagram for MpArrayBuf:
Inheritance graph
[legend]
Collaboration diagram for MpArrayBuf:
Collaboration graph
[legend]

Public Member Functions

Manipulators
bool setDataSize (int size)
 Set current data size. More...
 
- Public Member Functions inherited from MpBuf
void attach ()
 Increments reference counter. More...
 
void detach ()
 Decrements reference counter and free buffer if needed. More...
 
void setFlowGraph (MpFlowGraphBase *flowgraph)
 
MP_BUFFERS_TREE getType () const
 Get buffer type. More...
 
MpBufPoolgetBufferPool () const
 Get parent pool of this buffer. More...
 

Protected Member Functions

void init ()
 This is called in place of constructor. More...
 

Protected Attributes

unsigned mDataSize
 Size of the following data (in bytes). More...
 
char mpData [1]
 Pointer to the data, following this header. More...
 
- Protected Attributes inherited from MpBuf
MP_BUFFERS_TREE mType
 Buffer class type. Used for type safety. More...
 
int mRefCounter
 Reference counter for use with MpBufPtr. More...
 
MpBufPoolmpPool
 Parent memory pool. More...
 
MpFlowGraphBasempFlowGraph
 Debug pointer to flowgraph in which this buf is used. More...
 
void(* mpDestroy )(MpBuf *)
 
void(* mpInitClone )(MpBuf *)
 

Private Member Functions

 MpArrayBuf (const MpBuf &)
 Disable copy (and other) constructor. More...
 
MpArrayBufoperator= (const MpBuf &)
 Disable assignment operator. More...
 

Friends

class MpArrayBufPtr
 

Accessors

char * getDataWritePtr ()
 Get pointer to the buffer data with intent to write/change it. More...
 
const char * getDataPtr () const
 Get read only pointer to the buffer data. More...
 
unsigned getMaxDataSize () const
 Get maximum allowed payload size (in bytes). More...
 
unsigned getDataSize () const
 Get current data size. More...
 
static int getHeaderSize ()
 Get size of MpArrayBuf without data (in bytes). More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from MpBuf
static void sInitClone (MpBuf *pBuffer)
 Function that initialize buffer after cloning. It adjusts reference counters. More...
 

Detailed Description

Stores data right after the header.

This class adds two features to MpBuf - pointer to data, located right after the MpArrayBuf object, and its size. Size of the data may be set by user to any acceptable value. See setDataSize() for more details about data size setting.

Constructor & Destructor Documentation

MpArrayBuf ( const MpBuf )
private

Disable copy (and other) constructor.

This struct will be initialized by init() member.

Member Function Documentation

bool setDataSize ( int  size)

Set current data size.

New data size could not be greater then allocated space (provided by getMaxDataSize()).

Returns
false if size is greater then allocated space. In this case size is set to maximum possible).
true is returned in either case.
Parameters
sizenew data size
char* getDataWritePtr ( )
inline

Get pointer to the buffer data with intent to write/change it.

const char* getDataPtr ( ) const
inline

Get read only pointer to the buffer data.

static int getHeaderSize ( )
inlinestatic

Get size of MpArrayBuf without data (in bytes).

unsigned getMaxDataSize ( ) const
inline

Get maximum allowed payload size (in bytes).

unsigned getDataSize ( ) const
inline

Get current data size.

void init ( )
protected

This is called in place of constructor.

MpArrayBuf& operator= ( const MpBuf )
private

Disable assignment operator.

Buffers may be copied. But do we need this?

Friends And Related Function Documentation

friend class MpArrayBufPtr
friend

Member Data Documentation

unsigned mDataSize
protected

Size of the following data (in bytes).

char mpData[1]
protected

Pointer to the data, following this header.