Class FileRegistry
Defined in File file-registry.h
Inheritance Relationships
Base Type
public CE::State::Singleton< FileRegistry >(Template Class Singleton)
Class Documentation
-
class FileRegistry : public CE::State::Singleton<FileRegistry>
Declaration:
finalSynchronized path registry for files without typed resource loading.
Paths are owned, normalized absolute names grouped by basename; contents remain the responsibility of the consumer opening/streaming them.
See also
Public Functions
-
FileRegistry() = default
Create an empty owned registry without scanning files or touching its optional legacy singleton.
-
void register_files(const std::vector<std::filesystem::path> &files)
Append normalized absolute paths under the registry write lock, deduplicating identical paths.
- Parameters:
files – Paths borrowed through the call; relative paths use the working directory at registration. No files are opened. Filesystem normalization/allocation errors propagate; completed insertions may remain. Existing registrations are never replaced.
-
void register_files(const FileRegistry &files)
Merge another registry under coordinated destination-write/source-read locks.
- Parameters:
files – Live registry borrowed through the call; self-registration is a no-op. Copies and deduplicates paths without opening contents. Allocation failure can leave completed insertions; source remains unchanged.
-
std::vector<std::filesystem::path> get_files_named(std::string_view name) const
Declaration:
[[nodiscard]]Copy the sorted path bucket for an exact basename under a shared lock.
- Parameters:
name – Exact case-sensitive basename, not a path query.
- Returns:
Independent lexically sorted paths, empty if absent; later registration/destruction cannot invalidate the copy.
-
std::optional<std::filesystem::path> get_file_named(std::string_view name) const
Declaration:
[[nodiscard]]Copy the lexically first path for an exact basename under a shared lock.
- Parameters:
name – Exact basename; multiple matches do not report ambiguity here.
- Returns:
Owned first path, or nullopt if absent. Use get_files_named() when selection policy matters.
-
std::optional<std::filesystem::path> get_file_at(const std::filesystem::path &path) const
Declaration:
[[nodiscard]]Resolve an exact registered normalized absolute path, without basename fallback.
- Parameters:
path – Relative input uses the current working directory; no filesystem canonicalization or existence check is added.
- Returns:
Owned matching path, or nullopt when absent. Filesystem/allocation failures propagate; registry access is synchronized.
-
FileRegistry() = default