NeoFOAM
WIP Prototype of a modern OpenFOAM core
|
#include <database.hpp>
Public Member Functions | |
Collection & | insert (const std::string &key, Collection &&col) |
Inserts a collection into the database with the specified key. | |
bool | contains (const std::string &name) const |
Checks if the database contains an collection with the specified name. | |
bool | remove (const std::string &name) |
Removes a collection from the database. | |
Collection & | at (const std::string &name) |
Retrieves a collection by its name. | |
const Collection & | at (const std::string &name) const |
Retrieves a collection by its name (const version). | |
template<typename CollectionType = Collection> | |
CollectionType & | at (const std::string &name) |
Retrieves a collection by its name and casts it to the specified type. | |
std::size_t | size () const |
Returns the size of the database. | |
Definition at line 16 of file database.hpp.
Collection & NeoFOAM::Database::at | ( | const std::string & | name | ) |
Retrieves a collection by its name.
This function searches for and returns a reference to a collection identified by the given name. If the collection does not exist, the behavior is undefined.
name | The name of the collection to retrieve. |
|
inline |
Retrieves a collection by its name and casts it to the specified type.
This function retrieves a collection by its name and attempts to cast it to the specified type. If the collection does not exist or the cast fails, an exception is thrown.
CollectionType | The type to cast the collection to. |
name | The name of the collection to retrieve. |
Definition at line 82 of file database.hpp.
const Collection & NeoFOAM::Database::at | ( | const std::string & | name | ) | const |
Retrieves a collection by its name (const version).
This function searches for and returns a const reference to a collection identified by the given name. If the collection does not exist, the behavior is undefined.
name | The name of the collection to retrieve. |
bool NeoFOAM::Database::contains | ( | const std::string & | name | ) | const |
Checks if the database contains an collection with the specified name.
name | The name of the collection to check for. |
Collection & NeoFOAM::Database::insert | ( | const std::string & | key, |
Collection && | col | ||
) |
Inserts a collection into the database with the specified key.
key | The key associated with the collection to be inserted. |
col | The collection to be inserted into the database. |
bool NeoFOAM::Database::remove | ( | const std::string & | name | ) |
Removes a collection from the database.
This function removes the collection with the specified name from the database.
name | The name of the collection to be removed. |
std::size_t NeoFOAM::Database::size | ( | ) | const |
Returns the size of the database.
This function provides the number of elements currently stored in the database.