8#ifndef SEN_KERNEL_SOURCE_INFO_H
9#define SEN_KERNEL_SOURCE_INFO_H
40 [[nodiscard]]
const std::string&
getName() const noexcept;
66 void remove(const
std::
string& elem,
std::vector<
std::
string>& vec) const;
69 using Mutex =
std::recursive_mutex;
70 using Lock =
std::scoped_lock<Mutex>;
74 std::function<
void(const
std::
string&)> detectedCallback_ =
nullptr;
75 std::function<
void(const
std::
string&)> undetectedCallback_ =
nullptr;
77 mutable Mutex sourcesMutex_;
78 std::vector<
std::
string> pendingAdditions_;
79 std::vector<
std::
string> pendingRemovals_;
80 std::vector<
std::
string> currentSources_;
94 friend class impl::Session;
95 std::shared_ptr<impl::Session> session_;
98class SessionsDiscoverer:
public SourceInfo,
public std::enable_shared_from_this<SessionsDiscoverer>
101 SEN_NOCOPY_NOMOVE(SessionsDiscoverer)
114 friend class impl::KernelImpl;
115 friend class impl::Runner;
118 void sessionAvailable(
const std::string& name);
119 void sessionUnavailable(
const std::string& name);
122 impl::Runner* owner_;
123 std::vector<std::weak_ptr<SessionInfoProvider>> children_;
124 std::vector<std::weak_ptr<SessionInfoProvider>> validChildren_;
User-facing kernel functions.
Definition component_api.h:103
SessionInfoProvider(std::string name, std::shared_ptr< impl::Session > session)
~SessionInfoProvider() override
Definition source_info.h:99
friend class KernelApi
Definition source_info.h:113
~SessionsDiscoverer() override=default
void drainInputs() override
std::shared_ptr< SessionInfoProvider > makeSessionInfoProvider(const std::string &sessionName)
void onSourceUndetected(const std::function< void(const std::string &)> &callback)
Sets a callback that will be invoked when sources are undetected. Replaces any previously-set callbac...
friend class SessionsDiscoverer
Definition source_info.h:55
std::vector< std::string > getDetectedSources() const
Name of the buses discovered so far.
virtual void drainInputs()
const std::string & getName() const noexcept
The name of the session.
virtual ~SourceInfo()=default
friend class impl::Runner
Definition source_info.h:56
SourceInfo(std::string name)
void removeSource(const std::string &name)
void onSourceDetected(const std::function< void(const std::string &)> &callback)
Sets a callback that will be invoked when sources are detected. The first time it will be called for ...
void addSource(const std::string &name)
Strong type for the unique identifier for a transport timer.
Definition native_object_impl.h:39