NeoN
WIP Prototype of a modern OpenFOAM core
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
NeoN::finiteVolume::cellCentred::VectorCollection Class Reference

A class representing a collection of field documents in a database. More...

#include <fieldCollection.hpp>

Inheritance diagram for NeoN::finiteVolume::cellCentred::VectorCollection:
NeoN::CollectionMixin< VectorDocument >

Public Member Functions

 VectorCollection (NeoN::Database &db, std::string name)
 Constructs a VectorCollection with the given database and name.
 
 VectorCollection (const VectorCollection &)=delete
 A VectorCollection is not copyable, but moveable.
 
VectorCollectionoperator= (const VectorCollection &)=delete
 A VectorCollection is not copyable, but moveable.
 
 VectorCollection (VectorCollection &&)=default
 A VectorCollection is move constructable, but not copyable.
 
VectorCollectionoperator= (VectorCollection &&)=delete
 A VectorCollection is not move-assign-able, but move-construct-able.
 
bool contains (const std::string &id) const
 Checks if the collection contains a field with the given ID.
 
std::string insert (const VectorDocument &fd)
 Inserts a field document into the collection.
 
VectorDocumentfieldDoc (const std::string &id)
 Retrieves a field document by its ID.
 
const VectorDocumentfieldDoc (const std::string &id) const
 Retrieves a field document by its ID (const version).
 
template<class VectorType >
VectorType & registerVector (CreateFunction createFunc)
 Registers a field in the collection.
 
- Public Member Functions inherited from NeoN::CollectionMixin< VectorDocument >
 CollectionMixin (NeoN::Database &db, std::string name)
 Constructs a CollectionMixin with the given database and collection name.
 
 CollectionMixin (const CollectionMixin &)=delete
 
 CollectionMixin (CollectionMixin &&)=default
 
CollectionMixinoperator= (const CollectionMixin &)=delete
 
CollectionMixinoperator= (CollectionMixin &&)=delete
 
Documentdoc (const std::string &id)
 Retrieves a document by its ID.
 
const Documentdoc (const std::string &id) const
 Retrieves a document by its ID (const version).
 
std::vector< std::string > find (const std::function< bool(const Document &)> &predicate) const
 Finds documents that match a given predicate.
 
std::size_t size () const
 Gets the number of documents in the collection.
 
const NeoN::Databasedb () const
 Gets a const reference to the database.
 
NeoN::Databasedb ()
 Gets a reference to the database.
 
const std::string & name () const
 Gets the name of the collection.
 
std::string type () const
 Gets the type name of the documents in the collection.
 
std::vector< std::string > sortedKeys () const
 Gets the sorted keys of the documents in the collection.
 

Static Public Member Functions

static VectorCollectioninstance (NeoN::Database &db, std::string name)
 Retrieves the instance of the VectorCollection with the given name.
 
static const VectorCollectioninstance (const NeoN::Database &db, std::string name)
 Retrieves the instance of the VectorCollection with the given name (const version).
 
template<class VectorType >
static VectorCollectioninstance (VectorType &field)
 Retrieves the instance of the VectorCollection from a const registered VectorType.
 
template<class VectorType >
static const VectorCollectioninstance (const VectorType &field)
 Retrieves the instance of the VectorCollection from a const registered VectorType.
 

Additional Inherited Members

- Protected Attributes inherited from NeoN::CollectionMixin< VectorDocument >
std::unordered_map< std::string, VectorDocument > docs_
 The map of document IDs to documents.
 
NeoN::Databasedb_
 The reference to the database.
 
std::string name_
 The name of the collection.
 

Detailed Description

A class representing a collection of field documents in a database.

The VectorCollection class represents a collection of field documents in a database and provides additional functionality for accessing field-specific data.

Definition at line 207 of file fieldCollection.hpp.

Constructor & Destructor Documentation

◆ VectorCollection() [1/3]

NeoN::finiteVolume::cellCentred::VectorCollection::VectorCollection ( NeoN::Database db,
std::string  name 
)

Constructs a VectorCollection with the given database and name.

Parameters
dbThe database to create the collection in.
nameThe name of the collection.

