12bool GstreamerJsonFactory::publishEventDigitizedDataImpl(
const std::string& detectorName,
13 const std::vector<const GDigitizedData*>& digitizedData) {
14 if (!is_building_event) {
17 "publishEventDigitizedDataImpl called without an active event in GstreamerJsonFactory");
25 if (digitizedData.empty())
return true;
27 std::ostringstream entry;
28 entry <<
"\"" << jsonEscape(detectorName) <<
"\": [";
30 bool wrote_first_hit =
false;
31 for (
const auto* hit : digitizedData) {
34 if (wrote_first_hit) entry <<
", ";
35 wrote_first_hit =
true;
41 entry <<
"\"address\": \"" << jsonEscape(addr) <<
"\"";
43 entry <<
", \"vars\": {";
45 bool wrote_first_var =
false;
49 for (
const auto& [name, value] : hit->getIntObservablesMap(0)) {
50 if (wrote_first_var) entry <<
", ";
51 wrote_first_var =
true;
52 entry <<
"\"" << jsonEscape(name) <<
"\": " << value;
56 for (
const auto& [name, value] : hit->getDblObservablesMap(0)) {
57 if (wrote_first_var) entry <<
", ";
58 wrote_first_var =
true;
59 entry <<
"\"" << jsonEscape(name) <<
"\": " << value;
68 current_event_digitized_entries.push_back(entry.str());
std::shared_ptr< GLogger > log
std::string getIdentityString(std::vector< GIdentifier > gidentity)
Shared constants and error codes for the gstreamer module.
JSON streamer plugin declarations.
constexpr int ERR_PUBLISH_ERROR
Publish sequence encountered invalid state or invalid input data.