DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
dfmessages
include
dfmessages
TriggerRecordHeader_serialization.hpp
Go to the documentation of this file.
1
8
9
#ifndef DFMESSAGES_INCLUDE_DFMESSAGES_TRIGGERRECORDHEADER_SERIALIZATION_HPP_
10
#define DFMESSAGES_INCLUDE_DFMESSAGES_TRIGGERRECORDHEADER_SERIALIZATION_HPP_
11
12
#include "
daqdataformats/TriggerRecordHeader.hpp
"
13
#include "
serialization/Serialization.hpp
"
14
#include "
logging/Logging.hpp
"
// NOTE: if ISSUES ARE DECLARED BEFORE include logging/Logging.hpp, TLOG_DEBUG<<issue wont work.
15
16
#include <vector>
17
18
namespace
dunedaq
{
19
// Disable coverage collection LCOV_EXCL_START
20
ERS_DECLARE_ISSUE
(
dfmessages
,
21
CannotDeserializeTriggerRecordHeader,
22
"Cannot deserialize TriggerRecordHeader from JSON due to type mismatch"
, )
23
// Re-enable coverage collection LCOV_EXCL_STOP
24
}
// namespace dunedaq
25
26
// MsgPack serialization functions (which just put the raw bytes of
27
// the fragment array into a MsgPack message)
28
namespace
msgpack
{
29
MSGPACK_API_VERSION_NAMESPACE
(MSGPACK_DEFAULT_API_NS)
30
{
31
namespace
adaptor {
32
33
template
<>
34
struct
pack<dunedaq::daqdataformats::TriggerRecordHeader>
35
{
36
template
<
typename
Stream>
37
packer<Stream>& operator()(msgpack::packer<Stream>& o,
38
dunedaq::daqdataformats::TriggerRecordHeader
const
& trh)
const
39
{
40
size_t
size
= trh.
get_total_size_bytes
();
41
o.pack_bin(size);
// pack header and size
42
o.pack_bin_body(
static_cast<
const
char
*
>
(trh.
get_storage_location
()), size);
// pack payload
43
return
o;
44
}
45
};
46
47
// Typically we use convert<> for deserialization, but TriggerRecordHeader isn't
48
// default constructible, so we have to use as<>. See:
49
// https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_adaptor#non-default-constructible-class-support-c11-only-since-120
50
template
<>
51
struct
as<dunedaq::daqdataformats::TriggerRecordHeader>
52
{
53
dunedaq::daqdataformats::TriggerRecordHeader operator()(msgpack::object
const
& o)
const
54
{
55
return
dunedaq::daqdataformats::TriggerRecordHeader(
const_cast<
char
*
>
(o.via.bin.ptr),
true
);
56
}
57
};
58
59
}
// namespace adaptor
60
}
// namespace MSGPACK_DEFAULT_API_NS
61
}
// namespace msgpack
62
63
DUNE_DAQ_SERIALIZABLE
(
dunedaq::daqdataformats::TriggerRecordHeader
,
"TriggerRecordHeader"
);
64
65
#endif
// DFMESSAGES_INCLUDE_DFMESSAGES_TRIGGERRECORDHEADER_SERIALIZATION_HPP_
Serialization.hpp
DUNE_DAQ_SERIALIZABLE
#define DUNE_DAQ_SERIALIZABLE(Type, typestring)
Macro to define a type as serializable, so it can be sent over the network.
Definition
Serialization.hpp:47
TriggerRecordHeader.hpp
dunedaq::daqdataformats::TriggerRecordHeader
C++ representation of a TriggerRecordHeader, which wraps a flat array that is the TriggerRecordHeader...
Definition
TriggerRecordHeader.hpp:37
dunedaq::daqdataformats::TriggerRecordHeader::get_total_size_bytes
size_t get_total_size_bytes() const
Get the total size of the TriggerRecordHeader, including header and all component requests.
Definition
TriggerRecordHeader.hpp:111
dunedaq::daqdataformats::TriggerRecordHeader::get_storage_location
const void * get_storage_location() const
Get read-only access to the underlying flat data array.
Definition
TriggerRecordHeader.hpp:117
Logging.hpp
ERS_DECLARE_ISSUE
#define ERS_DECLARE_ISSUE( namespace_name, class_name, message_, attributes)
Definition
macro.hpp:65
dunedaq::dfmessages
Dataflow Messages.
Definition
DataRequest.hpp:21
dunedaq
Including Qt Headers.
Definition
module.cpp:16
dunedaq::size
FELIX Initialization std::string initerror FELIX queue timed std::string queuename Unexpected chunk size
Definition
FelixIssues.hpp:28
msgpack
Definition
serialize_variant.hpp:24
msgpack::MSGPACK_API_VERSION_NAMESPACE
MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
Definition
serialize_variant.hpp:25
Generated on
for DUNE-DAQ by
1.17.0