Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
eprosima::fastcdr::FastBuffer Class Reference

This class represents a stream of bytes that contains (or will contain) serialized data. This class is used by the serializers to serialize or deserialize using their representation. More...

#include <FastBuffer.h>

Public Types

typedef _FastBuffer_iterator iterator
 

Public Member Functions

iterator begin ()
 This function returns a iterator that points to the begining of the stream. More...
 
iterator end ()
 This function returns a iterator that points to the end of the stream. More...
 
 FastBuffer ()=default
 This constructor creates an internal stream and assigns it to the eprosima::fastcdr::FastBuffers object. The user can obtain this internal stream using the function eprosima::fastcdr::FastBuffers::getBuffer(). Be careful because this internal stream is deleted in the destruction of the eprosima::fastcdr::FastBuffers object. More...
 
 FastBuffer (char *const buffer, const size_t bufferSize)
 This constructor assigns the user's stream of bytes to the eprosima::fastcdr::FastBuffers object. The user's stream will be used to serialize. More...
 
 FastBuffer (FastBuffer &&fbuffer)
 Move constructor. More...
 
char * getBuffer () const
 This function returns the stream that the eprosima::fastcdr::FastBuffers uses to serialize data. More...
 
size_t getBufferSize () const
 This function returns the size of the allocated memory of the stream that the eprosima::fastcdr::FastBuffers uses to serialize data. More...
 
FastBufferoperator= (FastBuffer &&fbuffer)
 Move assignment. More...
 
bool reserve (size_t size)
 This function reserves memory for the internal raw buffer. It will only do so if the buffer is not yet allocated and is not externally set. More...
 
bool resize (size_t min_size_inc)
 This function resizes the raw buffer. It will call the user's defined function for this purpose. More...
 
virtual ~FastBuffer ()
 Default destructor. More...
 

Private Member Functions

 FastBuffer (const FastBuffer &)=delete
 
FastBufferoperator= (const FastBuffer &)=delete
 

Private Attributes

char * buffer_ { nullptr }
 Pointer to the stream of bytes that contains the serialized data. More...
 
bool m_internalBuffer { true }
 This variable indicates if the managed buffer is internal or is from the user. More...
 
size_t size_ { 0 }
 The total size of the user's buffer. More...
 

Detailed Description

This class represents a stream of bytes that contains (or will contain) serialized data. This class is used by the serializers to serialize or deserialize using their representation.

Definition at line 243 of file FastBuffer.h.

Member Typedef Documentation

◆ iterator

Definition at line 247 of file FastBuffer.h.

Constructor & Destructor Documentation

◆ FastBuffer() [1/4]

eprosima::fastcdr::FastBuffer::FastBuffer ( )
default

This constructor creates an internal stream and assigns it to the eprosima::fastcdr::FastBuffers object. The user can obtain this internal stream using the function eprosima::fastcdr::FastBuffers::getBuffer(). Be careful because this internal stream is deleted in the destruction of the eprosima::fastcdr::FastBuffers object.

◆ FastBuffer() [2/4]

FastBuffer::FastBuffer ( char *const  buffer,
const size_t  bufferSize 
)

This constructor assigns the user's stream of bytes to the eprosima::fastcdr::FastBuffers object. The user's stream will be used to serialize.

Parameters
bufferThe user's buffer that will be used. This buffer is not deallocated in the object's destruction. Cannot be NULL.
bufferSizeThe length of user's buffer.

Definition at line 27 of file FastBuffer.cpp.

◆ FastBuffer() [3/4]

eprosima::fastcdr::FastBuffer::FastBuffer ( FastBuffer &&  fbuffer)
inline

Move constructor.

Definition at line 268 of file FastBuffer.h.

◆ ~FastBuffer()

FastBuffer::~FastBuffer ( )
virtual

Default destructor.

Definition at line 36 of file FastBuffer.cpp.

◆ FastBuffer() [4/4]

eprosima::fastcdr::FastBuffer::FastBuffer ( const FastBuffer )
privatedelete

Member Function Documentation

◆ begin()

iterator eprosima::fastcdr::FastBuffer::begin ( )
inline

This function returns a iterator that points to the begining of the stream.

Returns
The new iterator.

Definition at line 317 of file FastBuffer.h.

◆ end()

iterator eprosima::fastcdr::FastBuffer::end ( )
inline

This function returns a iterator that points to the end of the stream.

Returns
The new iterator.

Definition at line 327 of file FastBuffer.h.

◆ getBuffer()

char* eprosima::fastcdr::FastBuffer::getBuffer ( ) const
inline

This function returns the stream that the eprosima::fastcdr::FastBuffers uses to serialize data.

Returns
The stream used by eprosima::fastcdr::FastBuffers to serialize data.

Definition at line 298 of file FastBuffer.h.

◆ getBufferSize()

size_t eprosima::fastcdr::FastBuffer::getBufferSize ( ) const
inline

This function returns the size of the allocated memory of the stream that the eprosima::fastcdr::FastBuffers uses to serialize data.

Returns
The size of the allocated memory of the stream used by the eprosima::fastcdr::FastBuffers to serialize data.

Definition at line 307 of file FastBuffer.h.

◆ operator=() [1/2]

FastBuffer& eprosima::fastcdr::FastBuffer::operator= ( const FastBuffer )
privatedelete

◆ operator=() [2/2]

FastBuffer& eprosima::fastcdr::FastBuffer::operator= ( FastBuffer &&  fbuffer)
inline

Move assignment.

Definition at line 280 of file FastBuffer.h.

◆ reserve()

bool FastBuffer::reserve ( size_t  size)

This function reserves memory for the internal raw buffer. It will only do so if the buffer is not yet allocated and is not externally set.

Parameters
sizeThe size of the memory to be allocated.
Returns
True if the allocation suceeded. False if the raw buffer was set externally or is already allocated.

Definition at line 44 of file FastBuffer.cpp.

◆ resize()

bool FastBuffer::resize ( size_t  min_size_inc)

This function resizes the raw buffer. It will call the user's defined function for this purpose.

Parameters
min_size_incThe minimun growth expected of the current raw buffer.
Returns
True if the operation works. False if it does not.

Definition at line 59 of file FastBuffer.cpp.

Member Data Documentation

◆ buffer_

char* eprosima::fastcdr::FastBuffer::buffer_ { nullptr }
private

Pointer to the stream of bytes that contains the serialized data.

Definition at line 357 of file FastBuffer.h.

◆ m_internalBuffer

bool eprosima::fastcdr::FastBuffer::m_internalBuffer { true }
private

This variable indicates if the managed buffer is internal or is from the user.

Definition at line 363 of file FastBuffer.h.

◆ size_

size_t eprosima::fastcdr::FastBuffer::size_ { 0 }
private

The total size of the user's buffer.

Definition at line 360 of file FastBuffer.h.


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


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Aug 11 2024 02:24:30