1 #include "artdaq-core/Data/Fragment.hh"
2 #include "artdaq-core/Data/detail/RawFragmentHeader.hh"
4 #define BOOST_TEST_MODULE(Fragment_t)
5 #include "cetlib/quiet_unit_test.hpp"
39 BOOST_AUTO_TEST_SUITE(Fragment_test)
41 BOOST_AUTO_TEST_CASE(Construct)
47 BOOST_REQUIRE_EQUAL(f1.
dataSize(), (size_t)0);
56 BOOST_REQUIRE_EQUAL(f2.dataSize(), (size_t)7);
62 BOOST_REQUIRE_EQUAL(f2.hasMetadata(),
false);
65 BOOST_REQUIRE_EQUAL(f3.dataSize(), (size_t)0);
71 BOOST_REQUIRE_EQUAL(f3.hasMetadata(),
false);
78 BOOST_REQUIRE(0 &&
"Should have thrown exception");
80 catch (cet::exception
const& excpt) { }
83 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
89 BOOST_REQUIRE(0 &&
"Should have thrown exception");
91 catch (cet::exception
const& excpt) { }
94 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
100 BOOST_REQUIRE(0 &&
"Should have thrown exception");
102 catch (cet::exception
const& excpt) { }
105 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
111 BOOST_REQUIRE(0 &&
"Should have thrown exception");
113 catch (cet::exception
const& excpt) { }
116 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
123 BOOST_REQUIRE(0 &&
"Should have thrown exception");
125 catch (cet::exception
const& excpt) { }
128 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
135 BOOST_REQUIRE(0 &&
"Should have thrown exception");
137 catch (cet::exception
const& excpt) { }
140 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
158 BOOST_REQUIRE(0 &&
"Should not have thrown exception");
162 BOOST_AUTO_TEST_CASE(FragmentType)
170 BOOST_REQUIRE(0 &&
"Should have thrown exception");
172 catch (cet::exception
const& excpt) { }
175 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
180 frag.setUserType(225);
181 BOOST_REQUIRE(0 &&
"Should have thrown exception");
183 catch (cet::exception
const& excpt) { }
186 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
191 frag.setUserType(255);
192 BOOST_REQUIRE(0 &&
"Should have thrown exception");
194 catch (cet::exception
const& excpt) { }
197 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
203 BOOST_REQUIRE(0 &&
"Should have thrown exception");
205 catch (cet::exception
const& excpt) { }
208 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
214 BOOST_REQUIRE(0 &&
"Should have thrown exception");
216 catch (cet::exception
const& excpt) { }
219 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
225 BOOST_REQUIRE(0 &&
"Should have thrown exception");
227 catch (cet::exception
const& excpt) { }
230 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
240 frag.setUserType(100);
241 frag.setUserType(200);
242 frag.setUserType(224);
246 BOOST_REQUIRE(0 &&
"Should not have thrown exception");
252 frag.setSystemType(0);
253 BOOST_REQUIRE(0 &&
"Should have thrown exception");
255 catch (cet::exception
const& excpt) { }
258 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
263 frag.setSystemType(1);
264 BOOST_REQUIRE(0 &&
"Should have thrown exception");
266 catch (cet::exception
const& excpt) { }
269 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
274 frag.setSystemType(224);
275 BOOST_REQUIRE(0 &&
"Should have thrown exception");
277 catch (cet::exception
const& excpt) { }
280 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
286 BOOST_REQUIRE(0 &&
"Should have thrown exception");
288 catch (cet::exception
const& excpt) { }
291 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
297 BOOST_REQUIRE(0 &&
"Should have thrown exception");
299 catch (cet::exception
const& excpt) { }
302 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
308 BOOST_REQUIRE(0 &&
"Should have thrown exception");
310 catch (cet::exception
const& excpt) { }
313 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
320 frag.setSystemType(225);
321 frag.setSystemType(230);
322 frag.setSystemType(240);
323 frag.setSystemType(250);
324 frag.setSystemType(255);
328 BOOST_REQUIRE(0 &&
"Should not have thrown exception");
332 BOOST_AUTO_TEST_CASE(SequenceID)
336 BOOST_REQUIRE_EQUAL(f1.
sequenceID(), (uint64_t)0);
338 BOOST_REQUIRE_EQUAL(f1.
sequenceID(), (uint64_t)1);
340 BOOST_REQUIRE_EQUAL(f1.
sequenceID(), (uint64_t)0xffff);
342 BOOST_REQUIRE_EQUAL(f1.
sequenceID(), (uint64_t)0x0000ffffffffffff);
345 BOOST_REQUIRE_EQUAL(f2.sequenceID(), (uint64_t)0x12345);
348 BOOST_REQUIRE_EQUAL(f3.sequenceID(), (uint64_t)0x0000567812345678);
351 BOOST_AUTO_TEST_CASE(FragmentID)
355 BOOST_REQUIRE_EQUAL(f1.
fragmentID(), (uint16_t)0);
357 BOOST_REQUIRE_EQUAL(f1.
fragmentID(), (uint16_t)1);
359 BOOST_REQUIRE_EQUAL(f1.
fragmentID(), (uint16_t)0xffff);
362 BOOST_REQUIRE_EQUAL(f2.fragmentID(), (uint16_t)0xab);
365 BOOST_REQUIRE_EQUAL(f3.fragmentID(), (uint16_t)0xffff);
368 BOOST_AUTO_TEST_CASE(Resize)
373 BOOST_REQUIRE_EQUAL(f1.
dataSize(), (size_t)1234);
374 BOOST_REQUIRE_EQUAL(f1.
size(), (size_t)1234 +
381 BOOST_REQUIRE_EQUAL(f2.dataSize(), (size_t)129);
382 BOOST_REQUIRE_EQUAL(f2.size(), (size_t)129 + 2 +
386 BOOST_AUTO_TEST_CASE(Empty)
389 BOOST_REQUIRE_EQUAL(f1.
empty(),
true);
391 BOOST_REQUIRE_EQUAL(f1.
empty(),
false);
395 BOOST_REQUIRE_EQUAL(f2.empty(),
false);
397 BOOST_REQUIRE_EQUAL(f2.empty(),
false);
399 BOOST_REQUIRE_EQUAL(f2.empty(),
true);
400 BOOST_REQUIRE_EQUAL(f2.dataSize(), (size_t)0);
401 BOOST_REQUIRE_EQUAL(f2.size(), (size_t)2 +
405 BOOST_REQUIRE_EQUAL(f3.empty(),
true);
407 BOOST_REQUIRE_EQUAL(f3.empty(),
true);
410 BOOST_REQUIRE_EQUAL(f4.empty(),
false);
411 f4.setMetadata(mdOneA);
412 BOOST_REQUIRE_EQUAL(f4.empty(),
false);
415 BOOST_AUTO_TEST_CASE(Clear)
418 BOOST_REQUIRE_EQUAL(f1.
empty(),
true);
420 BOOST_REQUIRE_EQUAL(f1.
empty(),
false);
422 BOOST_REQUIRE_EQUAL(f1.
empty(),
true);
426 BOOST_REQUIRE_EQUAL(f2.empty(),
false);
428 BOOST_REQUIRE_EQUAL(f2.empty(),
false);
430 BOOST_REQUIRE_EQUAL(f2.empty(),
true);
431 BOOST_REQUIRE_EQUAL(f2.dataSize(), (size_t)0);
432 BOOST_REQUIRE_EQUAL(f2.size(), (size_t)2 +
436 BOOST_REQUIRE_EQUAL(f3.empty(),
true);
437 BOOST_REQUIRE_EQUAL(f3.hasMetadata(),
false);
439 BOOST_REQUIRE_EQUAL(f3.empty(),
true);
440 BOOST_REQUIRE_EQUAL(f3.hasMetadata(),
true);
442 BOOST_REQUIRE_EQUAL(f3.empty(),
true);
443 BOOST_REQUIRE_EQUAL(f3.hasMetadata(),
true);
446 BOOST_REQUIRE_EQUAL(f4.empty(),
false);
447 BOOST_REQUIRE_EQUAL(f4.hasMetadata(),
false);
448 f4.setMetadata(mdOneA);
449 BOOST_REQUIRE_EQUAL(f4.empty(),
false);
450 BOOST_REQUIRE_EQUAL(f4.hasMetadata(),
true);
452 BOOST_REQUIRE_EQUAL(f4.empty(),
true);
453 BOOST_REQUIRE_EQUAL(f4.hasMetadata(),
true);
456 BOOST_AUTO_TEST_CASE(Addresses)
460 BOOST_REQUIRE_EQUAL(f1.
dataSize(), (size_t)200);
461 BOOST_REQUIRE_EQUAL(f1.
size(), (size_t)200 +
465 BOOST_REQUIRE_EQUAL(daddr,
470 BOOST_REQUIRE(0 &&
"Should have thrown exception");
472 catch (cet::exception
const& excpt) { }
475 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
477 BOOST_REQUIRE_EQUAL(haddr, &(*(f1.
headerBegin())));
478 BOOST_REQUIRE_EQUAL(daddr, &(*(f1.
dataBegin())));
479 BOOST_REQUIRE_EQUAL(daddr + 200, &(*(f1.
dataEnd())));
484 BOOST_REQUIRE_EQUAL(f2.dataSize(), (size_t)135);
485 BOOST_REQUIRE_EQUAL(f2.size(), (size_t)135 + 2 +
487 haddr = f2.headerAddress();
488 daddr = f2.dataAddress();
490 BOOST_REQUIRE_EQUAL(maddr, haddr +
492 BOOST_REQUIRE_EQUAL(daddr, maddr + 2);
493 BOOST_REQUIRE_EQUAL(haddr, &(*(f2.headerBegin())));
494 BOOST_REQUIRE_EQUAL(daddr, &(*(f2.dataBegin())));
495 BOOST_REQUIRE_EQUAL(daddr + 135, &(*(f2.dataEnd())));
500 BOOST_REQUIRE_EQUAL(f3.dataSize(), (size_t)77);
501 BOOST_REQUIRE_EQUAL(f3.size(), (size_t)77 + 4 +
503 haddr = f3.headerAddress();
504 daddr = f3.dataAddress();
505 maddr = f3.metadataAddress();
506 BOOST_REQUIRE_EQUAL(maddr, haddr +
508 BOOST_REQUIRE_EQUAL(daddr, maddr + 4);
509 BOOST_REQUIRE_EQUAL(haddr, &(*(f3.headerBegin())));
510 BOOST_REQUIRE_EQUAL(daddr, &(*(f3.dataBegin())));
511 BOOST_REQUIRE_EQUAL(daddr + 77, &(*(f3.dataEnd())));
514 BOOST_AUTO_TEST_CASE(Metadata)
521 BOOST_REQUIRE(0 &&
"Should have thrown exception");
523 catch (cet::exception
const& excpt) { }
526 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
537 BOOST_REQUIRE(0 &&
"Should have thrown exception");
539 catch (cet::exception
const& excpt) { }
542 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
548 BOOST_REQUIRE_EQUAL(mdOnePtr->
field1, (uint64_t)5);
549 BOOST_REQUIRE_EQUAL(mdOnePtr->
field2, (uint32_t)10);
550 BOOST_REQUIRE_EQUAL(mdOnePtr->
field3, (uint32_t)15);
556 BOOST_REQUIRE(0 &&
"Should have thrown exception");
558 catch (cet::exception
const& excpt) { }
561 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
576 BOOST_REQUIRE(0 &&
"Should have thrown exception");
578 catch (cet::exception
const& excpt) { }
581 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
586 BOOST_REQUIRE_EQUAL(mdTwoPtr->
field1, (uint64_t)10);
587 BOOST_REQUIRE_EQUAL(mdTwoPtr->
field2, (uint32_t)20);
588 BOOST_REQUIRE_EQUAL(mdTwoPtr->
field3, (uint32_t)30);
589 BOOST_REQUIRE_EQUAL(mdTwoPtr->
field4, (uint32_t)40);
590 BOOST_REQUIRE_EQUAL(mdTwoPtr->
field5, (uint32_t)50);
593 BOOST_REQUIRE_EQUAL(f3.sequenceID(), (uint32_t)0xabcdef);
594 BOOST_REQUIRE_EQUAL(f3.fragmentID(), (uint16_t)0xc3a5);
595 BOOST_REQUIRE_EQUAL(f3.type(), (uint16_t)123);
597 BOOST_REQUIRE_EQUAL(f3.sequenceID(), (uint32_t)0xabcdef);
598 BOOST_REQUIRE_EQUAL(f3.fragmentID(), (uint16_t)0xc3a5);
599 BOOST_REQUIRE_EQUAL(f3.type(), (uint8_t)123);
601 dataPtr[0] = 0x12345678;
603 dataPtr[2] = 0x456789ab;
604 dataPtr[3] = 0x3c3c3c3c;
605 dataPtr[4] = 0x5a5a5a5a;
606 BOOST_REQUIRE_EQUAL(dataPtr[0], (uint64_t)0x12345678);
607 BOOST_REQUIRE_EQUAL(dataPtr[1], (uint64_t)0xabcd);
608 BOOST_REQUIRE_EQUAL(dataPtr[2], (uint64_t)0x456789ab);
609 BOOST_REQUIRE_EQUAL(dataPtr[3], (uint64_t)0x3c3c3c3c);
610 BOOST_REQUIRE_EQUAL(dataPtr[4], (uint64_t)0x5a5a5a5a);
611 BOOST_REQUIRE_EQUAL(f3.sequenceID(), (uint32_t)0xabcdef);
612 BOOST_REQUIRE_EQUAL(f3.fragmentID(), (uint16_t)0xc3a5);
613 BOOST_REQUIRE_EQUAL(f3.type(), (uint8_t)123);
618 f3.setMetadata(mdOneC);
620 BOOST_REQUIRE_EQUAL(mdOnePtr->
field1, (uint64_t)505);
621 BOOST_REQUIRE_EQUAL(mdOnePtr->
field2, (uint32_t)510);
622 BOOST_REQUIRE_EQUAL(mdOnePtr->
field3, (uint32_t)515);
623 BOOST_REQUIRE_EQUAL(f3.sequenceID(), (uint32_t)0xabcdef);
624 BOOST_REQUIRE_EQUAL(f3.fragmentID(), (uint16_t)0xc3a5);
625 BOOST_REQUIRE_EQUAL(f3.type(), (uint8_t)123);
626 dataPtr = f3.dataAddress();
627 dataPtr[0] = 0x12345678;
629 dataPtr[2] = 0x456789ab;
630 dataPtr[3] = 0x3c3c3c3c;
631 dataPtr[4] = 0x5a5a5a5a;
632 BOOST_REQUIRE_EQUAL(dataPtr[0], (uint64_t)0x12345678);
633 BOOST_REQUIRE_EQUAL(dataPtr[1], (uint64_t)0xabcd);
634 BOOST_REQUIRE_EQUAL(dataPtr[2], (uint64_t)0x456789ab);
635 BOOST_REQUIRE_EQUAL(dataPtr[3], (uint64_t)0x3c3c3c3c);
636 BOOST_REQUIRE_EQUAL(dataPtr[4], (uint64_t)0x5a5a5a5a);
640 BOOST_REQUIRE_EQUAL(f4.hasMetadata(),
false);
643 f4.setMetadata(mdHuge);
644 BOOST_REQUIRE(0 &&
"Should have thrown exception");
646 catch (cet::exception
const& excpt) { }
649 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
655 BOOST_REQUIRE(0 &&
"Should have thrown exception");
657 catch (cet::exception
const& excpt) { }
660 BOOST_REQUIRE(0 &&
"Should have thrown cet::exception");
668 BOOST_AUTO_TEST_CASE(Bytes)
670 std::size_t payload_size = 5;
687 Metadata theMetadata;
703 BOOST_REQUIRE(f1->
size() == f1_factory->size());
704 BOOST_REQUIRE(f1->
sizeBytes() == f1_factory->sizeBytes());
706 std::unique_ptr<artdaq::Fragment> f2(
new artdaq::Fragment(payload_size, seqID, fragID, type, theMetadata));
712 BOOST_REQUIRE(f2->size() == f2_factory->size());
713 BOOST_REQUIRE(f2->sizeBytes() == f2_factory->sizeBytes());
718 std::size_t offset = 3;
724 BOOST_REQUIRE(f3_factory->size() == f2->size());
725 BOOST_REQUIRE(f3_factory->sizeBytes() == f2->sizeBytes());
732 &*f3_factory->dataBegin());
738 BOOST_REQUIRE_EQUAL(ptr1, ptr2);
739 BOOST_REQUIRE_EQUAL(ptr2, ptr3);
743 BOOST_REQUIRE(f3_factory->dataBeginBytes() -
745 &*f3_factory->headerBegin())
749 BOOST_REQUIRE(static_cast<std::size_t>(f3_factory->dataEndBytes() - f3_factory->dataBeginBytes()) == f3_factory->dataSizeBytes());
753 BOOST_REQUIRE_EQUAL(f4.dataSize(), payload_size);
755 f4.resize(payload_size + 1);
756 BOOST_REQUIRE_EQUAL(f4.dataSize(), (payload_size + 1));
757 BOOST_REQUIRE_EQUAL(f4.dataSizeBytes(), ((payload_size + 1) *
sizeof(
artdaq::RawDataType)));
758 f4.resizeBytes(f4.dataSizeBytes() + 2);
759 BOOST_REQUIRE_EQUAL(f4.dataSize(), (payload_size + 2));
760 BOOST_REQUIRE_EQUAL(f4.dataSizeBytes(), ((payload_size + 2) *
sizeof(
artdaq::RawDataType)));
761 f4.resizeBytes(f4.dataSizeBytes() + 1);
762 BOOST_REQUIRE_EQUAL(f4.dataSize(), (payload_size + 3));
763 BOOST_REQUIRE_EQUAL(f4.dataSizeBytes(), ((payload_size + 3) *
sizeof(
artdaq::RawDataType)));
764 f4.resizeBytes(f4.dataSizeBytes() + 1);
765 BOOST_REQUIRE_EQUAL(f4.dataSize(), (payload_size + 4));
766 BOOST_REQUIRE_EQUAL(f4.dataSizeBytes(), ((payload_size + 4) *
sizeof(
artdaq::RawDataType)));
770 f4.resizeBytes(targetSize);
771 BOOST_REQUIRE_EQUAL(f4.dataSize(), (payload_size + 5));
772 BOOST_REQUIRE_EQUAL(f4.dataSizeBytes(), ((payload_size + 5) *
sizeof(
artdaq::RawDataType)));
774 f4.resizeBytes(targetSize);
775 BOOST_REQUIRE_EQUAL(f4.dataSize(), (payload_size + 5));
776 BOOST_REQUIRE_EQUAL(f4.dataSizeBytes(), ((payload_size + 5) *
sizeof(
artdaq::RawDataType)));
778 f4.resizeBytes(targetSize);
779 BOOST_REQUIRE_EQUAL(f4.dataSize(), (payload_size + 5));
780 BOOST_REQUIRE_EQUAL(f4.dataSizeBytes(), ((payload_size + 5) *
sizeof(
artdaq::RawDataType)));
782 f4.resizeBytes(targetSize);
783 BOOST_REQUIRE_EQUAL(f4.dataSize(), (payload_size + 5));
784 BOOST_REQUIRE_EQUAL(f4.dataSizeBytes(), ((payload_size + 5) *
sizeof(
artdaq::RawDataType)));
786 f4.resizeBytes(targetSize);
787 BOOST_REQUIRE_EQUAL(f4.dataSize(), (payload_size + 5));
788 BOOST_REQUIRE_EQUAL(f4.dataSizeBytes(), ((payload_size + 5) *
sizeof(
artdaq::RawDataType)));
790 f4.resizeBytes(targetSize);
791 BOOST_REQUIRE_EQUAL(f4.dataSize(), (payload_size + 5));
792 BOOST_REQUIRE_EQUAL(f4.dataSizeBytes(), ((payload_size + 5) *
sizeof(
artdaq::RawDataType)));
794 f4.resizeBytes(targetSize);
795 BOOST_REQUIRE_EQUAL(f4.dataSize(), (payload_size + 5));
796 BOOST_REQUIRE_EQUAL(f4.dataSizeBytes(), ((payload_size + 5) *
sizeof(
artdaq::RawDataType)));
798 f4.resizeBytes(targetSize);
799 BOOST_REQUIRE_EQUAL(f4.dataSize(), (payload_size + 5));
800 BOOST_REQUIRE_EQUAL(f4.dataSizeBytes(), ((payload_size + 5) *
sizeof(
artdaq::RawDataType)));
802 f4.resizeBytes(targetSize);
803 BOOST_REQUIRE_EQUAL(f4.dataSize(), (payload_size + 6));
804 BOOST_REQUIRE_EQUAL(f4.dataSizeBytes(), ((payload_size + 6) *
sizeof(
artdaq::RawDataType)));
810 f5.setMetadata(theMetadata);
811 BOOST_REQUIRE_EQUAL(f5.dataSize(), payload_size);
817 BOOST_AUTO_TEST_SUITE_END()
static constexpr type_t InvalidFragmentType
Copy InvalidFragmentType from RawFragmentHeader.
void setSequenceID(sequence_id_t sequence_id)
Sets the Sequence ID of the Fragment.
std::size_t size() const
Gets the size of the Fragment, from the Fragment header.
void updateMetadata(const T &md)
Updates existing metadata with a new metadata object.
detail::RawFragmentHeader::fragment_id_t fragment_id_t
typedef for fragment_id_t from RawFragmentHeader
std::size_t sizeBytes() const
Size of vals_ vector ( header + (optional) metadata + payload) in bytes.
detail::RawFragmentHeader::type_t type_t
typedef for type_t from RawFragmentHeader
sequence_id_t sequenceID() const
Sequence ID of the Fragment, from the Fragment header.
static constexpr type_t DataFragmentType
Copy DataFragmentType from RawFragmentHeader.
uint8_t byte_t
For byte representation.
void resize(std::size_t sz)
Resize the data payload to hold sz RawDataType words.
static constexpr fragment_id_t InvalidFragmentID
Copy InvalidFragmentID from RawFragmentHeader.
detail::RawFragmentHeader::version_t version_t
typedef for version_t from RawFragmentHeader
iterator headerBegin()
Return an iterator to the beginning of the header (should be used for serialization only: use setters...
iterator dataBegin()
Return an iterator to the beginning of the data payload (after header and metadata) ...
bool empty()
Determines if the Fragment contains no data.
static constexpr sequence_id_t InvalidSequenceID
Copy InvalidSequenceID from RawFragmentHeader.
void setMetadata(const T &md)
Set the metadata in the Fragment to the contents of the specified structure. This throws an exception...
type_t type() const
Type of the Fragment, from the Fragment header.
RawDataType * dataAddress()
Returns a RawDataType pointer to the beginning of the payload.
T * metadata()
Return a pointer to the metadata. This throws an exception if the Fragment contains no metadata...
iterator dataEnd()
Return an iterator to the end of the data payload.
static FragmentPtr FragmentBytes(std::size_t nbytes)
Create a Fragment using a static factory function rather than a constructor to allow for the function...
detail::RawFragmentHeader::RawDataType RawDataType
The RawDataType (currently a 64-bit integer) is the basic unit of data representation within artdaq ...
RawDataType * metadataAddress()
Get the address of the metadata. For internal use only, use metadata() instead.
void clear()
Removes all elements from the payload section of the Fragment.
bool hasMetadata() const
Test whether this Fragment has metadata.
void setFragmentID(fragment_id_t fragment_id)
Sets the Fragment ID of the Fragment.
A Fragment contains the data from one piece of the DAQ system for one event The artdaq::Fragment is t...
std::size_t dataSize() const
Return the number of RawDataType words in the data payload. This does not include the number of words...
detail::RawFragmentHeader::sequence_id_t sequence_id_t
typedef for sequence_id_t from RawFragmentHeader
fragment_id_t fragmentID() const
Fragment ID of the Fragment, from the Fragment header.
RawDataType * headerAddress()
Gets the address of the header.
version_t version() const
Version of the Fragment, from the Fragment header.