IMemoryBuffer Class Referenceabstract

Basic OpenViBE memory buffer interface. More...

Inheritance diagram for IMemoryBuffer:
IObject CMemoryBuffer

Public Member Functions

virtual OpenViBE::boolean reserve (const OpenViBE::uint64 ui64Size)=0
 Reserves some memory for this memory buffer. More...
 
virtual OpenViBE::boolean setSize (const OpenViBE::uint64 ui64Size, const OpenViBE::boolean bDiscard)=0
 Changes the size of this memory buffer. More...
 
virtual OpenViBE::uint64 getSize (void) const =0
 Gets the current size of this memory buffer. More...
 
virtual OpenViBE::uint8 * getDirectPointer (void)=0
 Gets a direct pointer to the byte array for read/write access. More...
 
virtual const OpenViBE::uint8 * getDirectPointer (void) const =0
 Gets a direct pointer to the byte array for read access. More...
 
virtual OpenViBE::boolean append (const OpenViBE::uint8 *pBuffer, const OpenViBE::uint64 ui64BufferSize)=0
 Appends data to this memory buffer. More...
 
virtual OpenViBE::boolean append (const OpenViBE::IMemoryBuffer &rMemoryBuffer)
 Appends data to this memory buffer. More...
 
- Public Member Functions inherited from IObject
virtual OpenViBE::CIdentifier getClassIdentifier (void) const =0
 Returns the final class identifier of the concrete class. More...
 
virtual OpenViBE::boolean isDerivedFromClass (const OpenViBE::CIdentifier &rClassIdentifier) const
 Checks if this object is compatible with a class identifier. More...
 
virtual OpenViBE::boolean acceptVisitor (OpenViBE::IObjectVisitor &rObjectVisitor)
 Requests this object to accept a visitor. More...
 

Detailed Description

Basic OpenViBE memory buffer interface.

Author
Yann Renard (INRIA/IRISA)
Date
2007-11-21 This interface offers functionalities to basically manipulate a raw memory buffer. It allows the buffer to be resized and manipulated easily with no care of allocation reallocation. Implementations for this interface may provide optimisations for such operations.

OpenViBE provides an standalone implementation of this interface in OpenViBE::CMemoryBuffer

Member Function Documentation

virtual OpenViBE::boolean reserve ( const OpenViBE::uint64  ui64Size)
pure virtual

Reserves some memory for this memory buffer.

Parameters
ui64Size[in] : the amount of memory to reserve
Returns
true in case of success.
false in case of error.

This function reserves some memory space for later use. This does not affect the actual size of the buffer but allows later calls to append not to reallocate the whole buffer.

Note
if ui64Size is lower than the actual buffer size then true is returned and nothing is done.

Implemented in CMemoryBuffer.

virtual OpenViBE::boolean setSize ( const OpenViBE::uint64  ui64Size,
const OpenViBE::boolean  bDiscard 
)
pure virtual

Changes the size of this memory buffer.

Parameters
ui64Size[in] : the new size to give to the buffer
bDiscard[in] : tells the reallocation process whether it should presever currently stored data or not
Returns
true in case of success.
false in case of error.
Note
On error, the buffer is left unchanged.
If the new size if lower than the current size and bDiscard is true, the buffer is simply truncated to the ui64Size first bytes.
See Also
getSize

Implemented in CMemoryBuffer.

virtual OpenViBE::uint64 getSize ( void  ) const
pure virtual

Gets the current size of this memory buffer.

Returns
the current size of this memory buffer
See Also
setSize

Implemented in CMemoryBuffer.

Referenced by IMemoryBuffer::append().

virtual OpenViBE::uint8* getDirectPointer ( void  )
pure virtual

Gets a direct pointer to the byte array for read/write access.

Returns
a direct pointer to the byte array for read/write access
See Also
getSize

Implemented in CMemoryBuffer.

Referenced by IMemoryBuffer::append().

virtual const OpenViBE::uint8* getDirectPointer ( void  ) const
pure virtual

Gets a direct pointer to the byte array for read access.

Returns
a direct pointer to the byte array for read access
See Also
getSize

Implemented in CMemoryBuffer.

virtual OpenViBE::boolean append ( const OpenViBE::uint8 *  pBuffer,
const OpenViBE::uint64  ui64BufferSize 
)
pure virtual

Appends data to this memory buffer.

Parameters
pBuffer[in] : the buffer containing data that should be appended
ui64BufferSize[in] : the buffer size that should be appended
Returns
true in case of success.
false in case of error.

Implemented in CMemoryBuffer.

virtual OpenViBE::boolean append ( const OpenViBE::IMemoryBuffer rMemoryBuffer)
inlinevirtual

Appends data to this memory buffer.

Parameters
rMemoryBuffer[in] : the memory buffer containing data that should be appended
Returns
true in case of success.
false in case of error.

Reimplemented in CMemoryBuffer.

References IMemoryBuffer::getDirectPointer(), and IMemoryBuffer::getSize().