13#ifndef DAQDATAFORMATS_INCLUDE_DAQDATAFORMATS_FRAGMENT_HPP_
14#define DAQDATAFORMATS_INCLUDE_DAQDATAFORMATS_FRAGMENT_HPP_
54 inline explicit Fragment(
const std::vector<std::pair<void*, size_t>>& pieces);
73 other.m_alloc =
false;
79 other.m_alloc =
false;
257 return static_cast<void*
>(
header_() + 1);
276 std::accumulate(pieces.begin(), pieces.end(), 0ULL, [](
const size_t& a,
const std::pair<void*, size_t>& b) { return a + b.second; });
279 throw std::length_error(
"The Fragment size is smaller than the Fragment header size.");
284 throw std::bad_alloc();
293 for (
auto& piece : pieces) {
294 if (piece.first ==
nullptr) {
295 throw std::invalid_argument(
"The Fragment buffer point to NULL.");
297 memcpy(
static_cast<uint8_t*
>(
m_data_arr) +
offset, piece.first, piece.second);
314 auto header =
reinterpret_cast<FragmentHeader*
>(existing_fragment_buffer);
317 throw std::bad_alloc();
320 memcpy(
m_data_arr, existing_fragment_buffer, header->size);
350 bits[
static_cast<size_t>(bit)] = value;
FELIX Initialization std::string initerror FELIX queue timed std::string queuename Unexpected chunk size