Main MRPT website > C++ reference for MRPT 1.9.9
List of all members | Public Member Functions | Private Attributes
mrpt::containers::MT_buffer Class Reference

Detailed Description

This class is a bulk sequence of bytes with MultiThread (MT)-safe read and write operations.

Definition at line 24 of file MT_buffer.h.

#include <mrpt/containers/MT_buffer.h>

Public Member Functions

 MT_buffer ()
 Default constructor. More...
 
virtual ~MT_buffer ()
 Destructor. More...
 
void clear ()
 Empty the buffer. More...
 
size_t size ()
 Return the number of available bytes at this moment. More...
 
void appendData (const std::vector< uint8_t > &d)
 Append new data to the stream. More...
 
void readAndClear (std::vector< uint8_t > &d)
 Read the whole buffer and empty it. More...
 
void read (std::vector< uint8_t > &d)
 Read the whole buffer. More...
 

Private Attributes

std::vector< uint8_tm_data
 
std::mutex m_cs
 

Constructor & Destructor Documentation

◆ MT_buffer()

mrpt::containers::MT_buffer::MT_buffer ( )
inline

Default constructor.

Definition at line 32 of file MT_buffer.h.

◆ ~MT_buffer()

virtual mrpt::containers::MT_buffer::~MT_buffer ( )
inlinevirtual

Destructor.

Definition at line 34 of file MT_buffer.h.

Member Function Documentation

◆ appendData()

void mrpt::containers::MT_buffer::appendData ( const std::vector< uint8_t > &  d)
inline

Append new data to the stream.

Definition at line 54 of file MT_buffer.h.

References m_cs, and m_data.

Referenced by mrpt::hwdrivers::CNTRIPClient::private_ntrip_thread(), and mrpt::hwdrivers::CNTRIPClient::sendBackToServer().

◆ clear()

void mrpt::containers::MT_buffer::clear ( )
inline

Empty the buffer.

Definition at line 36 of file MT_buffer.h.

References m_cs, and m_data.

Referenced by mrpt::hwdrivers::CNTRIPClient::close(), and mrpt::hwdrivers::CNTRIPClient::private_ntrip_thread().

◆ read()

void mrpt::containers::MT_buffer::read ( std::vector< uint8_t > &  d)
inline

Read the whole buffer.

Definition at line 71 of file MT_buffer.h.

References m_cs, and m_data.

◆ readAndClear()

void mrpt::containers::MT_buffer::readAndClear ( std::vector< uint8_t > &  d)
inline

Read the whole buffer and empty it.

Definition at line 62 of file MT_buffer.h.

References m_cs, and m_data.

Referenced by mrpt::hwdrivers::CNTRIPEmitter::doProcess(), and mrpt::hwdrivers::CNTRIPClient::private_ntrip_thread().

◆ size()

size_t mrpt::containers::MT_buffer::size ( )
inline

Return the number of available bytes at this moment.

Definition at line 44 of file MT_buffer.h.

References m_cs, and m_data.

Referenced by mrpt::hwdrivers::CNTRIPClient::private_ntrip_thread().

Member Data Documentation

◆ m_cs

std::mutex mrpt::containers::MT_buffer::m_cs
private

Definition at line 28 of file MT_buffer.h.

Referenced by appendData(), clear(), read(), readAndClear(), and size().

◆ m_data

std::vector<uint8_t> mrpt::containers::MT_buffer::m_data
private

Definition at line 27 of file MT_buffer.h.

Referenced by appendData(), clear(), read(), readAndClear(), and size().




Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST