AllianceDB  0.0.1
AllianceDB is an open-source suite, including benchmarks and libs for evaluating and improving stream operation algorithms on modern hardwares.

#include <Utils/C20Buffers.hpp>

Collaboration diagram for INTELLI::C20Buffer< dataType >:

Public Member Functions

void reset ()
 reset this buffer, set pos back to 0
 
 C20Buffer (size_t len)
 Init with original length of buffer. More...
 
size_t bufferSize ()
 To get how many elements are allowed in the buffer. More...
 
size_t size ()
 To get how many VALID elements are existed in the buffer. More...
 
dataType * data ()
 To get the original memory area ponter of data. More...
 
dataType * data (size_t offset)
 To get the original memory area ponter of data, with offset. More...
 
size_t append (dataType da)
 Append the data to the buffer. More...
 
size_t append (dataType *da, size_t len)
 Append the data to the buffer. More...
 

Public Attributes

std::vector< dataType > area
 

Protected Attributes

size_t pos = 0
 

Detailed Description

template<typename dataType>
class INTELLI::C20Buffer< dataType >

Template Parameters
dataTypeThe type of your buffering element

Constructor & Destructor Documentation

◆ C20Buffer()

template<typename dataType >
INTELLI::C20Buffer< dataType >::C20Buffer ( size_t  len)
inline

Init with original length of buffer.

Parameters
lenTHe original length of buffer

Member Function Documentation

◆ append() [1/2]

template<typename dataType >
size_t INTELLI::C20Buffer< dataType >::append ( dataType *  da,
size_t  len 
)
inline

Append the data to the buffer.

Parameters
daData to be appended, a buffer
lenthe length of data
Note
Exceed length will lead to a push_back in vector
Returns
The valid size after this append

◆ append() [2/2]

template<typename dataType >
size_t INTELLI::C20Buffer< dataType >::append ( dataType  da)
inline

Append the data to the buffer.

Parameters
daData to be appended
Note
Exceed length will lead to a push_back in vector
Returns
The valid size after this append

◆ bufferSize()

template<typename dataType >
size_t INTELLI::C20Buffer< dataType >::bufferSize ( )
inline

To get how many elements are allowed in the buffer.

Returns
The size of buffer area, i.e., area.size()
Note
: This is NOT the size of valid data
See also
size

◆ data() [1/2]

template<typename dataType >
dataType* INTELLI::C20Buffer< dataType >::data ( )
inline

To get the original memory area ponter of data.

Returns
The memory area address (pointer) that stores the data

◆ data() [2/2]

template<typename dataType >
dataType* INTELLI::C20Buffer< dataType >::data ( size_t  offset)
inline

To get the original memory area ponter of data, with offset.

Parameters
offsetOffset of data
Returns
The memory area address (pointer) that stores the data
Warning
Please ensure the offset is NOT larger than the area.size()-1

◆ size()

template<typename dataType >
size_t INTELLI::C20Buffer< dataType >::size ( )
inline

To get how many VALID elements are existed in the buffer.

Returns
The size of VALID elements
Note
: This is NOT the size of total buffer
See also
bufferSize

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