#include "screens/post/AnchorMark.hpp" namespace dp { AnchorRegistry& AnchorRegistry::instance() { static AnchorRegistry r; return r; } void AnchorRegistry::watch(const std::string& key) { if (watched_.count(key)) return; if (watched_.size() >= kMaxWatched) watched_.erase(watched_.begin()); watched_.emplace(key, std::nullopt); } void AnchorRegistry::unwatch(const std::string& key) { watched_.erase(key); } void AnchorRegistry::record(const std::string& key, float y, float bottom) { auto it = watched_.find(key); if (it != watched_.end()) it->second = Entry{y, bottom}; } std::optional AnchorRegistry::entry(const std::string& key) const { auto it = watched_.find(key); return it == watched_.end() ? std::nullopt : it->second; } } // namespace dp