6#include <unordered_map>
81 template<
typename CollectionType = Collection>
82 CollectionType&
at(
const std::string&
name)
85 return collection.
as<CollectionType>();
107 std::unordered_map<std::string, Collection> collections_;
118template<
typename Type>
121 if (!obj.registered())
123 throw std::runtime_error(errorMessage);
A type-erased interface collection types.
CollectionType & as()
Casts the collection to a specific collection type.
CollectionType & at(const std::string &name)
Retrieves a collection by its name and casts it to the specified type.
Collection & at(const std::string &name)
Retrieves a collection by its name.
std::size_t size() const
Returns the size of the database.
bool contains(const std::string &name) const
Checks if the database contains an collection with the specified name.
const Collection & at(const std::string &name) const
Retrieves a collection by its name (const version).
Collection & insert(const std::string &key, Collection &&col)
Inserts a collection into the database with the specified key.
bool remove(const std::string &name)
Removes a collection from the database.
void validateRegistration(const Type &obj, const std::string errorMessage)
Validates that a field is registered in the database.
const std::string & name(const NeoFOAM::Document &doc)
Retrieves the name of a Document.