gstreamer
Loading...
Searching...
No Matches
GstreamerJsonFactory Class Reference

Writes gstreamer output to a JSON file. More...

#include <gstreamerJSONFactory.h>

Public Member Functions

 GstreamerJsonFactory (const GstreamerJsonFactory &)=delete
 One instance per thread: forbid copy/move to prevent accidental sharing of output streams.
 
GstreamerJsonFactoryoperator= (const GstreamerJsonFactory &)=delete
 
 GstreamerJsonFactory (GstreamerJsonFactory &&)=delete
 
GstreamerJsonFactoryoperator= (GstreamerJsonFactory &&)=delete
 
 GStreamer (const std::shared_ptr< GOptions > &g)
 Inherit the base constructor: GStreamer(const std::shared_ptr<GOptions>&).
 
- Public Member Functions inherited from GStreamer
 GStreamer (const std::shared_ptr< GOptions > &g)
 Construct a streamer and bind it to module logging.
 
virtual ~GStreamer ()=default
 Virtual destructor.
 
bool closeConnection ()
 Close the output medium after flushing any buffered events.
 
void publishEventData (const std::shared_ptr< GEventDataCollection > &event_data)
 Buffer an event for later serialization.
 
std::string getStreamType () const
 Return the semantic stream type for this streamer.
 
void define_gstreamer (const GStreamerDefinition &gstreamerDefinition, int tid=-1)
 Assign the output definition used by this streamer instance.
 
void set_loggers (const std::shared_ptr< GOptions > &g)
 Configure streamer settings derived from options.
 
- Public Member Functions inherited from GBase< GStreamer >
 GBase (const std::shared_ptr< GOptions > &gopt, std::string logger_name="")
 
 GBase (const std::shared_ptr< GLogger > &logger)
 
 GBase (const GBase &)=default
 
 GBase (GBase &&) noexcept=default
 
virtual ~GBase ()
 
GBaseoperator= (const GBase &)=default
 
GBaseoperator= (GBase &&) noexcept=default
 

Additional Inherited Members

- Static Public Member Functions inherited from GStreamer
static const std::vector< std::string > & supported_formats ()
 Return the list of supported output formats.
 
static bool is_valid_format (const std::string &format)
 Check whether a format token is supported.
 
static GStreamerinstantiate (const dlhandle h, std::shared_ptr< GOptions > g)
 Instantiate a streamer plugin by resolving the GStreamerFactory symbol from a dynamic library.
 
- Protected Member Functions inherited from GStreamer
bool startEvent (const std::shared_ptr< GEventDataCollection > &event_data)
 Begin an event publish sequence.
 
bool publishEventHeader (const std::unique_ptr< GEventHeader > &gevent_header)
 Publish the event header.
 
bool publishEventTrueInfoData (const std::string &detectorName, const std::vector< const GTrueInfoData * > &trueInfoData)
 Publish true (MC) information hits for one detector.
 
bool publishEventDigitizedData (const std::string &detectorName, const std::vector< const GDigitizedData * > &digitizedData)
 Publish digitized hits for one detector.
 
bool endEvent (const std::shared_ptr< GEventDataCollection > &event_data)
 End an event publish sequence.
 
bool startStream (const GFrameDataCollection *frameRunData)
 Begin a frame stream publish sequence.
 
bool publishFrameHeader (const GFrameHeader *gframeHeader)
 Publish a frame header.
 
bool publishPayload (const std::vector< GIntegralPayload * > *payload)
 Publish a frame payload.
 
bool endStream (const GFrameDataCollection *frameRunData)
 End a frame stream publish sequence.
 
void flushEventBuffer ()
 Flush the internal event buffer, writing all buffered events to the output medium.
 
- Protected Attributes inherited from GStreamer
GStreamerDefinition gstreamer_definitions
 Output definition used by this streamer (format, base name, type, thread id).
 
- Protected Attributes inherited from GBase< GStreamer >
std::shared_ptr< GLoggerlog
 

Detailed Description

This factory writes either:

  • event streams: a JSON object containing an "events" array
  • frame streams: a JSON object containing a "frames" array

The top-level structure is always a single JSON object:

{
"type": "event",
"events": [
{ ... event 1 ... },
{ ... event 2 ... }
]
}
Note
The gstreamer core publishes event data in this order:
  • startEventImpl(...)
  • publishEventHeaderImpl(...)
  • publishEventTrueInfoDataImpl(...) for each detector
  • publishEventDigitizedDataImpl(...) for each detector
  • endEventImpl(...)

The JSON factory relies on that ordering to build a well-formed event object incrementally.

Note
For hit objects, this factory uses:
  • getIdentityString() for the hit address
  • getDoubleVariablesMap() and
  • getStringVariablesMap() for true info variables
  • getIdentityString() for the hit address
  • getIntObservablesMap(0) and
  • getDblObservablesMap(0) for digitized observables

Definition at line 52 of file gstreamerJSONFactory.h.

Constructor & Destructor Documentation

◆ GstreamerJsonFactory() [1/2]

GstreamerJsonFactory::GstreamerJsonFactory ( const GstreamerJsonFactory & )
delete

◆ GstreamerJsonFactory() [2/2]

GstreamerJsonFactory::GstreamerJsonFactory ( GstreamerJsonFactory && )
delete

Member Function Documentation

◆ GStreamer()

GStreamer::GStreamer ( const std::shared_ptr< GOptions > & g)
inlineexplicit

Definition at line 72 of file gstreamer.h.

◆ operator=() [1/2]

GstreamerJsonFactory & GstreamerJsonFactory::operator= ( const GstreamerJsonFactory & )
delete

◆ operator=() [2/2]

GstreamerJsonFactory & GstreamerJsonFactory::operator= ( GstreamerJsonFactory && )
delete

The documentation for this class was generated from the following files: