|
RTOS Wrapper
API reference
|
Concrete two-state flag bitset. More...
#include <FlagsSaver.h>
Public Types | |
| using | Base = FlagsReader< FlagId, kCount > |
| using | Snapshot = typename Base::Snapshot |
Public Types inherited from hf::FlagsReader< FlagId, kCount > | |
| using | Snapshot = FlagsSnapshot< kWordCount > |
Public Member Functions | |
| FlagsSaver () noexcept=default | |
| ~FlagsSaver () override | |
| FlagsSaver (const FlagsSaver &)=delete | |
| FlagsSaver & | operator= (const FlagsSaver &)=delete |
| bool | Set (FlagId id, uint32_t now_ms=0) noexcept override |
Mark id set. Idempotent: returns false if state was already Set (no event signalled). | |
| bool | Clear (FlagId id, uint32_t now_ms=0) noexcept override |
Mark id cleared. Idempotent: returns false if state was already Cleared (no event signalled). | |
| bool | ClearAll (uint32_t now_ms=0) noexcept override |
Reset every slot to Cleared and signal a change. | |
| bool | IsSet (FlagId id) const noexcept override |
True if id is currently set. | |
| void | Snapshot_ (Snapshot &out) const noexcept override |
Copy current bit state + sequence + last-change timestamp into out. | |
| uint32_t | Seq () const noexcept override |
| uint32_t | LastChangeMs () const noexcept override |
Most recent now_ms value passed to Set / Clear (0 if never). | |
| bool | WaitForChange (uint32_t timeout_ms) noexcept override |
Block up to timeout_ms waiting for any change since the last call to WaitForChange or ClearWaitEvent. | |
| bool | ClearWaitEvent () noexcept override |
| Discard any pending change-signal without waiting. | |
Public Member Functions inherited from hf::FlagsReader< FlagId, kCount > | |
| virtual | ~FlagsReader () noexcept=default |
Public Member Functions inherited from hf::FlagsWriter< FlagId, kCount > | |
| virtual | ~FlagsWriter () noexcept=default |
Static Public Attributes | |
| static constexpr std::size_t | kWordCount = Base::kWordCount |
Static Public Attributes inherited from hf::FlagsReader< FlagId, kCount > | |
| static constexpr std::size_t | kWordCount |
Private Member Functions | |
| bool | WriteSlot_ (FlagId id, bool set, uint32_t now_ms) noexcept |
| void | SignalChange_ () noexcept |
| bool | EnsureEventGroup_ () noexcept |
Private Attributes | |
| std::atomic< uint64_t > | words_ [kWordCount] {} |
| std::atomic< uint32_t > | seq_ {0} |
| std::atomic< uint32_t > | last_change_ms_ {0} |
| OS_EventGroup | event_group_ {} |
| bool | event_group_created_ {false} |
Static Private Attributes | |
| static constexpr OS_Ulong | kEventBit_ = 0x1U |
Concrete two-state flag bitset.
| FlagId | Strongly-typed enum (or any integer-castable type) indexing slots; must produce values in [0, kCount). |
| kCount | Number of slots. |
| using hf::FlagsSaver< FlagId, kCount >::Base = FlagsReader<FlagId, kCount> |
| using hf::FlagsSaver< FlagId, kCount >::Snapshot = typename Base::Snapshot |
|
defaultnoexcept |
|
inlineoverride |
|
delete |
|
inlineoverridevirtualnoexcept |
Mark id cleared. Idempotent: returns false if state was already Cleared (no event signalled).
Implements hf::FlagsWriter< FlagId, kCount >.
|
inlineoverridevirtualnoexcept |
Reset every slot to Cleared and signal a change.
Implements hf::FlagsWriter< FlagId, kCount >.
|
inlineoverridevirtualnoexcept |
Discard any pending change-signal without waiting.
Implements hf::FlagsReader< FlagId, kCount >.
|
inlineprivatenoexcept |
|
inlineoverridevirtualnoexcept |
True if id is currently set.
Implements hf::FlagsReader< FlagId, kCount >.
|
inlineoverridevirtualnoexcept |
Most recent now_ms value passed to Set / Clear (0 if never).
Implements hf::FlagsReader< FlagId, kCount >.
|
delete |
|
inlineoverridevirtualnoexcept |
Monotonic change counter; increments on every Set/Clear that actually toggled state.
Implements hf::FlagsReader< FlagId, kCount >.
|
inlineoverridevirtualnoexcept |
Mark id set. Idempotent: returns false if state was already Set (no event signalled).
| now_ms | Optional timestamp recorded as LastChangeMs() when the bit actually transitioned. Pass 0 to skip. |
Implements hf::FlagsWriter< FlagId, kCount >.
|
inlineprivatenoexcept |
|
inlineoverridevirtualnoexcept |
Copy current bit state + sequence + last-change timestamp into out.
Implements hf::FlagsReader< FlagId, kCount >.
|
inlineoverridevirtualnoexcept |
Block up to timeout_ms waiting for any change since the last call to WaitForChange or ClearWaitEvent.
true on signal; false on timeout / waiter unavailable. Implements hf::FlagsReader< FlagId, kCount >.
|
inlineprivatenoexcept |
|
private |
|
private |
|
staticconstexprprivate |
|
staticconstexpr |
|
private |
|
private |
|
private |