15#ifndef _FASTCDR_CDRBUFFER_H_
16#define _FASTCDR_CDRBUFFER_H_
28 #if defined(_WIN32) || !defined(FASTCDR_ARM32)
30 return static_cast<uint32_t
>(val);
62 , current_position_(&buffer_[index])
76 ptrdiff_t diff = current_position_ - buffer_;
78 current_position_ = buffer_ + diff;
91 current_position_ = buffer_ + diff;
104 memcpy(current_position_, &data,
sizeof(_T));
112 template<
typename _T>
117 memcpy(&data, current_position_,
sizeof(_T));
132 memcpy(current_position_, src, size);
148 memcpy(dst, current_position_, size);
160 current_position_ += num_bytes;
167 current_position_ -= num_bytes;
213 return current_position_;
225 return !(other_iterator == *
this);
231 char* buffer_ {
nullptr};
234 char* current_position_ {
nullptr};
265 const size_t bufferSize);
272 , m_internalBuffer(true)
276 std::swap(m_internalBuffer, fbuffer.m_internalBuffer);
285 std::swap(m_internalBuffer, fbuffer.m_internalBuffer);
346 size_t min_size_inc);
357 char* buffer_ {
nullptr };
363 bool m_internalBuffer {
true };
uint32_t size_to_uint32(size_t val)
This class represents a stream of bytes that contains (or will contain) serialized data....
FastBuffer(FastBuffer &&fbuffer)
Move constructor.
FastBuffer()=default
This constructor creates an internal stream and assigns it to the eprosima::fastcdr::FastBuffers obje...
FastBuffer(const FastBuffer &)=delete
iterator begin()
This function returns a iterator that points to the begining of the stream.
char * getBuffer() const
This function returns the stream that the eprosima::fastcdr::FastBuffers uses to serialize data.
_FastBuffer_iterator iterator
iterator end()
This function returns a iterator that points to the end of the stream.
size_t getBufferSize() const
This function returns the size of the allocated memory of the stream that the eprosima::fastcdr::Fast...
This class implements the iterator used to go through a FastBuffer.
_FastBuffer_iterator()=default
Default constructor. The iterator points any position.
void memcopy(const void *src, const size_t size)
This function copies a buffer into the raw buffer.
char * current_position_
Current position in the raw buffer.
_FastBuffer_iterator(char *buffer, size_t index)
Constructor. The iterator points to the indicated position.
void rmemcopy(void *dst, const size_t size)
This function copies from the raw buffer to a external buffer.
char * buffer_
Pointer to the raw buffer.