nidas v1.2.3
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CharBuffer Class Reference

Simple char buffer class to provide memory into which C strings can be written. More...

Public Member Functions

 CharBuffer ()
 
void clear ()
 
charget ()
 Return a pointer to the beginning of the buffer.
 
chargetSpace (unsigned int length=0)
 Get a pointer to the end of the buffer with room for at least length more bytes, but do not change the length of space used in the buffer yet.
 
bool empty ()
 

Private Member Functions

 CharBuffer (const CharBuffer &rhs)
 
CharBufferoperator= (const CharBuffer &rhs)
 

Private Attributes

vector< char_buffer
 
unsigned int _buflen
 

Detailed Description

Simple char buffer class to provide memory into which C strings can be written.

Memory grows as necessary and is not reclaimed, and the length of the buffer is tracked so strings can be written right at the end instead of appended to a long string.

Constructor & Destructor Documentation

◆ CharBuffer() [1/2]

CharBuffer::CharBuffer ( )
inline

References clear().

◆ CharBuffer() [2/2]

CharBuffer::CharBuffer ( const CharBuffer & rhs)
inlineprivate

References VLOG.

Member Function Documentation

◆ clear()

void CharBuffer::clear ( )
inline

◆ empty()

bool CharBuffer::empty ( )
inline

References get(), and getSpace().

Referenced by InfluxDB::handleResult(), and InfluxDB::sendData().

◆ get()

char * CharBuffer::get ( )
inline

Return a pointer to the beginning of the buffer.

References _buffer.

Referenced by dataToInfluxDB(), empty(), getSpace(), InfluxDB::handleResult(), and InfluxDB::sendData().

◆ getSpace()

char * CharBuffer::getSpace ( unsigned int length = 0)
inline

Get a pointer to the end of the buffer with room for at least length more bytes, but do not change the length of space used in the buffer yet.

The returned pointer can be used to print or copy up to length bytes into the buffer, beginning at the pointer returned by getSpace(). A null terminator is automatically added at the new length, so the caller does not need to add a null terminator if it writes exactly length bytes into the buffer.

References _buffer, _buflen, get(), and nidas::core::getSample().

Referenced by InfluxDB::addMeasurement(), and empty().

◆ operator=()

CharBuffer & CharBuffer::operator= ( const CharBuffer & rhs)
inlineprivate

References _buffer, _buflen, and VLOG.

Member Data Documentation

◆ _buffer

vector<char> CharBuffer::_buffer
private

Referenced by clear(), get(), getSpace(), and operator=().

◆ _buflen

unsigned int CharBuffer::_buflen
private

Referenced by clear(), getSpace(), and operator=().


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