Flow123d
last_with_con_2.0.0-4-g42e6930
|
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, boost::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 | |
boost::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... | |
void | finish (bool is_root_of_generic_subtree=false) |
Finish all stored types. 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 44 of file type_repository.hh.
typedef std::map< Type::TypeBase::TypeHash, boost::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 49 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 55 of file type_repository.hh.
|
inlineprivate |
Default constructor.
Definition at line 92 of file type_repository.hh.
boost::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 100 of file type_repository.hh.
|
inline |
Container-like access to the data stored in TypeRepository. Returns iterator to the first data.
Definition at line 82 of file type_repository.hh.
|
inline |
Container-like access to the data stored in TypeRepository. Returns iterator to the last data.
Definition at line 87 of file type_repository.hh.
void Input::TypeRepository< T >::finish | ( | bool | is_root_of_generic_subtree = false | ) |
Finish all stored types.
Iterate through all types stored in TypeRepository and call finish if flag root_of_generic_subtree_
has same value as
is_root_of_generic_subtree. | We need call finish in two steps for correct functionality of generic types. In first step all types marked as "root_of_generic_subtree" are finished and then in second step can be finished other types. |
Definition at line 114 of file type_repository.hh.
|
inlinestatic |
Return singleton instance of class.
Definition at line 58 of file type_repository.hh.
|
private |
Stores input type objects.
Definition at line 92 of file type_repository.hh.