4 #ifndef DUNE_TYPETREE_TREEPATH_HH
5 #define DUNE_TYPETREE_TREEPATH_HH
9 #include <dune/common/documentation.hh>
10 #include <dune/common/typetraits.hh>
24 namespace TreePathType {
28 template<std::size_t... i>
38 template<std::size_t... i>
40 :
public integral_constant<std::size_t, sizeof...(i)>
43 template<
typename,std::
size_t>
46 template<std::size_t k, std::size_t... i>
52 template<
typename,std::
size_t>
55 template<std::size_t k, std::size_t... i>
65 template<std::
size_t k>
67 :
public integral_constant<std::size_t,k>
75 template<std::size_t j, std::size_t k, std::size_t... l>
83 template<std::size_t k, std::size_t... i>
85 :
public integral_constant<std::size_t,k>
88 template<
typename, std::size_t...>
91 template<std::size_t k, std::size_t... i>
97 template<std::size_t j,
108 template<std::size_t k, std::size_t... i>
114 template<
typename,
typename>
117 template<std::size_t... i, std::size_t... k>
123 template<std::size_t... i>
127 template<std::size_t k, std::size_t... i>
134 template<std::size_t... i>
152 return _stack.size();
164 return _stack.back();
170 return _stack.front();
176 for (std::size_t i = 0; i < tp.
size(); ++i)
198 #ifndef DOXYGEN // DynamicTreePath subclasses are implementation details and never exposed to the user
208 class MutableDynamicTreePath
209 :
public DynamicTreePath
214 typedef DynamicTreePath ViewType;
216 void push_back(std::size_t v)
226 void set_back(std::size_t v)
231 DynamicTreePath view()
238 MutableDynamicTreePath(Stack& stack)
239 : DynamicTreePath(stack)
249 template<std::
size_t treeDepth>
250 class MakeableDynamicTreePath
251 :
private FixedCapacityStack<std::size_t,treeDepth>
252 ,
public MutableDynamicTreePath
257 MutableDynamicTreePath mutablePath()
259 return static_cast<MutableDynamicTreePath&
>(*this);
262 MakeableDynamicTreePath()
263 : MutableDynamicTreePath(static_cast<FixedCapacityStackView<
std::size_t>&>(*this))
271 template<TreePathType::Type tpType>
272 struct TreePathFactory;
278 template<
typename Tree>
279 static TreePath<> create(
const Tree& tree)
287 struct TreePathFactory<TreePathType::
dynamic>
289 template<
typename Tree>
290 static MakeableDynamicTreePath<TreeInfo<Tree>::depth> create(
const Tree& tree)
292 return MakeableDynamicTreePath<TreeInfo<Tree>::depth>();
303 #endif // DUNE_TYPETREE_TREEPATH_HH
TreePath ViewType
Definition: treepath.hh:30
Definition: treepath.hh:89
Definition: treepath.hh:25
Definition: treepath.hh:44
std::size_t element(std::size_t pos) const
Get the index value at position pos.
Definition: treepath.hh:156
Definition: treepath.hh:62
Definition: accumulate_static.hh:12
std::ostream & operator<<(std::ostream &os, const TreePath< i...> &tp)
Definition: treepath.hh:135
Definition: treepath.hh:115
TreePath< i...> type
Definition: treepath.hh:94
TreePath< k, i...> type
Definition: treepath.hh:58
friend std::ostream & operator<<(std::ostream &os, const DynamicTreePath &tp)
Definition: treepath.hh:173
TreePath mutablePath()
Definition: treepath.hh:32
TreePath< i..., k > type
Definition: treepath.hh:49
Definition: treepath.hh:53
std::size_t back() const
Get the last index value.
Definition: treepath.hh:162
A TreePath that stores the path of a node as runtime information.
Definition: treepath.hh:144
TreePath< i...> type
Definition: treepath.hh:111
Definition: treepath.hh:106
Type
Definition: treepath.hh:25
Definition: treepath.hh:25
TreePath view()
Definition: treepath.hh:31
void print_tree_path(std::ostream &os)
Definition: treepath.hh:124
Definition: treepath.hh:81
std::size_t size() const
Get the size (length) of this path.
Definition: treepath.hh:150
std::size_t front() const
Get the first index value.
Definition: treepath.hh:168
Definition: treepath.hh:25
Definition: treepath.hh:29
TreePath< i..., k...> type
Definition: treepath.hh:120
Definition: treepath.hh:36
Definition: fixedcapacitystack.hh:19