TDME2 1.9.121
Public Member Functions | Private Attributes | List of all members
Buffer Class Reference

Base class of buffers. More...

#include <tdme/utilities/Buffer.h>

Inheritance diagram for Buffer:
Inheritance graph
Collaboration diagram for Buffer:
Collaboration graph

Public Member Functions

 Buffer (int32_t capacity)
 Public constructor. More...
 
 Buffer (Buffer *buffer)
 Public constructor. More...
 
 Buffer (vector< uint8_t > *data)
 Public constructor. More...
 
virtual ~Buffer ()
 Destructor. More...
 
Bufferclear ()
 Clear. More...
 
virtual int32_t getCapacity ()
 
virtual int32_t getPosition ()
 
virtual BuffersetPosition (int32_t position)
 Set position. More...
 
uint8_t get (int32_t position)
 
Bufferput (uint8_t value)
 Put value into buffer. More...
 
Bufferput (const uint8_t *data, int32_t size)
 Put data into buffer. More...
 
uint8_t * getBuffer ()
 

Private Attributes

bool createdBuffer
 
int32_t position { 0 }
 
vector< uint8_t > * buffer { nullptr }
 

Detailed Description

Base class of buffers.

Author
Andreas Drewke

Definition at line 19 of file Buffer.h.

Constructor & Destructor Documentation

◆ Buffer() [1/3]

Buffer ( int32_t  capacity)
inline

Public constructor.

Parameters
capacitycapacity

Definition at line 31 of file Buffer.h.

◆ Buffer() [2/3]

Buffer ( Buffer buffer)
inline

Public constructor.

Parameters
bufferbuffer

Definition at line 41 of file Buffer.h.

◆ Buffer() [3/3]

Buffer ( vector< uint8_t > *  data)
inline

Public constructor.

Parameters
datadata

Definition at line 51 of file Buffer.h.

◆ ~Buffer()

virtual ~Buffer ( )
inlinevirtual

Destructor.

Definition at line 60 of file Buffer.h.

Member Function Documentation

◆ clear()

Buffer * clear ( )
inline

Clear.

Definition at line 69 of file Buffer.h.

◆ get()

uint8_t get ( int32_t  position)
inline
Returns
value at given position
Parameters
positionposition

Definition at line 102 of file Buffer.h.

◆ getBuffer()

uint8_t * getBuffer ( )
inline
Returns
pointer to underlying data

Definition at line 131 of file Buffer.h.

◆ getCapacity()

virtual int32_t getCapacity ( )
inlinevirtual
Returns
capacity

Reimplemented in FloatBuffer, IntBuffer, and ShortBuffer.

Definition at line 77 of file Buffer.h.

◆ getPosition()

virtual int32_t getPosition ( )
inlinevirtual
Returns
position

Reimplemented in FloatBuffer, IntBuffer, and ShortBuffer.

Definition at line 84 of file Buffer.h.

◆ put() [1/2]

Buffer * put ( const uint8_t *  data,
int32_t  size 
)
inline

Put data into buffer.

Parameters
datapointer to data
sizeto put
Returns
pointer to this buffer

Definition at line 121 of file Buffer.h.

◆ put() [2/2]

Buffer * put ( uint8_t  value)
inline

Put value into buffer.

Parameters
valuevalue

Definition at line 110 of file Buffer.h.

◆ setPosition()

virtual Buffer * setPosition ( int32_t  position)
inlinevirtual

Set position.

Parameters
positionposition
Returns
pointer to this buffer

Definition at line 93 of file Buffer.h.

Member Data Documentation

◆ buffer

vector<uint8_t>* buffer { nullptr }
private

Definition at line 24 of file Buffer.h.

◆ createdBuffer

bool createdBuffer
private

Definition at line 22 of file Buffer.h.

◆ position

int32_t position { 0 }
private

Definition at line 23 of file Buffer.h.


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