9 #ifndef STATIC_MSG_BUFFER_H_INCLUDED
10 #define STATIC_MSG_BUFFER_H_INCLUDED
29 typedef storage_type::data_type data_type;
30 typedef storage_type::s_pointer s_pointer;
31 typedef storage_type::w_pointer w_pointer;
33 typedef data_type* pointer;
34 typedef const data_type* const_pointer;
129 std::fill(m_pData, m_pData +
size(), 0);
140 void assign(const_pointer pBuffer,
size_t n)
142 m_pData =
const_cast<pointer
>(pBuffer);
168 m_offset = new_offset;
183 template <
typename T>
184 size_t get_data(T& value, std::ptrdiff_t pos)
const
193 std::ptrdiff_t total_offset =
offset() + pos;
196 size_t bytes_read = 0;
197 if ( total_offset >= 0
198 && total_offset +
sizeof(value) <=
size())
201 storage_type::read(
data(),
241 size_t total_offset =
static_cast<size_t>(
offset()) + pos;
244 size_t bytes_read = 0;
245 size_t total_size = this->
size();
246 if ( (total_offset >= 0)
247 && (total_offset + length) <= total_size)
250 storage_type::read(
data(),
273 template <
typename T>
283 size_t total_offset =
static_cast<size_t>(
offset()) + pos;
286 size_t bytes_written = 0;
287 size_t total_size =
size();
288 if ( (total_offset >= 0)
292 storage_type::write ( raw_data(),
300 return bytes_written;
324 template <
typename InputIt>
325 size_t set_range(InputIt first, InputIt last,
size_t pos)
340 size_t total_offset =
static_cast<size_t>(
offset()) + pos;
341 size_t range_size = std::distance(first, last);
344 size_t bytes_written = 0;
345 size_t total_size =
size();
346 if ( (total_offset >= 0)
347 && (total_offset + range_size) <= total_size)
350 storage_type::write ( raw_data(),
358 return bytes_written;
366 std::ptrdiff_t m_offset;
382 template<
typename T>