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

Collect multiple instances of type T within a dune-typetree. More...

`#include <dune/typetree/dynamicpowernode.hh>`

## Public Types

typedef DynamicPowerNodeTag | NodeTag
| The type tag that describes the node.
typedef T | ChildType
| The type of each child.
typedef std::shared_ptr< T > | ChildStorageType
| The storage type of each child.
typedef std::shared_ptr< const T > | ChildConstStorageType
| The const version of the storage type of each child.
typedef std::vector< ChildStorageType > | NodeStorage
| The type used for storing the children.

## Public Member Functions

std::size_t | degree () const
| The number of children.
Child Access (Dynamic methods)
ChildType & | child (std::size_t i)
| Returns the i-th child.
const ChildType & | child (std::size_t i) const
| Returns the i-th child (const version).
ChildStorageType | childStorage (std::size_t i)
| Returns the storage of the i-th child.
ChildConstStorageType | childStorage (std::size_t i) const
| Returns the storage of the i-th child (const version).
void | setChild (std::size_t i, ChildType &t)
| Sets the i-th child to the passed-in value.
void | setChild (std::size_t i, ChildType &&t)
| Store the passed value in i-th child.
void | setChild (std::size_t i, ChildStorageType st)
| Sets the stored value representing the i-th child to the passed-in value.
const NodeStorage & | nodeStorage () const

## Static Public Attributes

static const bool | isLeaf = false
| Mark this class as non leaf in the dune-typetree.
static const bool | isPower = true
| Mark this class as a power in the dune-typetree.
static const bool | isComposite = false
| Mark this class as a non composite in the dune-typetree.

## Protected Member Functions

Constructors
| DynamicPowerNode ()=delete
| DynamicPowerNode (std::size_t size)
| Construct a node with the given number of children.
| DynamicPowerNode (NodeStorage children)
| Initialize the DynamicPowerNode with a copy of the passed-in storage type.
| DynamicPowerNode (T &t1, T &t2,...)
| Initialize all children with the passed-in objects.

## Detailed Description

template<typename T>
class Dune::TypeTree::DynamicPowerNode< T >

Collect multiple instances of type T within a dune-typetree.

Template Parameters

  T | Type of the tree-node children

## Member Typedef Documentation

## ChildConstStorageType

template<typename T>

typedef std::shared_ptr<const T> Dune::TypeTree::DynamicPowerNode< T >::ChildConstStorageType

The const version of the storage type of each child.

## ChildStorageType

template<typename T>

typedef std::shared_ptr<T> Dune::TypeTree::DynamicPowerNode< T >::ChildStorageType

The storage type of each child.

## ChildType

template<typename T>

typedef T Dune::TypeTree::DynamicPowerNode< T >::ChildType

The type of each child.

## NodeStorage

template<typename T>

typedef std::vector<ChildStorageType> Dune::TypeTree::DynamicPowerNode< T >::NodeStorage

The type used for storing the children.

## NodeTag

template<typename T>

typedef DynamicPowerNodeTag Dune::TypeTree::DynamicPowerNode< T >::NodeTag

The type tag that describes the node.

## Constructor & Destructor Documentation

## DynamicPowerNode() [1/4]

template<typename T>

Dune::TypeTree::DynamicPowerNode< T >::DynamicPowerNode | ( |  | ) |

protected delete

The Default constructor is deleted, since you need to pass the number of children. There is currently no dynamic resize of this node type implemented.

## DynamicPowerNode() [2/4]

template<typename T>

Dune::TypeTree::DynamicPowerNode< T >::DynamicPowerNode | ( | std::size_t | size | ) |

inline explicit protected

Construct a node with the given number of children.

The constructor is protected, as DynamicPowerNode is a utility class that needs to be filled with meaning by subclassing it and adding useful functionality to the subclass.

Warning
  When using this constructor, make sure to set ALL children by means of the setChild() methods!

## DynamicPowerNode() [3/4]

template<typename T>

Dune::TypeTree::DynamicPowerNode< T >::DynamicPowerNode | ( | NodeStorage | children | ) |

inline explicit protected

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

## DynamicPowerNode() [4/4]

template<typename T>

Dune::TypeTree::DynamicPowerNode< T >::DynamicPowerNode | ( | T & | t1,
|  | T & | t2,
|  |  | ... )

inline protected

Initialize all children with the passed-in objects.

## Member Function Documentation

## child() [1/2]

template<typename T>

ChildType & Dune::TypeTree::DynamicPowerNode< T >::child | ( | std::size_t | i | ) |

inline

Returns the i-th child.

Returns
  a reference to the i-th child.

## child() [2/2]

template<typename T>

const ChildType & Dune::TypeTree::DynamicPowerNode< T >::child | ( | std::size_t | i | ) | const

inline

Returns the i-th child (const version).

Returns
  a const reference to the i-th child.

## childStorage() [1/2]

template<typename T>

ChildStorageType Dune::TypeTree::DynamicPowerNode< T >::childStorage | ( | std::size_t | i | ) |

inline

Returns the storage of the i-th child.

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

## childStorage() [2/2]

template<typename T>

ChildConstStorageType Dune::TypeTree::DynamicPowerNode< T >::childStorage | ( | std::size_t | i | ) | const

inline

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

This method is only important if the child is stored as some kind of pointer, as this allows the pointee type to become const.

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

## degree()

template<typename T>

std::size_t Dune::TypeTree::DynamicPowerNode< T >::degree | ( |  | ) | const

inline

The number of children.

## nodeStorage()

template<typename T>

const NodeStorage & Dune::TypeTree::DynamicPowerNode< T >::nodeStorage | ( |  | ) | const

inline

## setChild() [1/3]

template<typename T>

void Dune::TypeTree::DynamicPowerNode< T >::setChild | ( | std::size_t | i,
|  | ChildStorageType | st )

inline

Sets the stored value representing the i-th child to the passed-in value.

## setChild() [2/3]

template<typename T>

void Dune::TypeTree::DynamicPowerNode< T >::setChild | ( | std::size_t | i,
|  | ChildType && | t )

inline

Store the passed value in i-th child.

## setChild() [3/3]

template<typename T>

void Dune::TypeTree::DynamicPowerNode< T >::setChild | ( | std::size_t | i,
|  | ChildType & | t )

inline

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

## Member Data Documentation

## isComposite

template<typename T>

const bool Dune::TypeTree::DynamicPowerNode< T >::isComposite = false

static

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

## isLeaf

template<typename T>

const bool Dune::TypeTree::DynamicPowerNode< T >::isLeaf = false

static

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

## isPower

template<typename T>

const bool Dune::TypeTree::DynamicPowerNode< T >::isPower = true

static

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

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

- dynamicpowernode.hh