OpenJAUS SAE SDK  6.0.0
Classes | Public Member Functions | Private Attributes | Friends | List of all members
openjaus::system::Buffer Class Reference

#include <Buffer.h>

Inherits openjaus::system::Transportable.

Inherited by openjaus::system::Packet, and openjaus::transport::AS5669::JtcpStream.

Classes

class  ReaderImpl
 
class  WriterImpl
 

Public Member Functions

 Buffer (uint64 size)
 Creates a Buffer of size bytes. More...
 
 Buffer (const Buffer &other)
 Copies the incoming Buffer into a new a Buffer. More...
 
virtual ~Buffer ()
 
BufferReadergetReader ()
 Get a reference to the BufferReader. More...
 
BufferWritergetWriter ()
 Get a reference to the BufferWriter. More...
 
uint64 getMaxSize () const
 
uint64 setMaxSize (uint64 size)
 
uint64 bytesContained () const
 
virtual uint64 to (BufferWriter &dst) const
 Copy data from this Buffer starting at the current position 0 to the Buffer connected to the provided BufferWriter. More...
 
virtual uint64 from (BufferReader &src)
 Copy data from the Buffer connected to the provided BufferReader into this Buffer. More...
 
virtual uint64 length () const
 Gets the serialized length of this object. More...
 
virtual uint64 to (BufferWriter &dst, uint64 length) const
 Copy data from this Buffer starting at the current position 0 to the Buffer connected to the provided BufferWriter. More...
 
virtual uint64 from (BufferReader &src, uint64 length)
 Copy data from the Buffer connected to the provided BufferReader into this Buffer. More...
 
virtual std::string toString () const
 
std::string toString (int byteCount) const
 
Bufferoperator= (const Buffer &rhs)
 
bool operator== (const Buffer &other) const
 
- Public Member Functions inherited from openjaus::system::Transportable
 Transportable ()
 
virtual ~Transportable ()
 

Private Attributes

RandomAccessBuffer bufferInternal
 
ReaderImpl reader
 
WriterImpl writer
 

Friends

OPENJAUS_EXPORT friend std::ostream & operator<< (std::ostream &output, Buffer &object)
 
OPENJAUS_EXPORT friend std::ostream & operator<< (std::ostream &output, Buffer *object)
 

Constructor & Destructor Documentation

◆ Buffer() [1/2]

openjaus::system::Buffer::Buffer ( uint64  size)

◆ Buffer() [2/2]

openjaus::system::Buffer::Buffer ( const Buffer other)

◆ ~Buffer()

openjaus::system::Buffer::~Buffer ( )
virtual

Member Function Documentation

◆ bytesContained()

uint64 openjaus::system::Buffer::bytesContained ( ) const

◆ from() [1/2]

uint64 openjaus::system::Buffer::from ( BufferReader src)
virtual

The source BufferReader position will be advanced inside this method such that calling from() again will copy the next set of data from the source Buffer. The data will be placed into this Buffer starting at position 0 and getMaxSize() bytes will be copied.

Parameters
srcThe BufferReader of the Buffer from which the data should be copied

Implements openjaus::system::Transportable.

◆ from() [2/2]

uint64 openjaus::system::Buffer::from ( BufferReader src,
uint64  length 
)
virtual

The source BufferReader position will be advanced inside this method such that calling from() again will copy the next set of data from the source Buffer. The data will be placed into this Buffer starting at position 0 and length bytes will be copied.

Parameters
srcThe BufferReader of the Buffer from which the data should be copied
lengthThe number of bytes to copy

◆ getMaxSize()

uint64 openjaus::system::Buffer::getMaxSize ( ) const

◆ getReader()

BufferReader & openjaus::system::Buffer::getReader ( )

The same reader is returned on every get call to this method and the read position is not reset between calls. Call BufferReader::reset() to ensure that you're reading from the start of the Buffer.

◆ getWriter()

BufferWriter & openjaus::system::Buffer::getWriter ( )

The same writer is returned on every get call to this method and the write position is not reset between calls. Call BufferReader::clear() to ensure that you're writing to the start of the Buffer.

◆ length()

uint64 openjaus::system::Buffer::length ( ) const
virtual

◆ operator=()

Buffer & openjaus::system::Buffer::operator= ( const Buffer rhs)

◆ operator==()

bool openjaus::system::Buffer::operator== ( const Buffer other) const

◆ setMaxSize()

uint64 openjaus::system::Buffer::setMaxSize ( uint64  size)

◆ to() [1/2]

uint64 openjaus::system::Buffer::to ( BufferWriter dst) const
virtual

The data will be copied from this Buffer starting at position 0 and getMaxSize() bytes will be copied. The destination BufferWriter position will be advanced inside this method such that calling to() again will copy data into the the next space available in the destination Buffer.

Parameters
dstThe BufferWriter of the Buffer into which the data should be copied
lengthThe number of bytes to copy

Implements openjaus::system::Transportable.

◆ to() [2/2]

uint64 openjaus::system::Buffer::to ( BufferWriter dst,
uint64  length 
) const
virtual

The data will be copied from this Buffer starting at position 0 and length bytes will be copied. The destination BufferWriter position will be advanced inside this method such that calling to() again will copy data into the the next space available in the destination Buffer.

Parameters
dstThe BufferWriter of the Buffer into which the data should be copied
lengthThe number of bytes to copy

◆ toString() [1/2]

std::string openjaus::system::Buffer::toString ( ) const
virtual

◆ toString() [2/2]

std::string openjaus::system::Buffer::toString ( int  byteCount) const

Friends And Related Function Documentation

◆ operator<< [1/2]

OPENJAUS_EXPORT friend std::ostream& operator<< ( std::ostream &  output,
Buffer object 
)
friend

◆ operator<< [2/2]

OPENJAUS_EXPORT friend std::ostream& operator<< ( std::ostream &  output,
Buffer object 
)
friend

Member Data Documentation

◆ bufferInternal

RandomAccessBuffer openjaus::system::Buffer::bufferInternal
private

◆ reader

ReaderImpl openjaus::system::Buffer::reader
private

◆ writer

WriterImpl openjaus::system::Buffer::writer
private

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