55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
#ifndef _OTB_TRISKELE_TREE_BUILDER_HPP
|
|
#define _OTB_TRISKELE_TREE_BUILDER_HPP
|
|
|
|
#include "Tree.hpp"
|
|
#include "triskeleBase.hpp"
|
|
|
|
namespace otb {
|
|
namespace triskele {
|
|
|
|
class TreeBuilder {
|
|
public:
|
|
|
|
static void
|
|
buildTree (Tree &tree, TreeBuilder &builder) { builder.buildTree (tree); }
|
|
|
|
static void
|
|
buildTree (Tree &tree, TreeBuilder &&builder) { builder.buildTree (tree); }
|
|
|
|
virtual void
|
|
buildTree (Tree &tree) { std::cout << "Test" << std::endl; }
|
|
|
|
protected:
|
|
// Used to set the attributes below with the tree
|
|
|
|
inline void updateAttributes (Tree &tree) {
|
|
leafCount = tree.leafCount;
|
|
nodeCount = tree.nodeCount;
|
|
leafParents = tree.leafParents;
|
|
compParents = tree.compParents;
|
|
children = tree.children;
|
|
childCount = tree.childCount;
|
|
}
|
|
|
|
DimNodeId getCompCount () const { return nodeCount-leafCount; }
|
|
inline void setNodeCount (Tree &tree, DimNodeId nodeCount) {
|
|
tree.setNodeCount (nodeCount);
|
|
this->nodeCount = nodeCount;
|
|
}
|
|
protected:
|
|
// Attributes corresponding to the tree, used to make the construction easier
|
|
|
|
DimImg leafCount, nodeCount;
|
|
/*! Pointers on the parents of each leafs / nodes */
|
|
DimNodeId *leafParents, *compParents;
|
|
|
|
/*! Pointers on the children and count how many children a parents have */
|
|
DimNodeId *children, *childCount;
|
|
|
|
};
|
|
|
|
} // triskele
|
|
} // otb
|
|
|
|
#endif // _OTB_TRISKELE_TREE_BUILDER_HPP
|