Lazy, functional-style query/filter view over a snapshot of registered threads.
More...
#include <thread_registry.hpp>
Lazy, functional-style query/filter view over a snapshot of registered threads.
A QueryView is produced by ThreadRegistry::query() (or by chaining operations on an existing QueryView). It holds an internal std::vector<RegisteredThreadInfo> that is a snapshot - mutations to the originating ThreadRegistry after the QueryView was created are not visible.
- Value semantics
- QueryView is a regular value type (copyable and movable). All transformation methods (filter, take, skip) return a new QueryView, leaving the original unchanged.
- Thread safety
- A single QueryView instance is not safe to use concurrently from multiple threads. However, it is safe to create multiple QueryViews concurrently from the same ThreadRegistry, since creation acquires a shared lock on the registry.
- API
- Provides a functional-style interface:
- filter(pred) - returns a new QueryView containing only entries that satisfy
pred.
- map(fn) - transforms each entry and returns a
std::vector<R>.
- for_each(fn) - applies
fn to every entry.
- find_if(pred) - returns the first matching entry, or
std::nullopt.
- any / all / none(pred) - boolean aggregation predicates.
- take(n) / skip(n) - positional slicing, returning new QueryViews.
- count() / empty() - size queries.
- entries() - direct access to the underlying vector.
Definition at line 442 of file thread_registry.hpp.
◆ QueryView()
◆ all()
template<typename Predicate>
| auto threadschedule::ThreadRegistry::QueryView::all |
( |
Predicate && | pred | ) |
const -> bool
|
|
inlinenodiscard |
◆ any()
template<typename Predicate>
| auto threadschedule::ThreadRegistry::QueryView::any |
( |
Predicate && | pred | ) |
const -> bool
|
|
inlinenodiscard |
◆ count()
| auto threadschedule::ThreadRegistry::QueryView::count |
( |
| ) |
const -> size_t
|
|
inlinenodiscard |
◆ empty()
| auto threadschedule::ThreadRegistry::QueryView::empty |
( |
| ) |
const -> bool
|
|
inlinenodiscard |
◆ entries()
| auto threadschedule::ThreadRegistry::QueryView::entries |
( |
| ) |
const -> std::vector<RegisteredThreadInfo> const&
|
|
inlinenodiscard |
◆ filter()
template<typename Predicate>
| auto threadschedule::ThreadRegistry::QueryView::filter |
( |
Predicate && | pred | ) |
const -> QueryView
|
|
inline |
◆ find_if()
template<typename Predicate>
| auto threadschedule::ThreadRegistry::QueryView::find_if |
( |
Predicate && | pred | ) |
const -> std::optional<RegisteredThreadInfo>
|
|
inlinenodiscard |
◆ for_each()
template<typename Fn>
| void threadschedule::ThreadRegistry::QueryView::for_each |
( |
Fn && | fn | ) |
const |
|
inline |
◆ map()
template<typename Fn>
| auto threadschedule::ThreadRegistry::QueryView::map |
( |
Fn && | fn | ) |
const -> std::vector<std::invoke_result_t<Fn, RegisteredThreadInfo const&>>
|
|
inlinenodiscard |
◆ none()
template<typename Predicate>
| auto threadschedule::ThreadRegistry::QueryView::none |
( |
Predicate && | pred | ) |
const -> bool
|
|
inlinenodiscard |
◆ skip()
| auto threadschedule::ThreadRegistry::QueryView::skip |
( |
size_t | n | ) |
const -> QueryView
|
|
inlinenodiscard |
◆ take()
| auto threadschedule::ThreadRegistry::QueryView::take |
( |
size_t | n | ) |
const -> QueryView
|
|
inlinenodiscard |
The documentation for this class was generated from the following file: