|
gstreamer
|
Abstract base class for all gstreamer output plugins. More...
#include <gstreamer.h>
Public Member Functions | |
| GStreamer (const std::shared_ptr< GOptions > &g) | |
| Construct the streamer base and initialize module logging. | |
| virtual | ~GStreamer ()=default |
| Virtual destructor. | |
| virtual bool | openConnection () |
| Open the output medium used by this streamer. | |
| bool | closeConnection () |
| Close the output medium after flushing buffered events. | |
| virtual bool | closeConnectionImpl () |
| Plugin-specific close implementation hook. | |
| void | publishEventData (const std::shared_ptr< GEventDataCollection > &event_data) |
| Queue one event for publication. | |
| void | publishRunData (const std::shared_ptr< GRunDataCollection > &run_data) |
| Publish one run-level data collection immediately. | |
| std::string | getStreamType () const |
| Return the semantic stream type associated with this streamer instance. | |
| 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) |
| Load streamer runtime settings from the parsed options container. | |
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 () |
| GBase & | operator= (const GBase &)=default |
| GBase & | operator= (GBase &&) noexcept=default |
Static Public Member Functions | |
| static const std::vector< std::string > & | supported_formats () |
| Return the list of output format tokens supported by the module. | |
| static bool | is_valid_format (const std::string &format) |
| Validate whether a format token is supported. | |
| static GStreamer * | instantiate (const dlhandle h, std::shared_ptr< GOptions > g) |
| Instantiate a streamer plugin from a dynamic library handle. | |
Protected Member Functions | |
| bool | startEvent (const std::shared_ptr< GEventDataCollection > &event_data) |
| Begin publishing one buffered event. | |
| virtual bool | startEventImpl (const std::shared_ptr< GEventDataCollection > &event_data) |
| Plugin-specific implementation hook called at the start of one event publish sequence. | |
| bool | endEvent (const std::shared_ptr< GEventDataCollection > &event_data) |
| End publishing one buffered event. | |
| virtual bool | endEventImpl (const std::shared_ptr< GEventDataCollection > &event_data) |
| Plugin-specific implementation hook called at the end of one event publish sequence. | |
| bool | publishEventHeader (const std::unique_ptr< GEventHeader > &gevent_header) |
| Publish the event header for the current event sequence. | |
| virtual bool | publishEventHeaderImpl (const std::unique_ptr< GEventHeader > &gevent_header) |
| Plugin-specific implementation hook for serializing one event header. | |
| bool | publishEventTrueInfoData (const std::string &detectorName, const std::vector< const GTrueInfoData * > &trueInfoData) |
| Publish the true-information hit bank for one detector. | |
| virtual bool | publishEventTrueInfoDataImpl (const std::string &detectorName, const std::vector< const GTrueInfoData * > &trueInfoData) |
| Plugin-specific implementation hook for one detector true-information collection. | |
| bool | publishEventDigitizedData (const std::string &detectorName, const std::vector< const GDigitizedData * > &digitizedData) |
| Publish the digitized hit bank for one detector. | |
| virtual bool | publishEventDigitizedDataImpl (const std::string &detectorName, const std::vector< const GDigitizedData * > &digitizedData) |
| Plugin-specific implementation hook for one detector digitized collection. | |
| bool | startRun (const std::shared_ptr< GRunDataCollection > &run_data) |
| Begin publishing one run-level collection. | |
| virtual bool | startRunImpl (const std::shared_ptr< GRunDataCollection > &run_data) |
| Plugin-specific implementation hook called at the start of a run publish sequence. | |
| bool | endRun (const std::shared_ptr< GRunDataCollection > &run_data) |
| End publishing one run-level collection. | |
| virtual bool | endRunImpl (const std::shared_ptr< GRunDataCollection > &run_data) |
| Plugin-specific implementation hook called at the end of a run publish sequence. | |
| bool | publishRunHeader (const std::unique_ptr< GRunHeader > &run_header) |
| Publish the run header for the current run sequence. | |
| virtual bool | publishRunHeaderImpl (const std::unique_ptr< GRunHeader > &run_header) |
| Plugin-specific implementation hook for serializing one run header. | |
| bool | publishRunDigitizedData (const std::string &detectorName, const std::vector< const GDigitizedData * > &digitizedData) |
| Publish run-level digitized data for one detector. | |
| virtual bool | publishRunDigitizedDataImpl (const std::string &detectorName, const std::vector< const GDigitizedData * > &digitizedData) |
| Plugin-specific implementation hook for one detector run-level digitized collection. | |
| bool | startStream (const GFrameDataCollection *frameRunData) |
| Begin publishing one frame stream record. | |
| virtual bool | startStreamImpl (const GFrameDataCollection *frameRunData) |
| Plugin-specific implementation hook called at the start of a frame stream record. | |
| bool | publishFrameHeader (const GFrameHeader *gframeHeader) |
| Publish one frame header. | |
| virtual bool | publishFrameHeaderImpl (const GFrameHeader *gframeHeader) |
| Plugin-specific implementation hook for serializing one frame header. | |
| bool | publishPayload (const std::vector< GIntegralPayload * > *payload) |
| Publish one frame payload. | |
| virtual bool | publishPayloadImpl (const std::vector< GIntegralPayload * > *payload) |
| Plugin-specific implementation hook for serializing one frame payload. | |
| bool | endStream (const GFrameDataCollection *frameRunData) |
| End publishing one frame stream record. | |
| virtual bool | endStreamImpl (const GFrameDataCollection *frameRunData) |
| Plugin-specific implementation hook called at the end of a frame stream record. | |
| void | flushEventBuffer () |
| Flush all buffered events to the backend in publish order. | |
Protected Attributes | |
| GStreamerDefinition | gstreamer_definitions |
| Output definition currently bound to this streamer instance. | |
Protected Attributes inherited from GBase< GStreamer > | |
| std::shared_ptr< GLogger > | log |
A concrete streamer is responsible for serializing GEMC data collections into a specific backend format. The base class centralizes the common workflow:
Concrete plugins override only the protected implementation hooks they support.
A typical plugin instance follows this lifecycle:
For event-based output, publication is buffered. Events are accumulated in memory and written in batches when the configured buffer threshold is reached or when the connection is closed.
Event publication uses an internal buffer of std::shared_ptr<GEventDataCollection>. This design ensures that all event-owned objects remain alive for the full duration of a flush. During the flush, the base class extracts raw pointers from the detector collections and passes them to plugin hooks as read-only views.
The buffer is flushed when:
bufferFlushLimit The class itself does not perform external synchronization. The intended usage pattern is one streamer instance per worker thread. The helper gstreamersMapPtr() follows that model by creating a per-thread map of streamer objects.
Sharing one streamer instance across threads is only safe if the derived plugin implements its own synchronization policy.
Concrete plugins are loaded dynamically and must expose an extern "C" factory function named GStreamerFactory. The static helper instantiate() resolves that symbol from a dynamic library handle and constructs the plugin object.
Definition at line 76 of file gstreamer.h.
|
inlineexplicit |
| g | Parsed options container used by the base logger infrastructure. |
Definition at line 84 of file gstreamer.h.
|
virtualdefault |
A virtual destructor is required because streamer instances are manipulated through base-class pointers while the actual object type is a concrete plugin.
|
inline |
This public wrapper guarantees that pending event data are published before the plugin-specific close logic executes.
true on success, false on failure. Definition at line 113 of file gstreamer.h.
|
inlinevirtual |
Concrete plugins override this to release backend resources after the common wrapper has already handled event-buffer flushing.
true on success, false on failure. Definition at line 126 of file gstreamer.h.
|
inline |
The assigned definition determines the format token, base filename, type, and optional thread-specialized naming.
| gstreamerDefinition | Streamer definition to bind to this instance. |
| tid | Worker thread id used to specialize the filename. The default value keeps the original name unchanged. |
Definition at line 169 of file gstreamer.h.
|
inlineprotected |
| event_data | Event collection being published. |
true on success, false on failure. Definition at line 243 of file gstreamer.h.
|
inlineprotectedvirtual |
| event_data | Event collection being published. |
true on success, false on failure. Definition at line 254 of file gstreamer.h.
|
inlineprotected |
| run_data | Run collection being published. |
true on success, false on failure. Definition at line 371 of file gstreamer.h.
|
inlineprotectedvirtual |
| run_data | Run collection being published. |
true on success, false on failure. Definition at line 382 of file gstreamer.h.
|
inlineprotected |
| frameRunData | Frame collection being published. |
true on success, false on failure. Definition at line 499 of file gstreamer.h.
|
inlineprotectedvirtual |
| frameRunData | Frame collection being published. |
true on success, false on failure. Definition at line 510 of file gstreamer.h.
|
protected |
For each buffered event, the base class executes the event publish sequence and then clears the internal buffer. This method is called automatically when buffering reaches its threshold, when the connection is closed, and before frame streaming begins.
Definition at line 73 of file gstreamer.cc.
|
inline |
The type comes from the configured GStreamerDefinition and is typically "event" or "stream".
Definition at line 157 of file gstreamer.h.
|
inlinestatic |
The method resolves the required GStreamerFactory symbol and invokes it with the supplied options object.
| h | Dynamic library handle. |
| g | Parsed options container forwarded to the plugin constructor. |
nullptr when the handle or symbol is invalid. Definition at line 549 of file gstreamer.h.
|
static |
Validation is case-insensitive.
| format | Format token to validate. |
true when the token matches one of the supported formats, false otherwise. Definition at line 17 of file gstreamer.cc.
|
inlinevirtual |
Concrete plugins override this to acquire their backend resources, such as files, sockets, or format-specific handles.
true on success, false on failure. Definition at line 103 of file gstreamer.h.
| void GStreamer::publishEventData | ( | const std::shared_ptr< GEventDataCollection > & | event_data | ) |
The event is appended to the internal event buffer. Once the number of buffered events reaches bufferFlushLimit, the base class flushes the entire buffer by calling the event publish hook sequence on the derived plugin.
| event_data | Event data collection to publish. |
Definition at line 25 of file gstreamer.cc.
|
inlineprotected |
The vector contains raw pointers into event-owned digitized hit objects and is valid for the duration of the flush.
| detectorName | Detector or sensitive-detector name identifying the collection. |
| digitizedData | Raw-pointer view of the detector digitized hits. |
true on success, false on failure. Definition at line 321 of file gstreamer.h.
|
inlineprotectedvirtual |
| detectorName | Detector or sensitive-detector name. |
| digitizedData | Raw-pointer view of the detector digitized hits. |
true on success, false on failure. Definition at line 334 of file gstreamer.h.
|
inlineprotected |
The wrapper validates the header pointer, emits debug logging, and delegates serialization to the plugin implementation.
| gevent_header | Unique pointer owned by the source event collection. |
true on success, false on failure. Definition at line 267 of file gstreamer.h.
|
inlineprotectedvirtual |
| gevent_header | Unique pointer owned by the source event collection. |
true on success, false on failure. Definition at line 279 of file gstreamer.h.
|
inlineprotected |
The vector contains raw pointers into event-owned hit objects. Those objects remain valid for the duration of the flush because the owning event remains stored in the internal buffer.
| detectorName | Detector or sensitive-detector name identifying the collection. |
| trueInfoData | Raw-pointer view of the detector true-information hits. |
true on success, false on failure. Definition at line 293 of file gstreamer.h.
|
inlineprotectedvirtual |
| detectorName | Detector or sensitive-detector name. |
| trueInfoData | Raw-pointer view of the detector true-information hits. |
true on success, false on failure. Definition at line 306 of file gstreamer.h.
|
inlineprotected |
| gframeHeader | Frame header pointer supplied by the caller. |
true on success, false on failure. Definition at line 461 of file gstreamer.h.
|
inlineprotectedvirtual |
| gframeHeader | Frame header pointer supplied by the caller. |
true on success, false on failure. Definition at line 472 of file gstreamer.h.
|
inlineprotected |
| payload | Pointer to the frame integral-payload vector. |
true on success, false on failure. Definition at line 480 of file gstreamer.h.
|
inlineprotectedvirtual |
| payload | Pointer to the frame integral-payload vector. |
true on success, false on failure. Definition at line 491 of file gstreamer.h.
| void GStreamer::publishRunData | ( | const std::shared_ptr< GRunDataCollection > & | run_data | ) |
Run data are not buffered. The base class dispatches the run publish sequence directly to the plugin-specific hooks.
| run_data | Run data collection to publish. |
Definition at line 45 of file gstreamer.cc.
|
inlineprotected |
| detectorName | Detector or sensitive-detector name identifying the collection. |
| digitizedData | Raw-pointer view of the detector digitized data. |
true on success, false on failure. Definition at line 414 of file gstreamer.h.
|
inlineprotectedvirtual |
| detectorName | Detector or sensitive-detector name. |
| digitizedData | Raw-pointer view of the detector digitized data. |
true on success, false on failure. Definition at line 427 of file gstreamer.h.
|
inlineprotected |
| run_header | Unique pointer owned by the source run collection. |
true on success, false on failure. Definition at line 392 of file gstreamer.h.
|
inlineprotectedvirtual |
| run_header | Unique pointer owned by the source run collection. |
true on success, false on failure. Definition at line 403 of file gstreamer.h.
|
inline |
At present this method configures the event buffer flush limit from the ebuffer option.
| g | Parsed options container supplying module configuration. |
Definition at line 200 of file gstreamer.h.
|
inlineprotected |
The wrapper validates the input event and its header, emits debug logging, and delegates the actual backend-specific behavior to the derived implementation.
| event_data | Event collection being published. |
true on success, false on failure. Definition at line 217 of file gstreamer.h.
|
inlineprotectedvirtual |
| event_data | Event collection being published. |
true on success, false on failure. Definition at line 233 of file gstreamer.h.
|
inlineprotected |
| run_data | Run collection being published. |
true on success, false on failure. Definition at line 345 of file gstreamer.h.
|
inlineprotectedvirtual |
| run_data | Run collection being published. |
true on success, false on failure. Definition at line 361 of file gstreamer.h.
|
inlineprotected |
Pending event data are flushed first so the output sequence remains well defined if a plugin supports both event and frame publication modes.
| frameRunData | Frame collection being published. |
true on success, false on failure. Definition at line 441 of file gstreamer.h.
|
inlineprotectedvirtual |
| frameRunData | Frame collection being published. |
true on success, false on failure. Definition at line 453 of file gstreamer.h.
|
static |
This list represents the built-in plugin formats recognized by the module-level validation helpers and option help text.
Definition at line 11 of file gstreamer.cc.
|
protected |
Definition at line 206 of file gstreamer.h.