Flow123d
DF_mechanic_bench-4968b1b
|
The Singleton class TypeRepository serves for handling the lazy-evaluated input types, derived from the base class Type::TypeBase. More...
#include <type_repository.hh>
Public Types | |
typedef std::map< Type::TypeBase::TypeHash, std::shared_ptr< T > > | TypeRepositoryMap |
Template parameter can be only descendant of TypeBase class. More... | |
typedef TypeRepositoryMap::const_iterator | TypeRepositoryMapIter |
Public typedef of constant iterator into map of stored type. More... | |
Public Member Functions | |
std::shared_ptr< T > | add_type (const T &type) |
Add type to TypeRepository if doesn't exist there or get existing type with same TypeHash. More... | |
std::shared_ptr< T > | find_hash (Type::TypeBase::TypeHash hash) |
void | finish (Type::FinishStatus finish_type) |
Finish all stored types. More... | |
void | reset_deleted_types () |
Reset and remove types marked as deleted during finish. More... | |
TypeRepositoryMapIter | begin () const |
Container-like access to the data stored in TypeRepository. Returns iterator to the first data. More... | |
TypeRepositoryMapIter | end () const |
Container-like access to the data stored in TypeRepository. Returns iterator to the last data. More... | |
Static Public Member Functions | |
static TypeRepository & | get_instance () |
Return singleton instance of class. More... | |
Private Member Functions | |
TypeRepository () | |
Default constructor. More... | |
Private Attributes | |
TypeRepositoryMap | type_repository_map_ |
Stores input type objects. More... | |
The Singleton class TypeRepository serves for handling the lazy-evaluated input types, derived from the base class Type::TypeBase.
When all static variables are initialized, the method TypeRepository::instance().finish() can be called in order to finish initialization of lazy types such as Records, Abstracts, Arrays and Selections. Selections have to be finished after all other types since they are used by Abstracts to register all derived types. For this reason TypeRepository contains two arrays - one for Selections, one for the rest.
This is list of unique instances that may contain raw pointers to possibly not yet constructed (static) objects. Unique instance is the instance that creates unique instance of the data class in pimpl idiom. These has to be completed/finished before use.
Definition at line 45 of file type_repository.hh.
typedef std::map< Type::TypeBase::TypeHash, std::shared_ptr<T> > Input::TypeRepository< T >::TypeRepositoryMap |
Template parameter can be only descendant of TypeBase class.
Type stored objects of input types.
Definition at line 53 of file type_repository.hh.
typedef TypeRepositoryMap::const_iterator Input::TypeRepository< T >::TypeRepositoryMapIter |
Public typedef of constant iterator into map of stored type.
Definition at line 56 of file type_repository.hh.
|
inlineprivate |
Default constructor.
Definition at line 101 of file type_repository.hh.
std::shared_ptr< T > Input::TypeRepository< T >::add_type | ( | const T & | type | ) |
Add type
to TypeRepository if doesn't exist there or get existing type with same TypeHash.
Definition at line 109 of file type_repository.hh.
|
inline |
Container-like access to the data stored in TypeRepository. Returns iterator to the first data.
Definition at line 91 of file type_repository.hh.
|
inline |
Container-like access to the data stored in TypeRepository. Returns iterator to the last data.
Definition at line 96 of file type_repository.hh.
std::shared_ptr< T > Input::TypeRepository< T >::find_hash | ( | Type::TypeBase::TypeHash | hash | ) |
void Input::TypeRepository< T >::finish | ( | Type::FinishStatus | finish_type | ) |
Finish all stored types.
Iterate through all types stored in TypeRepository and call finish with given status.
Note: This method is meant to be used only with FinishType::delete.
Definition at line 134 of file type_repository.hh.
|
inlinestatic |
Return singleton instance of class.
Definition at line 59 of file type_repository.hh.
void Input::TypeRepository< T >::reset_deleted_types |
Reset and remove types marked as deleted during finish.
Iterate through all types stored in TypeRepository and -
Definition at line 141 of file type_repository.hh.
|
private |
Stores input type objects.
Definition at line 104 of file type_repository.hh.