Dune Core Modules (2.9.0)

Dune::TypeTree::CompositeNode< Children > Class Template Reference

Base class for composite nodes based on variadic templates. More...

#include <dune/typetree/compositenode.hh>

Classes

struct  Child
 Access to the type and storage type of the i-th child. More...
 

Public Types

typedef CompositeNodeTag NodeTag
 The type tag that describes a CompositeNode.
 
typedef std::tuple< std::shared_ptr< Children >... > NodeStorage
 The type used for storing the children.
 
typedef std::tuple< Children... > ChildTypes
 A tuple storing the types of all children.
 

Public Member Functions

Child Access
template<std::size_t k>
Child< k >::Type & child (index_constant< k >={})
 Returns the k-th child. More...
 
template<std::size_t k>
const Child< k >::Type & child (index_constant< k >={}) const
 Returns the k-th child (const version). More...
 
template<std::size_t k>
std::shared_ptr< typename Child< k >::Type > childStorage (index_constant< k >={})
 Returns the storage of the k-th child. More...
 
template<std::size_t k>
std::shared_ptr< const typename Child< k >::Type > childStorage (index_constant< k >={}) const
 Returns the storage of the k-th child (const version). More...
 
template<std::size_t k>
void setChild (typename Child< k >::Type &child, index_constant< k >={})
 Sets the k-th child to the passed-in value.
 
template<std::size_t k>
void setChild (typename Child< k >::Type &&child, index_constant< k >={})
 Store the passed value in k-th child.
 
template<std::size_t k>
void setChild (std::shared_ptr< typename Child< k >::Type > child, index_constant< k >={})
 Sets the storage of the k-th child to the passed-in value.
 
const NodeStoragenodeStorage () const
 
Nested Child Access
template<typename... Indices>
ImplementationDefinedchild (Indices... indices)
 Returns the child given by the list of indices. More...
 
template<typename... Indices>
const ImplementationDefinedchild (Indices... indices)
 Returns the child given by the list of indices. More...
 

Static Public Attributes

static const bool isLeaf = false
 Mark this class as non leaf in the dune-typetree.
 
static const bool isPower = false
 Mark this class as a non power in the dune-typetree.
 
static const bool isComposite = true
 Mark this class as a composite in the dune-typetree.
 
static const std::size_t CHILDREN = sizeof...(Children)
 The number of children.
 

Protected Member Functions

Constructors
 CompositeNode ()
 Default constructor. More...
 
template<typename... Args, typename = typename std::enable_if<(sizeof...(Args) == degree())>::type>
 CompositeNode (Args &&... args)
 Initialize all children with the passed-in objects.
 
 CompositeNode (std::shared_ptr< Children >... children)
 Initialize the CompositeNode with copies of the passed in Storage objects.
 
 CompositeNode (const NodeStorage &children)
 Initialize the CompositeNode with a copy of the passed-in storage type.
 

Detailed Description

template<typename... Children>
class Dune::TypeTree::CompositeNode< Children >

Base class for composite nodes based on variadic templates.

Constructor & Destructor Documentation

◆ CompositeNode()

template<typename... Children>
Dune::TypeTree::CompositeNode< Children >::CompositeNode ( )
inlineprotected

Default constructor.

This constructor requires the storage type to be default constructible.

Warning
If the storage type is a pointer, the resulting object will not be usable before its children are set using any of the setChild(...) methods!

Member Function Documentation

◆ child() [1/4]

template<typename... Children>
template<std::size_t k>
Child< k >::Type & Dune::TypeTree::CompositeNode< Children >::child ( index_constant< k >  = {})
inline

Returns the k-th child.

Returns
a reference to the k-th child.

◆ child() [2/4]

template<typename... Children>
template<std::size_t k>
const Child< k >::Type & Dune::TypeTree::CompositeNode< Children >::child ( index_constant< k >  = {}) const
inline

Returns the k-th child (const version).

Returns
a const reference to the k-th child.

◆ child() [3/4]

template<typename... Children>
template<typename... Indices>
ImplementationDefined & Dune::TypeTree::CompositeNode< Children >::child ( Indices...  indices)
inline

Returns the child given by the list of indices.

This method simply forwards to the freestanding function child(). See that function for further information.

References Dune::TypeTree::child().

◆ child() [4/4]

template<typename... Children>
template<typename... Indices>
const ImplementationDefined & Dune::TypeTree::CompositeNode< Children >::child ( Indices...  indices)
inline

Returns the child given by the list of indices.

This method simply forwards to the freestanding function child(). See that function for further information.

References Dune::TypeTree::child().

◆ childStorage() [1/2]

template<typename... Children>
template<std::size_t k>
std::shared_ptr< typename Child< k >::Type > Dune::TypeTree::CompositeNode< Children >::childStorage ( index_constant< k >  = {})
inline

Returns the storage of the k-th child.

Returns
a copy of the object storing the k-th child.

◆ childStorage() [2/2]

template<typename... Children>
template<std::size_t k>
std::shared_ptr< const typename Child< k >::Type > Dune::TypeTree::CompositeNode< Children >::childStorage ( index_constant< k >  = {}) const
inline

Returns the storage of the k-th child (const version).

Returns
a copy of the object storing the k-th child.

The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)