Program Listing for File JacobsonTree.h
↰ Return to documentation for file (ADS/succinct/JacobsonTree.h)
/*--------------------------------------------------------------------------*/
/*--------------------------- File JacobsonTree.h --------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*----------------------------- DEFINITIONS --------------------------------*/
/*--------------------------------------------------------------------------*/
#ifndef __ADS_JacobsonTree
#define __ADS_JacobsonTree
/* self-identification: #endif constant */
/*--------------------------------------------------------------------------*/
/*------------------------------ INCLUDES ----------------------------------*/
/*--------------------------------------------------------------------------*/
#include "ADS/Contract.h"
#include "ADS/succinct/BitVector.h"
#include "ADS/succinct/RankSelect.h"
#include <cstddef>
#include <utility>
#include <vector>
/*--------------------------------------------------------------------------*/
/*--------------------------- NAMESPACE ------------------------------------*/
/*--------------------------------------------------------------------------*/
namespace ADS {
/*--------------------------------------------------------------------------*/
/*--------------------------- CLASS JacobsonTree ---------------------------*/
/*--------------------------------------------------------------------------*/
class JacobsonTree {
/*--------------------------------------------------------------------------*/
public:
static constexpr std::size_t nil = std::size_t( -1 );
JacobsonTree( void );
explicit JacobsonTree( const std::vector< std::pair< std::size_t ,
std::size_t > > & c );
explicit JacobsonTree( BitVector b );
[[nodiscard]] std::size_t size( void ) const;
[[nodiscard]] std::size_t root( void ) const;
[[nodiscard]] std::size_t left( std::size_t v ) const;
[[nodiscard]] std::size_t right( std::size_t v ) const;
[[nodiscard]] std::size_t parent( std::size_t v ) const;
[[nodiscard]] bool isLeaf( std::size_t v ) const;
[[nodiscard]] const BitVector & bits( void ) const;
/*--------------------------------------------------------------------------*/
private:
[[nodiscard]] std::size_t nodeAt( std::size_t q ) const;
[[nodiscard]] bool valid( void ) const;
RankSelect f_b;
}; // end( class JacobsonTree )
/*--------------------------------------------------------------------------*/
} // end( namespace ADS )
/*--------------------------------------------------------------------------*/
/*-------------------------- IMPLEMENTATION --------------------------------*/
/*--------------------------------------------------------------------------*/
#include "ADS/succinct/impl/JacobsonTree.tpp"
/*--------------------------------------------------------------------------*/
#endif /* JacobsonTree.h included */
/*--------------------------------------------------------------------------*/
/*------------------------- End File JacobsonTree.h ------------------------*/
/*--------------------------------------------------------------------------*/