ThreadSchedule 1.0.0
Modern C++ thread management library
Loading...
Searching...
No Matches
threadschedule::CompositeThreadRegistry Class Reference

Aggregates multiple ThreadRegistry instances into a single queryable view. More...

#include <thread_registry.hpp>

Public Member Functions

void attach (ThreadRegistry *reg)
auto query () const -> ThreadRegistry::QueryView
template<typename Predicate>
auto filter (Predicate &&pred) const -> ThreadRegistry::QueryView
auto count () const -> size_t
auto empty () const -> bool
template<typename Fn>
void for_each (Fn &&fn) const
template<typename Predicate, typename Fn>
void apply (Predicate &&pred, Fn &&fn) const
template<typename Fn>
auto map (Fn &&fn) const -> std::vector< std::invoke_result_t< Fn, RegisteredThreadInfo const & > >
template<typename Predicate>
auto find_if (Predicate &&pred) const -> std::optional< RegisteredThreadInfo >
template<typename Predicate>
auto any (Predicate &&pred) const -> bool
template<typename Predicate>
auto all (Predicate &&pred) const -> bool
template<typename Predicate>
auto none (Predicate &&pred) const -> bool
auto take (size_t n) const -> ThreadRegistry::QueryView
auto skip (size_t n) const -> ThreadRegistry::QueryView

Detailed Description

Aggregates multiple ThreadRegistry instances into a single queryable view.

CompositeThreadRegistry is useful when threads are spread across several independent ThreadRegistry instances (e.g. one per shared library) and you want a unified query interface over all of them.

Thread safety
All public methods are thread-safe. The internal list of attached registries is protected by a std::mutex.
Copyability / movability
Not copyable and not movable (holds a std::mutex).
Ownership
attach() stores raw pointers to the supplied registries. The caller is responsible for ensuring that every attached ThreadRegistry outlives this CompositeThreadRegistry. Violating this results in undefined behaviour.
Deduplication
No deduplication is performed. If the same TID appears in multiple attached registries, it will appear multiple times in the merged QueryView.
Querying
query() iterates over every attached registry, calls its own query(), and concatenates the results into a single ThreadRegistry::QueryView snapshot. The same functional-style helpers (filter, map, for_each, etc.) are available directly on CompositeThreadRegistry for convenience.

Definition at line 884 of file thread_registry.hpp.

Member Function Documentation

◆ all()

template<typename Predicate>
auto threadschedule::CompositeThreadRegistry::all ( Predicate && pred) const -> bool
inlinenodiscard

Definition at line 960 of file thread_registry.hpp.

◆ any()

template<typename Predicate>
auto threadschedule::CompositeThreadRegistry::any ( Predicate && pred) const -> bool
inlinenodiscard

Definition at line 954 of file thread_registry.hpp.

◆ apply()

template<typename Predicate, typename Fn>
void threadschedule::CompositeThreadRegistry::apply ( Predicate && pred,
Fn && fn ) const
inline

Definition at line 936 of file thread_registry.hpp.

◆ attach()

void threadschedule::CompositeThreadRegistry::attach ( ThreadRegistry * reg)
inline

Definition at line 887 of file thread_registry.hpp.

◆ count()

auto threadschedule::CompositeThreadRegistry::count ( ) const -> size_t
inlinenodiscard

Definition at line 919 of file thread_registry.hpp.

◆ empty()

auto threadschedule::CompositeThreadRegistry::empty ( ) const -> bool
inlinenodiscard

Definition at line 924 of file thread_registry.hpp.

◆ filter()

template<typename Predicate>
auto threadschedule::CompositeThreadRegistry::filter ( Predicate && pred) const -> ThreadRegistry::QueryView
inlinenodiscard

Definition at line 914 of file thread_registry.hpp.

◆ find_if()

template<typename Predicate>
auto threadschedule::CompositeThreadRegistry::find_if ( Predicate && pred) const -> std::optional<RegisteredThreadInfo>
inlinenodiscard

Definition at line 948 of file thread_registry.hpp.

◆ for_each()

template<typename Fn>
void threadschedule::CompositeThreadRegistry::for_each ( Fn && fn) const
inline

Definition at line 930 of file thread_registry.hpp.

◆ map()

template<typename Fn>
auto threadschedule::CompositeThreadRegistry::map ( Fn && fn) const -> std::vector<std::invoke_result_t<Fn, RegisteredThreadInfo const&>>
inlinenodiscard

Definition at line 942 of file thread_registry.hpp.

◆ none()

template<typename Predicate>
auto threadschedule::CompositeThreadRegistry::none ( Predicate && pred) const -> bool
inlinenodiscard

Definition at line 966 of file thread_registry.hpp.

◆ query()

auto threadschedule::CompositeThreadRegistry::query ( ) const -> ThreadRegistry::QueryView
inlinenodiscard

Definition at line 896 of file thread_registry.hpp.

◆ skip()

auto threadschedule::CompositeThreadRegistry::skip ( size_t n) const -> ThreadRegistry::QueryView
inlinenodiscard

Definition at line 976 of file thread_registry.hpp.

◆ take()

auto threadschedule::CompositeThreadRegistry::take ( size_t n) const -> ThreadRegistry::QueryView
inlinenodiscard

Definition at line 971 of file thread_registry.hpp.


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