15#ifndef DAQDATAFORMATS_INCLUDE_DAQDATAFORMATS_FRAGMENT_HPP_
16#define DAQDATAFORMATS_INCLUDE_DAQDATAFORMATS_FRAGMENT_HPP_
51 explicit Fragment(
const std::vector<std::pair<void*, size_t>>& pieces);
156 return static_cast<void*
>(
header_() + 1);
164 other.m_alloc =
false;
170 other.m_alloc =
false;
188 std::accumulate(pieces.begin(), pieces.end(), 0ULL, [](
const size_t& a,
const std::pair<void*, size_t>& b) {
194 throw std::bad_alloc();
202 size_t offset =
sizeof(header);
203 for (
auto& piece : pieces) {
204 if (piece.first ==
nullptr) {
206 throw std::invalid_argument(
"The Fragment buffer points to NULL.");
208 memcpy(
static_cast<uint8_t*
>(
m_data_arr) +
offset, piece.first, piece.second);
224 auto header =
reinterpret_cast<FragmentHeader*
>(existing_fragment_buffer);
227 throw std::bad_alloc();
230 memcpy(
m_data_arr, existing_fragment_buffer, header->size);
246 *header_ptr = header;
247 header_ptr->
size = orig_size;
255 bits[
static_cast<size_t>(bit)] = value;
FELIX Initialization std::string initerror FELIX queue timed std::string queuename Unexpected chunk size