Flow123d  last_with_con_2.0.0-4-g42e6930
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Input::TypeRepository< T > Class Template Reference

The Singleton class TypeRepository serves for handling the lazy-evaluated input types, derived from the base class Type::TypeBase. More...

#include <type_repository.hh>

Collaboration diagram for Input::TypeRepository< T >:
Collaboration graph
[legend]

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 TypeRepositoryget_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...
 

Detailed Description

template<class T>
class Input::TypeRepository< T >

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.

Member Typedef Documentation

template<class T>
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.

template<class T>
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.

Constructor & Destructor Documentation

template<class T>
Input::TypeRepository< T >::TypeRepository ( )
inlineprivate

Default constructor.

Definition at line 92 of file type_repository.hh.

Member Function Documentation

template<class T >
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.

Here is the caller graph for this function:

template<class T>
TypeRepositoryMapIter Input::TypeRepository< T >::begin ( ) const
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.

Here is the caller graph for this function:

template<class T>
TypeRepositoryMapIter Input::TypeRepository< T >::end ( ) const
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.

Here is the caller graph for this function:

template<class T >
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

Parameters
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.

Here is the caller graph for this function:

template<class T>
static TypeRepository& Input::TypeRepository< T >::get_instance ( )
inlinestatic

Return singleton instance of class.

Definition at line 58 of file type_repository.hh.

Here is the caller graph for this function:

Member Data Documentation

template<class T>
TypeRepositoryMap Input::TypeRepository< T >::type_repository_map_
private

Stores input type objects.

Definition at line 92 of file type_repository.hh.


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