12bool GstreamerJsonFactory::publishEventDigitizedDataImpl(
const std::string& detectorName,
13 const std::vector<const GDigitizedData*>& digitizedData) {
14 if (!is_building_event) {
16 ERR_PUBLISH_ERROR,
"publishEventDigitizedDataImpl called without an active event in GstreamerJsonFactory");
24 if (digitizedData.empty())
return true;
26 std::ostringstream entry;
27 entry <<
"\"" << jsonEscape(detectorName) <<
"\": [";
29 bool wrote_first_hit =
false;
30 for (
const auto* hit : digitizedData) {
33 if (wrote_first_hit) entry <<
", ";
34 wrote_first_hit =
true;
40 entry <<
"\"address\": \"" << jsonEscape(addr) <<
"\"";
42 entry <<
", \"vars\": {";
44 bool wrote_first_var =
false;
48 for (
const auto& [name, value] : hit->getIntObservablesMap(0)) {
49 if (wrote_first_var) entry <<
", ";
50 wrote_first_var =
true;
51 entry <<
"\"" << jsonEscape(name) <<
"\": " << value;
55 for (
const auto& [name, value] : hit->getDblObservablesMap(0)) {
56 if (wrote_first_var) entry <<
", ";
57 wrote_first_var =
true;
58 entry <<
"\"" << jsonEscape(name) <<
"\": " << value;
67 current_event_digitized_entries.push_back(entry.str());
std::shared_ptr< GLogger > log
void error(int exit_code, Args &&... args) const
std::string getIdentityString(std::vector< GIdentifier > gidentity)
Shared constants and error codes for the gstreamer module.
#define ERR_PUBLISH_ERROR
Publish sequence encountered invalid state or invalid input data.
JSON streamer plugin declarations.