nouveau fichier : include/ArrayTree/Leader.tpp nouveau fichier : include/ArrayTree/triskeleArrayTreeBase.tpp nouveau fichier : include/Tree.tpp nouveau fichier : src/triskeleBase.cpp
28 lines
842 B
C++
28 lines
842 B
C++
#ifndef _OTB_TRISKELE_TREE_TPP
|
|
#define _OTB_TRISKELE_TREE_TPP
|
|
|
|
template<typename FuncToApply>
|
|
void
|
|
Tree::forEachLeaf (const FuncToApply &f /* f (DimNodeId leafId) */) const {
|
|
for (DimNodeId leafId = 0; leafId < leafCount; ++leafId)
|
|
f (leafId);
|
|
}
|
|
|
|
template<typename FuncToApply>
|
|
void
|
|
Tree::forEachComp (const FuncToApply &f /* f (DimNodeId compId) */) const {
|
|
DimNodeId compCount = nodeCount - leafCount;
|
|
for (DimNodeId compId = 0; compId < compCount; ++compId)
|
|
f (compId);
|
|
}
|
|
|
|
template<typename FuncToApply>
|
|
void
|
|
Tree::forEachChild (const DimNodeId &parentId, const FuncToApply &f /* f (DimNodeId childId) */) const {
|
|
DimNodeId minChild = childCount[parentId], maxChild = childCount[parentId+1];
|
|
for (DimNodeId childId = minChild; childId < maxChild; ++childId)
|
|
f (children[childId]);
|
|
}
|
|
|
|
#endif // _OTB_TRISKELE_TREE_TPP
|