This class provides the base class/interface for the catalog value objects.
More...
#include <ObjectCatalog.hpp>
|
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 .
|
|
|
static CatalogType & | getCatalog () |
| 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, DataContext const &context, ARGS... args) |
| Static method to create a new object that derives from BASETYPE. More...
|
|
template<typename KEYS_CONTAINER_T > |
static string | unknownTypeError (string const &objectTypeName, DataContext const &context, KEYS_CONTAINER_T const &allowedKeys) |
|
template<typename TYPE > |
static TYPE & | catalogCast (BASETYPE &object) |
| Downcast base type reference to derived type. More...
|
|
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
-
BASETYPE | base class of the objects that the factory produces |
ARGS | variadic template pack to hold the parameters needed for the constructor of the BASETYPE |
Definition at line 68 of file ObjectCatalog.hpp.
◆ allocate()
template<typename BASETYPE , typename ... ARGS>
Create a new object that derives from BASETYPE.
- Parameters
-
args | arguments to the constructor of the target type |
- Returns
- a unique_ptr<BASETYPE> to the newly allocated class.
◆ catalogCast()
template<typename BASETYPE , typename ... ARGS>
template<typename TYPE >
Downcast base type reference to derived type.
- Template Parameters
-
- Parameters
-
object | base 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 228 of file ObjectCatalog.hpp.
◆ factory()
template<typename BASETYPE , typename ... ARGS>
Static method to create a new object that derives from BASETYPE.
- Parameters
-
[in] | objectTypeName | the key to the catalog entry that is able to create the correct type. |
| context | The data context of the Group for which we attempt to create a sub-group. |
| args | these are the arguments to the constructor of the target type |
- Returns
- passes a unique_ptr<BASETYPE> to the newly allocated class.
- Note
- Generate a fatal error:
- if the object type to create is not found in this Catalog,
- if the builder is not found.
Definition at line 183 of file ObjectCatalog.hpp.
◆ getCatalog()
template<typename BASETYPE , typename ... ARGS>
Get the catalog from that is stored in the target base class.
- Returns
- returns the catalog for this
Definition at line 124 of file ObjectCatalog.hpp.
◆ getKeys()
template<typename BASETYPE , typename ... ARGS>
Returns the product keys of the catalog. Keys are sorted in alphabetical order, case insensitive.
- Returns
- An STL container.
Definition at line 155 of file ObjectCatalog.hpp.
◆ hasKeyName()
template<typename BASETYPE , typename ... ARGS>
Check if catalog contains a given key.
- Parameters
-
objectTypeName | name of the type tp look up |
- Returns
true
if type has been registered with this catalog, false
otherwise
Definition at line 146 of file ObjectCatalog.hpp.
◆ operator=() [1/2]
template<typename BASETYPE , typename ... ARGS>
Move assignment operator.
- Returns
- reference to this object
◆ operator=() [2/2]
template<typename BASETYPE , typename ... ARGS>
Copy assignment operator.
- Returns
- reference to this object
◆ unknownTypeError()
template<typename BASETYPE , typename ... ARGS>
template<typename KEYS_CONTAINER_T >
- Returns
- Generates a formatted error message for an unknown type for a catalog.
- Parameters
-
objectTypeName | The name of the object type that is invalid. |
context | The data context of the Group for which the erroneous type creation was attempted. |
allowedKeys | A container of allowed keys, which will be listed in the error message. |
- Template Parameters
-
KEYS_CONTAINER_T | A container type holding the allowed keys. |
Definition at line 208 of file ObjectCatalog.hpp.
The documentation for this class was generated from the following file: