Dune Core Modules (2.8.0)

Dune::TypeTree::DynamicPowerNode< T > Class Template Reference

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< ChildStorageTypeNodeStorage
 The type used for storing the children.
 

Public Member Functions

std::size_t degree () const
 The number of children.
 
Child Access (Dynamic methods)
ChildTypechild (std::size_t i)
 Returns the i-th child. More...
 
const ChildTypechild (std::size_t i) const
 Returns the i-th child (const version). More...
 
ChildStorageType childStorage (std::size_t i)
 Returns the storage of the i-th child. More...
 
ChildConstStorageType childStorage (std::size_t i) const
 Returns the storage of the i-th child (const version). More...
 
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 NodeStoragenodeStorage () 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. More...
 
 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
TType of the tree-node children

Constructor & Destructor Documentation

◆ DynamicPowerNode() [1/2]

template<typename T >
Dune::TypeTree::DynamicPowerNode< T >::DynamicPowerNode ( )
protecteddelete

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/2]

template<typename T >
Dune::TypeTree::DynamicPowerNode< T >::DynamicPowerNode ( std::size_t  size)
inlineexplicitprotected

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!

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.

References Dune::TypeTree::DynamicPowerNode< T >::degree().

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

References Dune::TypeTree::DynamicPowerNode< T >::degree().

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

References Dune::TypeTree::DynamicPowerNode< T >::degree().

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

References Dune::TypeTree::DynamicPowerNode< T >::degree().


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 (Nov 21, 23:30, 2024)