gstreamer
Loading...
Searching...
No Matches
eventHeader.cc
Go to the documentation of this file.
1// gstreamer
4
5// Implementation summary:
6// Append the event header fields to the JSON event object currently under construction.
7
8bool GstreamerJsonFactory::publishEventHeaderImpl(const std::unique_ptr<GEventHeader>& gevent_header) {
9 if (!is_building_event) {
10 log->error(ERR_PUBLISH_ERROR, "publishEventHeaderImpl called without an active event in GstreamerJsonFactory");
11 return false;
12 }
13 if (!gevent_header) {
14 log->error(ERR_PUBLISH_ERROR, "gevent_header is null in GstreamerJsonFactory::publishEventHeaderImpl");
15 return false;
16 }
17
18 // Cache selected values because other publish steps may use them for diagnostics
19 // or schema shaping.
20 timestamp = gevent_header->getTimeStamp();
21 thread_id = gevent_header->getThreadID();
22
23 // startEventImpl() already emitted:
24 // { "event_number": ..., "header": {
25 // so this method only appends the header fields themselves.
26 current_event << "\"timestamp\": \"" << jsonEscape(timestamp) << "\""
27 << ", \"thread_id\": " << thread_id
28 << ", \"g4local_event\": " << gevent_header->getG4LocalEvn();
29
30 current_event_has_header = true;
31 return true;
32}
std::shared_ptr< GLogger > log
void error(int exit_code, Args &&... args) const
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.