GEOSX
Public Types | Public Member Functions | Static Public Member Functions | List of all members
geos::dataRepository::CatalogInterface< BASETYPE, ARGS > Class Template Referenceabstract

This class provides the base class/interface for the catalog value objects. More...

#include <ObjectCatalog.hpp>

Public Types

typedef std::unordered_map< std::string, std::unique_ptr< CatalogInterface< BASETYPE, ARGS... > > > CatalogType
 This is the type that will be used for the catalog. The catalog is actually instantiated in the BASETYPE.
 

Public Member Functions

 CatalogInterface ()
 Default constructor.
 
virtual ~CatalogInterface ()
 Default destructor.
 
 CatalogInterface (CatalogInterface const &)=default
 Copy constructor.
 
 CatalogInterface (CatalogInterface &&)=default
 Move constructor.
 
CatalogInterfaceoperator= (CatalogInterface const &)=default
 Copy assignment operator. More...
 
CatalogInterfaceoperator= (CatalogInterface &&)=default
 Move assignment operator. More...
 
virtual std::unique_ptr< BASETYPE > allocate (ARGS... args) const =0
 Create a new object that derives from BASETYPE. More...
 

Static Public Member Functions

static CatalogTypegetCatalog ()
 Get the catalog from that is stored in the target base class. More...
 
static bool hasKeyName (std::string const &objectTypeName)
 Check if catalog contains a given key. More...
 
static std::list< typename CatalogType::key_type > getKeys ()
 Returns the product keys of the catalog. Keys are sorted in alphabetical order, case insensitive. More...
 
static std::unique_ptr< BASETYPE > factory (std::string const &objectTypeName, ARGS... args)
 Static method to create a new object that derives from BASETYPE. More...
 
template<typename TYPE >
static TYPE & catalogCast (BASETYPE &object)
 Downcast base type reference to derived type. More...
 

Detailed Description

template<typename BASETYPE, typename ... ARGS>
class geos::dataRepository::CatalogInterface< BASETYPE, ARGS >

This class provides the base class/interface for the catalog value objects.

Template Parameters
BASETYPEbase class of the objects that the factory produces
ARGSvariadic template pack to hold the parameters needed for the constructor of the BASETYPE

Definition at line 65 of file ObjectCatalog.hpp.

Member Function Documentation

◆ allocate()

template<typename BASETYPE , typename ... ARGS>
virtual std::unique_ptr< BASETYPE > geos::dataRepository::CatalogInterface< BASETYPE, ARGS >::allocate ( ARGS...  args) const
pure virtual

Create a new object that derives from BASETYPE.

Parameters
argsarguments to the constructor of the target type
Returns
a unique_ptr<BASETYPE> to the newly allocated class.

Implemented in geos::dataRepository::CatalogEntry< BASETYPE, TYPE, ARGS >.

◆ catalogCast()

template<typename BASETYPE , typename ... ARGS>
template<typename TYPE >
static TYPE& geos::dataRepository::CatalogInterface< BASETYPE, ARGS >::catalogCast ( BASETYPE &  object)
inlinestatic

Downcast base type reference to derived type.

Template Parameters
TYPEtype to cast to
Parameters
objectbase type reference to object
Returns
reference to the same object, cast to derived type

If OBJECTCATALOGVERBOSE is enabled, will check that runtime name of the object is the same as catalog name of the derived type. Therefore may fail for objects that have been assigned a different name (e.g. through XML "name" attribute).

Definition at line 216 of file ObjectCatalog.hpp.

◆ factory()

template<typename BASETYPE , typename ... ARGS>
static std::unique_ptr< BASETYPE > geos::dataRepository::CatalogInterface< BASETYPE, ARGS >::factory ( std::string const &  objectTypeName,
ARGS...  args 
)
inlinestatic

Static method to create a new object that derives from BASETYPE.

Parameters
[in]objectTypeNamethe key to the catalog entry that is able to create the correct type.
argsthese are the arguments to the constructor of the target type
Returns
passes a unique_ptr<BASETYPE> to the newly allocated class.
Note
The simulation is killed if the builder is not found.

Definition at line 178 of file ObjectCatalog.hpp.

◆ getCatalog()

template<typename BASETYPE , typename ... ARGS>
static CatalogType& geos::dataRepository::CatalogInterface< BASETYPE, ARGS >::getCatalog ( )
inlinestatic

Get the catalog from that is stored in the target base class.

Returns
returns the catalog for this

Definition at line 121 of file ObjectCatalog.hpp.

◆ getKeys()

template<typename BASETYPE , typename ... ARGS>
static std::list< typename CatalogType::key_type > geos::dataRepository::CatalogInterface< BASETYPE, ARGS >::getKeys ( )
inlinestatic

Returns the product keys of the catalog. Keys are sorted in alphabetical order, case insensitive.

Returns
An STL container.

Definition at line 152 of file ObjectCatalog.hpp.

◆ hasKeyName()

template<typename BASETYPE , typename ... ARGS>
static bool geos::dataRepository::CatalogInterface< BASETYPE, ARGS >::hasKeyName ( std::string const &  objectTypeName)
inlinestatic

Check if catalog contains a given key.

Parameters
objectTypeNamename of the type tp look up
Returns
true if type has been registered with this catalog, false otherwise

Definition at line 143 of file ObjectCatalog.hpp.

◆ operator=() [1/2]

template<typename BASETYPE , typename ... ARGS>
CatalogInterface& geos::dataRepository::CatalogInterface< BASETYPE, ARGS >::operator= ( CatalogInterface< BASETYPE, ARGS > &&  )
default

Move assignment operator.

Returns
reference to this object

◆ operator=() [2/2]

template<typename BASETYPE , typename ... ARGS>
CatalogInterface& geos::dataRepository::CatalogInterface< BASETYPE, ARGS >::operator= ( CatalogInterface< BASETYPE, ARGS > const &  )
default

Copy assignment operator.

Returns
reference to this object

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