namespace creaImageIO
{
-/**
- * \ingroup Model
- */
+
+ //=======================================================================
+ //class TreeHandlerStatistics;
+ //=======================================================================
+ /**
+ * \ingroup Model
+ */
//=======================================================================
/// Abstract class which 'handles' a Tree structure
class TreeHandler
{
public:
+
+ ///====================================================================
+ // typedef TreeHandlerStatistics Statistics;
+ ///====================================================================
+
///====================================================================
/// Ctor
TreeHandler() {}
///====================================================================
/// Recursively loads the children of node 'parent' until maxlevel
/// is reached.
+ /// If maxlevel <= 0 then loads all the sub-tree rooted at parent
/// If parent == NULL or parent == tree then starts with the 'children' of
/// the tree itself.
/// Returns the total number of children loaded.
/// Of course the branch is loaded on exit
virtual int AddBranch( const AttributeMapType& ) { return -1; }
/// Removes the node and its descendants
- bool Remove(tree::Node*) { return false; }
+ virtual bool Remove(tree::Node*) { return false; }
+ /// Sets an attribute of a Node
+ virtual bool SetAttribute(tree::Node*,
+ const std::string& key,
+ const std::string& value) { return false; }
///====================================================================
};
// EO class TreeHandler
//=======================================================================
-
+ /*
+ //=======================================================================
+ /// Memorizes statistics on operations done by a tree handler
+ /// (nodes created, removed, ...)
+ class TreeHandlerStatistics
+ {
+ public:
+ ///====================================================================
+ /// Ctor
+ TreeHandler(TreeHandler* tree) : mTreeHandler(tree) { Reset(); }
+ /// Dtor
+ ~TreeHandler() {}
+ /// Resets the stats
+ void Reset();
+ /// Prints the stats
+ void Print();
+
+ ///
+ void CreateNode(int level) { mNumberCreatedNode[level]++; }
+ void DeleteNode(int level) { mNumberDeletedNode[level]++; }
+
+ protected:
+ TreeHandler* mTreeHandler;
+ std::vector<int> mNumberCreatedNode;
+ std::vector<int> mNumberDeletedNode;
+
+
+ ///====================================================================
+ };
+ // EO class TreeHandlerStatistics
+ //=======================================================================
+ */
} // EO namespace creaImageIO