triskele/include/Tree.tpp
Git Merciol ed9141d5c5 modifié : include/ArrayTree/ArrayTreeBuilder.hpp
modifié :         include/ArrayTree/ArrayTreeBuilder.tpp
	modifié :         include/ArrayTree/Border.hpp
	modifié :         include/ArrayTree/GraphWalker.tpp
	modifié :         include/ArrayTree/Leader.hpp
	modifié :         include/ArrayTree/Leader.tpp
	modifié :         include/ArrayTree/Weight.hpp
	modifié :         include/ArrayTree/Weight.tpp
	modifié :         include/ArrayTree/triskeleArrayTreeBase.hpp
	modifié :         include/ArrayTree/triskeleArrayTreeBase.tpp
	modifié :         include/IImage.hpp
	modifié :         include/IImage.tpp
	modifié :         include/Tree.hpp
	modifié :         include/Tree.tpp
	modifié :         include/TreeBuilder.hpp
	modifié :         include/XMLTree/XMLTreeBuilder.hpp
	modifié :         include/triskeleBase.hpp
	modifié :         include/triskeleDealThreads.hpp
	modifié :         include/triskeleDealThreads.tpp
	modifié :         include/triskeleDebug.hpp
	modifié :         include/triskeleGdalGetType.hpp
	nouveau fichier : src/IImage.cpp
	modifié :         src/QuadTree/QuadTreeBuilder.cpp
	modifié :         src/Tree.cpp
	modifié :         src/testMain.cpp
	modifié :         src/triskeleDebug.cpp
2018-02-18 08:24:25 +01:00

86 lines
1.9 KiB
C++

#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<typename FuncToApply>
inline void
Tree::forEachLeaf (const FuncToApply &f /* f (DimNodeId leafId) */) const {
for (DimNodeId leafId = 0; leafId < leafCount; ++leafId)
f (leafId);
}
template<typename FuncToApply>
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<typename FuncToApply>
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