A round of new universal capabilities (all generic — templated/reflection based, no app coupling), verified by the test suite (1103 passing): Data reflection: - Reflect.hpp now (de)serializes chrono::duration, chrono::time_point, std::variant (tagged), std::array, and non-string-keyed std::map; Meta.hpp gains is_time_point_v et al. Async: - EventBus gains Mode::Async (worker-thread dispatch + flush()). - ThreadPool gains a bounded queue, try_submit(), and rejection stats. New modules / containers: - Resilience: TokenBucket, KeyedRateLimiter<Key>, CircuitBreaker, ResourceMonitor. - Containers: BufferPool<T> (size-class buffer reuse) and Cache<K,V> (per-entry TTL, LRU/LFU/FIFO eviction, hit/miss stats). - System: process/CPU/memory metrics (Metrics.hpp) and a streaming Process API. Plus FSM v2 (typed Success/Failure, sub-machines, parallel regions, history states, deferred events), Configuration/Logging reflection helpers, and the accompanying test suites. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
36 lines
867 B
C++
36 lines
867 B
C++
#pragma once
|
|
|
|
#include <span>
|
|
#include <string>
|
|
|
|
namespace Void::Fsm
|
|
{
|
|
/// A registered state. Behaviour (and therefore transitions) is chosen
|
|
/// imperatively inside each state's entry, so edges are not statically
|
|
/// knowable — the description is node-level.
|
|
struct StateInfo {
|
|
std::string name;
|
|
bool initial{false};
|
|
};
|
|
|
|
namespace Detail
|
|
{
|
|
/// Render a state description as a Mermaid `stateDiagram-v2` string:
|
|
/// the initial marker plus one node per registered state.
|
|
[[nodiscard]] inline std::string
|
|
to_mermaid(std::span<const StateInfo> states)
|
|
{
|
|
std::string out = "stateDiagram-v2\n";
|
|
for (const auto& s : states) {
|
|
if (s.initial) {
|
|
out += " [*] --> " + s.name + "\n";
|
|
}
|
|
}
|
|
for (const auto& s : states) {
|
|
out += " " + s.name + "\n";
|
|
}
|
|
return out;
|
|
}
|
|
} // namespace Detail
|
|
} // namespace Void::Fsm
|