@@ -35,6 +35,7 @@ namespace cf::ui::core {
3535// Forward Declarations
3636// =============================================================================
3737class TokenRegistry ;
38+ // / @brief Compile-time type-safe token with zero runtime overhead.
3839template <typename T, uint64_t Hash> class StaticToken ;
3940
4041// =============================================================================
@@ -126,11 +127,19 @@ struct TokenError {
126127 */
127128template <typename T, uint64_t Hash> class StaticToken {
128129 public:
130+ // / @brief Value type stored in this token.
129131 using value_type = T;
132+
133+ // / @brief Compile-time hash of the token name.
130134 static constexpr uint64_t hash_value = Hash;
131135
136+ // / @brief Default constructor is deleted.
132137 StaticToken () = delete ;
138+
139+ // / @brief Copy constructor is deleted.
133140 StaticToken (const StaticToken&) = delete ;
141+
142+ // / @brief Copy assignment operator is deleted.
134143 StaticToken& operator =(const StaticToken&) = delete ;
135144
136145 /* *
@@ -302,7 +311,7 @@ class TokenRegistry {
302311 *
303312 * @tparam T Value type to store.
304313 * @param name Token name.
305- * @param value Value to store (will be copied).
314+ * @param value Value to store (copied).
306315 *
307316 * @return Result containing void or TokenError.
308317 *
@@ -315,7 +324,7 @@ class TokenRegistry {
315324 *
316325 * @tparam T Value type to store.
317326 * @param name Token name.
318- * @param value Value to store (will be moved).
327+ * @param value Value to store (moved).
319328 *
320329 * @return Result containing void or TokenError.
321330 *
@@ -448,11 +457,25 @@ class TokenRegistry {
448457// Inline Implementations - StaticToken
449458// =============================================================================
450459
460+ /* *
461+ * @brief Type-safe value accessor for registry.
462+ *
463+ * @return cf::expected containing pointer to the token's value or TokenError.
464+ *
465+ * @since 0.1
466+ */
451467template <typename T, uint64_t Hash> auto StaticToken<T, Hash>::get()
452468 -> cf::expected<T*, TokenError> {
453469 return TokenRegistry::get ().get <StaticToken<T, Hash>>();
454470}
455471
472+ /* *
473+ * @brief Const version of value accessor.
474+ *
475+ * @return cf::expected containing const pointer to the token's value or TokenError.
476+ *
477+ * @since 0.1
478+ */
456479template <typename T, uint64_t Hash> auto StaticToken<T, Hash>::get_const()
457480 -> cf::expected<const T*, TokenError> {
458481 return TokenRegistry::get ().get_const <StaticToken<T, Hash>>();
@@ -826,7 +849,7 @@ class EmbeddedTokenRegistry {
826849 *
827850 * @tparam T Value type to store.
828851 * @param name Token name.
829- * @param value Value to store (will be copied).
852+ * @param value Value to store (copied).
830853 *
831854 * @return Result containing void or TokenError.
832855 *
@@ -839,7 +862,7 @@ class EmbeddedTokenRegistry {
839862 *
840863 * @tparam T Value type to store.
841864 * @param name Token name.
842- * @param value Value to store (will be moved).
865+ * @param value Value to store (moved).
843866 *
844867 * @return Result containing void or TokenError.
845868 *
@@ -1005,7 +1028,8 @@ inline const detail::TokenSlot* EmbeddedTokenRegistry::find_slot_const(uint64_t
10051028}
10061029
10071030template <typename T, typename ... Args>
1008- auto EmbeddedTokenRegistry::register_dynamic (std::string_view name, Args&&... args) -> Result<void> {
1031+ auto EmbeddedTokenRegistry::register_dynamic (std::string_view name, Args&&... args)
1032+ -> Result<void> {
10091033 uint64_t hash = cf::hash::fnv1a64 (name);
10101034
10111035 std::unique_lock<std::shared_mutex> lock (registry_mutex_);
@@ -1027,7 +1051,8 @@ auto EmbeddedTokenRegistry::register_dynamic(std::string_view name, Args&&... ar
10271051}
10281052
10291053template <typename T>
1030- auto EmbeddedTokenRegistry::register_dynamic (std::string_view name, const T& value) -> Result<void> {
1054+ auto EmbeddedTokenRegistry::register_dynamic (std::string_view name, const T& value)
1055+ -> Result<void> {
10311056 uint64_t hash = cf::hash::fnv1a64 (name);
10321057
10331058 std::unique_lock<std::shared_mutex> lock (registry_mutex_);
0 commit comments