◆ VectorCollection() [2/3]

NeoN::finiteVolume::cellCentred::VectorCollection::VectorCollection ( const VectorCollection )
delete

A VectorCollection is not copyable, but moveable.

◆ VectorCollection() [3/3]

NeoN::finiteVolume::cellCentred::VectorCollection::VectorCollection ( VectorCollection &&  )
default

A VectorCollection is move constructable, but not copyable.

Member Function Documentation

◆ contains()

bool NeoN::finiteVolume::cellCentred::VectorCollection::contains ( const std::string &  id) const

Checks if the collection contains a field with the given ID.

Parameters
idThe ID of the field to check for.
Returns
true if the collection contains the field, false otherwise.

◆ fieldDoc() [1/2]

VectorDocument & NeoN::finiteVolume::cellCentred::VectorCollection::fieldDoc ( const std::string &  id)

Retrieves a field document by its ID.

Parameters
idThe ID of the field document to retrieve.
Returns
VectorDocument& A reference to the field document.

◆ fieldDoc() [2/2]

const VectorDocument & NeoN::finiteVolume::cellCentred::VectorCollection::fieldDoc ( const std::string &  id) const

Retrieves a field document by its ID (const version).

Parameters
idThe ID of the field document to retrieve.
Returns
const VectorDocument& A const reference to the field document.

◆ insert()

std::string NeoN::finiteVolume::cellCentred::VectorCollection::insert ( const VectorDocument fd)

Inserts a field document into the collection.

Parameters
fdThe field document to insert.
Returns
A string representing the unique identifier of the inserted field.

◆ instance() [1/4]

static const VectorCollection & NeoN::finiteVolume::cellCentred::VectorCollection::instance ( const NeoN::Database db,
std::string  name 
)
static

Retrieves the instance of the VectorCollection with the given name (const version).

creates the VectorCollection if it does not exist.

Parameters
dbThe database to retrieve the VectorCollection from.
nameThe name of the VectorCollection.
Returns
const VectorCollection& A const reference to the VectorCollection.

◆ instance() [2/4]

template<class VectorType >
static const VectorCollection & NeoN::finiteVolume::cellCentred::VectorCollection::instance ( const VectorType &  field)
inlinestatic

Retrieves the instance of the VectorCollection from a const registered VectorType.

Parameters
fieldA registered VectorType
Returns
VectorCollection& A reference to the VectorCollection.

Definition at line 316 of file fieldCollection.hpp.

◆ instance() [3/4]

static VectorCollection & NeoN::finiteVolume::cellCentred::VectorCollection::instance ( NeoN::Database db,
std::string  name 
)
static

Retrieves the instance of the VectorCollection with the given name.

creates the VectorCollection if it does not exist.

Parameters
dbThe database to retrieve the VectorCollection from.
nameThe name of the VectorCollection.
Returns
VectorCollection& A reference to the VectorCollection.

◆ instance() [4/4]

template<class VectorType >
static VectorCollection & NeoN::finiteVolume::cellCentred::VectorCollection::instance ( VectorType &  field)
inlinestatic

Retrieves the instance of the VectorCollection from a const registered VectorType.

Parameters
fieldA registered VectorType
Returns
VectorCollection& A reference to the VectorCollection.

Definition at line 301 of file fieldCollection.hpp.

◆ operator=() [1/2]

VectorCollection & NeoN::finiteVolume::cellCentred::VectorCollection::operator= ( const VectorCollection )
delete

A VectorCollection is not copyable, but moveable.

◆ operator=() [2/2]

VectorCollection & NeoN::finiteVolume::cellCentred::VectorCollection::operator= ( VectorCollection &&  )
delete

A VectorCollection is not move-assign-able, but move-construct-able.

◆ registerVector()

template<class VectorType >
VectorType & NeoN::finiteVolume::cellCentred::VectorCollection::registerVector ( CreateFunction  createFunc)
inline

Registers a field in the collection.

Template Parameters
VectorTypeThe type of the field to register.
Parameters
createFuncThe function to create the field document.
Returns
A reference to the registered field.

Definition at line 335 of file fieldCollection.hpp.


The documentation for this class was generated from the following file: