Loading...
Searching...
No Matches
Dune::TypeTree::CompositeNode< Children > Class Template Reference
dune-typetree » Nodes

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.
template<std::size_t k>
const Child< k >::Type & | child (index_constant< k >={}) const
| Returns the k-th child (const version).
template<std::size_t k>
std::shared_ptr< typename Child< k >::Type > | childStorage (index_constant< k >={})
| Returns the storage of the k-th child.
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).
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 NodeStorage & | nodeStorage () const
Nested Child Access
template<typename... Indices>
ImplementationDefined & | child (Indices... indices)
| Returns the child given by the list of indices.
template<typename... Indices>
const ImplementationDefined & | child (Indices... indices)
| Returns the child given by the list of indices.

## Static Public Member Functions

static constexpr auto | degree ()

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

## Protected Member Functions

Constructors
| CompositeNode ()
| Default constructor.
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.

## Member Typedef Documentation

## ChildTypes

template<typename... Children>

typedef std::tuple<Children...> Dune::TypeTree::CompositeNode< Children >::ChildTypes

A tuple storing the types of all children.

## NodeStorage

template<typename... Children>

typedef std::tuple<std::shared_ptr<Children>... > Dune::TypeTree::CompositeNode< Children >::NodeStorage

The type used for storing the children.

## NodeTag

template<typename... Children>

typedef CompositeNodeTag Dune::TypeTree::CompositeNode< Children >::NodeTag

The type tag that describes a CompositeNode.

## Constructor & Destructor Documentation

## CompositeNode() [1/4]

template<typename... Children>

Dune::TypeTree::CompositeNode< Children >::CompositeNode | ( |  | ) |

inline protected

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!

## CompositeNode() [2/4]

template<typename... Children>
template<typename... Args, typename = typename std::enable_if<(sizeof...(Args) == degree())>::type>

Dune::TypeTree::CompositeNode< Children >::CompositeNode | ( | Args &&... | args | ) |

inline protected

Initialize all children with the passed-in objects.

## CompositeNode() [3/4]

template<typename... Children>

Dune::TypeTree::CompositeNode< Children >::CompositeNode | ( | std::shared_ptr< Children >... | children | ) |

inline protected

Initialize the CompositeNode with copies of the passed in Storage objects.

## CompositeNode() [4/4]

template<typename... Children>

Dune::TypeTree::CompositeNode< Children >::CompositeNode | ( | const NodeStorage & | children | ) |

inline protected

Initialize the CompositeNode with a copy of the passed-in storage type.

## 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>

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.

## child() [4/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.

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

## degree()

template<typename... Children>

constexpr auto Dune::TypeTree::CompositeNode< Children >::degree | ( |  | ) |

inline static constexpr

## nodeStorage()

template<typename... Children>

const NodeStorage & Dune::TypeTree::CompositeNode< Children >::nodeStorage | ( |  | ) | const

inline

## setChild() [1/3]

template<typename... Children>
template<std::size_t k>

void Dune::TypeTree::CompositeNode< Children >::setChild | ( | std::shared_ptr< typename Child< k >::Type > | child,
|  | index_constant< k > | = {} )

inline

Sets the storage of the k-th child to the passed-in value.

## setChild() [2/3]

template<typename... Children>
template<std::size_t k>

void Dune::TypeTree::CompositeNode< Children >::setChild | ( | typename Child< k >::Type && | child,
|  | index_constant< k > | = {} )

inline

Store the passed value in k-th child.

## setChild() [3/3]

template<typename... Children>
template<std::size_t k>

void Dune::TypeTree::CompositeNode< Children >::setChild | ( | typename Child< k >::Type & | child,
|  | index_constant< k > | = {} )

inline

Sets the k-th child to the passed-in value.

## Member Data Documentation

## isComposite

template<typename... Children>

const bool Dune::TypeTree::CompositeNode< Children >::isComposite = true

static

Mark this class as a composite in the dune-typetree.

## isLeaf

template<typename... Children>

const bool Dune::TypeTree::CompositeNode< Children >::isLeaf = false

static

Mark this class as non leaf in the dune-typetree.

## isPower

template<typename... Children>

const bool Dune::TypeTree::CompositeNode< Children >::isPower = false

static

Mark this class as a non power in the dune-typetree.

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

- compositenode.hh