15 #ifndef _FASTCDR_CDRBUFFER_H_ 16 #define _FASTCDR_CDRBUFFER_H_ 18 #include "fastcdr_dll.h" 25 inline uint32_t size_to_uint32(
28 #if defined(_WIN32) || !defined(FASTCDR_ARM32) 30 return static_cast<uint32_t
>(val);
34 #endif // if defined(_WIN32) || !defined(FASTCDR_ARM32) 62 , current_position_(&buffer_[index])
76 ptrdiff_t diff = current_position_ - buffer_;
77 buffer_ = iterator.buffer_;
78 current_position_ = buffer_ + diff;
90 ptrdiff_t diff = iterator.current_position_ - iterator.buffer_;
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;
179 return static_cast<size_t>(current_position_ - it.current_position_);
213 return current_position_;
219 return other_iterator.current_position_ == 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)
274 std::swap(buffer_, fbuffer.buffer_);
275 std::swap(size_, fbuffer.size_);
276 std::swap(m_internalBuffer, fbuffer.m_internalBuffer);
283 std::swap(buffer_, fbuffer.buffer_);
284 std::swap(size_, fbuffer.size_);
285 std::swap(m_internalBuffer, fbuffer.m_internalBuffer);
319 return (iterator(buffer_, 0));
329 return (iterator(buffer_, size_));
346 size_t min_size_inc);
357 char* buffer_ {
nullptr };
363 bool m_internalBuffer {
true };
368 #endif // _FASTCDR_FASTCDRBUFFER_H_ iterator begin()
This function returns a iterator that points to the begining of the stream.
Definition: FastBuffer.h:317
_FastBuffer_iterator iterator
Definition: FastBuffer.h:247
void rmemcopy(void *dst, const size_t size)
This function copies from the raw buffer to a external buffer.
Definition: FastBuffer.h:142
Definition: fixed_size_string.hpp:32
This class represents a stream of bytes that contains (or will contain) serialized data...
Definition: FastBuffer.h:243
This class implements the iterator used to go through a FastBuffer.
Definition: FastBuffer.h:42
size_t getBufferSize() const
This function returns the size of the allocated memory of the stream that the eprosima::fastcdr::Fast...
Definition: FastBuffer.h:307
iterator end()
This function returns a iterator that points to the end of the stream.
Definition: FastBuffer.h:327
_FastBuffer_iterator(char *buffer, size_t index)
Constructor.
Definition: FastBuffer.h:58
FastBuffer(FastBuffer &&fbuffer)
Move constructor.
Definition: FastBuffer.h:268
char * getBuffer() const
This function returns the stream that the eprosima::fastcdr::FastBuffers uses to serialize data...
Definition: FastBuffer.h:298
void memcopy(const void *src, const size_t size)
This function copies a buffer into the raw buffer.
Definition: FastBuffer.h:126