gstreamer
Loading...
Searching...
No Matches
gSROService.h
Go to the documentation of this file.
1#pragma once
2
3#include "gSROCrate.h"
4
28{
29public:
31 using DeliveryCallback = std::function<void(GSROCrateId, GSROEventId, std::uint64_t)>;
32
35 GSROService(const GSROService&) = delete;
39
41 void begin_run(ResourceFactory make_resources, GSROCrateLimits limits = {},
42 DeliveryCallback on_delivery = {});
43
50 void begin_run(ResourceFactory make_resources, std::shared_ptr<const GSROTiming> timing,
51 GSROCrateLimits limits = {}, std::size_t max_pending_events = 65536);
52
55
57 void dispatch_payload_to_crate(GSROPayload payload);
58
60 void complete_event(GSROEventId event_id);
61
63 void advance_time(GSROTime safe_time);
64
68 void finish_run(GSROEndContext context);
70 void cancel_run(std::exception_ptr error);
71 void rethrow_if_failed() const;
72
73private:
74 class Impl;
75 std::unique_ptr<Impl> impl;
76};
void begin_run(ResourceFactory make_resources, GSROCrateLimits limits={}, DeliveryCallback on_delivery={})
Begin a fresh invocation after the previous one was joined; clears its progress and failure state.
void finish_run(GSROEndContext context)
GSROService & operator=(GSROService &&)=delete
void advance_time(GSROTime safe_time)
Manual mode only: broadcast a proven bound after all earlier dispatches return. New crates inherit it...
void rethrow_if_failed() const
GSROService(const GSROService &)=delete
void complete_event(GSROEventId event_id)
Automatic mode only. Close once, after all dispatch calls for this event have returned.
void create_crate_thread_if_needed(GSROCrateId crate_id)
Also permits implementations to request output for empty crates. Concurrent requests create once.
std::function< void(GSROCrateId, GSROEventId, std::uint64_t)> DeliveryCallback
Definition gSROService.h:31
GSROService & operator=(const GSROService &)=delete
void cancel_run(std::exception_ptr error)
Report a worker-side failure and wake blocked producers. The run owner still calls finish_run to join...
std::function< GSROCrateResources(GSROCrateId)> ResourceFactory
Definition gSROService.h:30
GSROService(GSROService &&)=delete
void dispatch_payload_to_crate(GSROPayload payload)
Transfers ownership directly to the destination queue, creating its crate on first use.
std::chrono::duration< std::int64_t, std::nano > GSROTime
Definition gSROData.h:20
std::uint32_t GSROCrateId
Definition gSROData.h:18
std::uint64_t GSROEventId
Definition gSROData.h:19
Per-crate bounds preventing asynchronous delivery from consuming unlimited memory.
Definition gSROCrate.h:29
Declare the sink first so the plugin referencing it is destroyed first.
Definition gSROCrate.h:42