#ifndef _OTB_TRISKELE_TREE_TPP #define _OTB_TRISKELE_TREE_TPP inline void Tree::setNodeCount (const DimImg &newNodeCount) { nodeCount = newNodeCount; } inline void Tree::setSize (const Size &newSize) { size = newSize; } inline State Tree::getState () const { return state; } inline Size Tree::getSize () const { return size; } inline DimNodeId Tree::getRoot () const { return nodeCount-1; } inline DimNodeId Tree::getAbsRoot () const { return nodeCount-1+leafCount; } inline DimNodeId Tree::getCompCount () const { return nodeCount-leafCount; } inline const DimNodeId & Tree::getParent (const DimNodeId &idx) const { return leafParents[idx]; } inline const DimNodeId & Tree::getLeafParent (const DimNodeId &idx) const { return leafParents[idx]; } inline const DimNodeId & Tree::getCompParent (const DimNodeId &idx) const { return compParents[idx]; } inline const DimNodeId & Tree::getChildrenCount (const DimImg &idx) const { return childCount[idx]; } inline const DimSideImg & Tree::getLeafCount () const { return leafCount; } inline const DimSideImg & Tree::getNodeCount () const { return nodeCount; } template inline void Tree::forEachLeaf (const FuncToApply &f /* f (DimNodeId leafId) */) const { for (DimNodeId leafId = 0; leafId < leafCount; ++leafId) f (leafId); } template inline void Tree::forEachComp (const FuncToApply &f /* f (DimNodeId compId) */) const { DimNodeId compCount = nodeCount - leafCount; for (DimNodeId compId = 0; compId < compCount; ++compId) f (compId); } template inline 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