qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches
CoreSet.h
Go to the documentation of this file.
1
25
26#ifndef QB_CORE_SET_H
27#define QB_CORE_SET_H
28#include <cstdint>
31#include <vector>
32
33// include from qb
34#include "ActorId.h"
35
36namespace qb {
37
47class CoreSet {
48 friend class SharedCoreCommunication;
49 friend class VirtualCore;
50 friend class Main;
51
52 const CoreIdSet _raw_set;
53 const std::size_t _nb_core;
54 const std::size_t _size;
55 std::array<uint8_t, MaxCores> _set;
56
57public:
58 CoreSet() = delete;
59
64 explicit CoreSet(CoreIdSet const &set) noexcept;
65
74 [[nodiscard]] static CoreSet
75 build(uint32_t nb_core = std::thread::hardware_concurrency()) noexcept;
76
82 [[nodiscard]] CoreId resolve(std::size_t id) const noexcept;
83
88 [[nodiscard]] const CoreIdSet &raw() const noexcept;
89
94 [[nodiscard]] uint32_t getSize() const noexcept;
95
100 [[nodiscard]] uint32_t getNbCore() const noexcept;
101};
102
103} // namespace qb
104#endif // QB_CORESET_H
const CoreIdSet & raw() const noexcept
Get the raw set of core IDs.
static CoreSet build(uint32_t nb_core=std::thread::hardware_concurrency()) noexcept
Build a CoreSet with a specified number of cores.
uint32_t getSize() const noexcept
Get the size of the core set.
uint32_t getNbCore() const noexcept
Get the number of cores in the set.
CoreId resolve(std::size_t id) const noexcept
Resolve a core ID to its index in the set.
CoreSet(CoreIdSet const &set) noexcept
Construct a CoreSet with a specific set of cores.
Actor and core identification for the QB Actor Framework.
uint16_t CoreId
Type definition for core identifiers.
Definition ActorId.h:51
CoreIdBitSet CoreIdSet
Efficient set implementation for storing CoreId values.
Definition ActorId.h:363
Advanced type traits and metaprogramming utilities for the QB Framework.
Optimized unordered set implementations.