/* Copyright by Matthias Hoechsmann (C) 2002 ===================================== You may use, copy and distribute this file freely as long as you - do not change the file, - leave this copyright notice in the file, - do not make any profit with the distribution of this file - give credit where credit is due You are not allowed to copy or distribute this file otherwise The commercial usage and distribution of this file is prohibited Please report bugs and suggestions to */ #ifndef _PPFORESTSZ_H #define _PPFORESTSZ_H #include #include #include "misc.h" #include "types.h" using namespace std; template class PPForestSZ { protected: Uint m_size; Uint *m_lml; // postorder index of leftmost leaf descandant of the subtree rootet at T[i] L *m_lb; // labels of nodes in postorder bool *m_keyroot; // is node a keyroot void calcKeyroots(); public: typedef Uint size_type; typedef L label_type; PPForestSZ() : m_size(0), m_lml(NULL), m_lb(NULL),m_keyroot(NULL) {}; PPForestSZ(Uint nrOfNodes); PPForestSZ(const PPForestSZ &ppf); ~PPForestSZ(); inline size_type size() const {return m_size;}; inline Uint lml(Ulong i) const {return m_lml[i];}; inline L label(Ulong i) const {return m_lb[i];}; inline bool keyroot(Ulong i) const {return m_keyroot[i];}; Uint numKeyroots() const { Uint count=0; for(Uint i=0;i