Flow123d  master-f44eb46
Public Types | Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
Input::Iterator< T > Class Template Reference

#include <accessors.hh>

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

Public Types

typedef T DispatchType
 Converts C++ type T (template parameter) to 'DispatchType' from smaller set of types. More...
 
typedef internal::TypeDispatch< DispatchType >::ReadType OutputType
 
typedef internal::TypeDispatch< DispatchType >::InputType InputType
 

Public Member Functions

 Iterator ()
 
 Iterator (const Input::Type::TypeBase &type, const Address &address, const unsigned int index)
 
Iterator< T > & operator++ ()
 Prefix. Advance operator. More...
 
Iterator< T > & operator-- ()
 Prefix. Back operator. More...
 
OutputType operator* () const
 
OutputTypeoperator-> () const
 
- Public Member Functions inherited from Input::IteratorBase
 IteratorBase (const Address &address, const unsigned int index)
 
bool operator== (const IteratorBase &that) const
 Comparison of two Iterators. Do no compare types only position in the storage. More...
 
bool operator!= (const IteratorBase &that) const
 
 operator bool () const
 
unsigned int idx () const
 
const Addressget_address () const
 

Static Private Member Functions

static InputType type_check_and_convert (const Input::Type::TypeBase &type)
 

Private Attributes

InputType type_
 Input type declaration. More...
 
internal::TypeDispatch< DispatchType >::TmpType temporary_value_
 

Additional Inherited Members

- Protected Attributes inherited from Input::IteratorBase
Address address_
 
unsigned int index_
 

Detailed Description

template<class T>
class Input::Iterator< T >

This class behaves like iterator to type T (the template parameter), but in fact it is iterator into input storage and also into tree of declarations through Input::Type classes.

This class provides only limited functionality of iterators, namely prefix advance operator ++(), dereference operator * (), dereference operator -> (), comparison operators == and != and implicit conversion to bool (false in the case of the 'null' iterator).

Definition at line 728 of file accessors.hh.

Member Typedef Documentation

◆ DispatchType

template<class T >
typedef T Input::Iterator< T >::DispatchType

Converts C++ type T (template parameter) to 'DispatchType' from smaller set of types.

Definition at line 731 of file accessors.hh.

◆ InputType

A descendant of Input::Type::TypeBase that is appropriate to template parameter T.

Definition at line 740 of file accessors.hh.

◆ OutputType

template<class T >
typedef internal::TypeDispatch<DispatchType>::ReadType Input::Iterator< T >::OutputType

For small set of C++ types and accessor classes Record, AbstractRecord, and Array, returns type of value given by dereference of the iterator (just add const to C++ types).

Definition at line 736 of file accessors.hh.

Constructor & Destructor Documentation

◆ Iterator() [1/2]

template<class T >
Input::Iterator< T >::Iterator ( )
inline

Iterator is not default constructible.

Constructor uses empty Address which causes error in program, Address has to be filled.

Definition at line 748 of file accessors.hh.

◆ Iterator() [2/2]

template<class T >
Input::Iterator< T >::Iterator ( const Input::Type::TypeBase type,
const Address address,
const unsigned int  index 
)
inline

Constructor. Creates iterator effectively pointing to data address_->get_storage()->get_item(index), that is parameter address points to StorageArray and parameter index gives index into this array. Parameter type is Input::Type of object the iterator points to.

Definition at line 757 of file accessors.hh.

Member Function Documentation

◆ operator*()

template<class T >
Iterator< T >::OutputType Input::Iterator< T >::operator*
inline

Dereference operator * ; Shouldn't we return type T, i.e. try to cast from OutputType to T ??

Definition at line 228 of file accessors_impl.hh.

◆ operator++()

template<class T >
Iterator< T > & Input::Iterator< T >::operator++
inline

Prefix. Advance operator.

Definition at line 212 of file accessors_impl.hh.

◆ operator--()

template<class T >
Iterator< T > & Input::Iterator< T >::operator--
inline

Prefix. Back operator.

Definition at line 220 of file accessors_impl.hh.

◆ operator->()

template<class T >
Iterator< T >::OutputType * Input::Iterator< T >::operator->
inline

Dereference operator can be used only for iterators to accessors Record, AbstractRecord, and Array.

Definition at line 238 of file accessors_impl.hh.

◆ type_check_and_convert()

template<class T >
Iterator< T >::InputType Input::Iterator< T >::type_check_and_convert ( const Input::Type::TypeBase type)
staticprivate

Check that Type::TypeBase reference is in fact object of InputType and returns converted copy (note that Type declaration objects are only handles.

Definition at line 252 of file accessors_impl.hh.

Member Data Documentation

◆ temporary_value_

template<class T >
internal::TypeDispatch<DispatchType>::TmpType Input::Iterator< T >::temporary_value_
mutableprivate

temporary for -> operator, necessary only for T == DispatchType == OutputType == any accessor: Record, AbstractRecord, Array

for other types this is just an int.

Definition at line 795 of file accessors.hh.

◆ type_

template<class T >
InputType Input::Iterator< T >::type_
private

Input type declaration.

Definition at line 787 of file accessors.hh.


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