#pragma once #include #include "service.h" namespace roro { class ServiceManager { public: void add(Service& service); // Starts services in the order added; each gets its first tick on the next tick() call. void startAll(uint32_t nowMs); // Stops services in reverse order. void stopAll(); // Ticks every service whose interval has elapsed. Missed intervals are not replayed. void tick(uint32_t nowMs); private: struct Entry { Service* service; uint32_t lastTickMs; bool due; }; std::vector entries_; bool running_ = false; }; } // namespace roro