| Fast CDR Version 2.3.5 Fast CDR

Loading...
Searching...
No Matches
FastBuffer Class Reference
FastCDR Serializer API Reference

This class represents a stream of bytes that contains (or will contain) serialized data. More...

`#include <FastBuffer.h>`

## Public Types

typedef _FastBuffer_iterator | iterator

## Public Member Functions

| FastBuffer ()=default
| This constructor creates an internal stream and assigns it to the eprosima::fastcdr::FastBuffers object.
| FastBuffer (char *const buffer, const size_t bufferSize)
| This constructor assigns the user's stream of bytes to the eprosima::fastcdr::FastBuffers object.
| FastBuffer (FastBuffer &&fbuffer)
| Move constructor.
FastBuffer & | operator= (FastBuffer &&fbuffer)
| Move assignment.
virtual | ~FastBuffer ()
| Default destructor.
char * | getBuffer () const
| This function returns the stream that the eprosima::fastcdr::FastBuffers uses to serialize data.
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.
iterator | begin ()
| This function returns a iterator that points to the begining of the stream.
iterator | end ()
| This function returns a iterator that points to the end of the stream.
bool | reserve (size_t size)
| This function reserves memory for the internal raw buffer.
bool | resize (size_t min_size_inc)
| This function resizes the raw buffer.

## 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.

## Member Typedef Documentation

## ◆ iterator

typedef _FastBuffer_iterator iterator

## Constructor & Destructor Documentation

## ◆ FastBuffer() [1/3]

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/3]

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

  buffer | The user's buffer that will be used. This buffer is not deallocated in the object's destruction. Cannot be NULL.
  bufferSize | The length of user's buffer.

## ◆ FastBuffer() [3/3]

FastBuffer | ( | FastBuffer && | fbuffer | ) |

inline

Move constructor.

## ◆ ~FastBuffer()

virtual ~FastBuffer | ( |  | ) |

virtual

Default destructor.

## Member Function Documentation

## ◆ begin()

iterator begin | ( |  | ) |

inline

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

Returns
  The new iterator.

## ◆ end()

iterator end | ( |  | ) |

inline

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

Returns
  The new iterator.

## ◆ getBuffer()

char * 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.

## ◆ getBufferSize()

size_t 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.

## ◆ operator=()

FastBuffer & operator= | ( | FastBuffer && | fbuffer | ) |

inline

Move assignment.

## ◆ reserve()

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.

Parameters

  size | The 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.

## ◆ resize()

bool 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_inc | The minimun growth expected of the current raw buffer.

Returns
  True if the operation works. False if it does not.

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

- include/fastcdr/FastBuffer.h