AMR-Wind
v0.1.0
CFD solver for wind plant simulations
|
Interface to manage objects of sub-classes based on factory registration. More...
#include <CollMgr.H>
Public Types | |
using | TypePtr = std::unique_ptr< Type > |
using | TypeVector = amrex::Vector< TypePtr > |
Public Member Functions | |
CollMgr ()=default | |
~CollMgr ()=default | |
CollMgr (const CollMgr &)=delete | |
CollMgr & | operator= (const CollMgr &)=delete |
template<class... Args> | |
Type & | create (const std::string &key, Args &&... args) |
Create a new object and register it in the vector and setup lookup options. More... | |
TypeVector & | objects () |
Return a vector of the registered objects. More... | |
const TypeVector & | objects () const |
bool | contains (const std::string &key) const |
Query if an object exists using the lookup key. More... | |
Type & | operator() (const std::string &key) |
Return the object corresponding to a lookup key. More... | |
const Type & | operator() (const std::string &key) const |
template<typename T > | |
T & | operator() (const std::string &key) |
Return object for a lookup key cast into its exact class definition. More... | |
Protected Attributes | |
TypeVector | m_obj_vec |
Collection of objects registered so far. More... | |
std::unordered_map< std::string, int > | m_obj_map |
Key word based lookup. More... | |
Interface to manage objects of sub-classes based on factory registration.
Provides boiler-plate code to register a collection and then query using lookup keywords
Collection | Class holding instances of collection (e.g., PhysicsMgr) |
Base | class of the collection (e.g., Physics) |
using amr_wind::CollMgr< Collection, Type, allow_duplicates >::TypePtr = std::unique_ptr<Type> |
using amr_wind::CollMgr< Collection, Type, allow_duplicates >::TypeVector = amrex::Vector<TypePtr> |
|
default |
|
default |
|
delete |
|
inline |
Query if an object exists using the lookup key.
|
inline |
Create a new object and register it in the vector and setup lookup options.
|
inline |
Return a vector of the registered objects.
|
inline |
|
inline |
Return the object corresponding to a lookup key.
|
inline |
Return object for a lookup key cast into its exact class definition.
|
inline |
|
delete |
|
protected |
Key word based lookup.
|
protected |
Collection of objects registered so far.