Program Listing for File ParentTree.h

↰ Return to documentation for file (ADS/tree/ParentTree.h)

/*--------------------------------------------------------------------------*/
/*--------------------------- File ParentTree.h ----------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*----------------------------- DEFINITIONS --------------------------------*/
/*--------------------------------------------------------------------------*/

#ifndef __ADS_ParentTree
 #define __ADS_ParentTree
                      /* self-identification: #endif constant */

/*--------------------------------------------------------------------------*/
/*------------------------------ INCLUDES ----------------------------------*/
/*--------------------------------------------------------------------------*/

#include "ADS/Contract.h"

#include <vector>

/*--------------------------------------------------------------------------*/
/*--------------------------- NAMESPACE ------------------------------------*/
/*--------------------------------------------------------------------------*/

namespace ADS {

/*--------------------------------------------------------------------------*/
/*-------------------------- CLASS ParentTree ------------------------------*/
/*--------------------------------------------------------------------------*/

class ParentTree {

/*--------------------------------------------------------------------------*/
 public:

 explicit ParentTree( int n );

 [[nodiscard]] int parent( int i ) const;

 void setParent( int i , int j );

 [[nodiscard]] int size( void ) const;

/*--------------------------------------------------------------------------*/
 private:

 [[nodiscard]] bool below( int j , int i ) const;

 std::vector< int > f_p;

 };  // end( class ParentTree )

/*--------------------------------------------------------------------------*/

}  // end( namespace ADS )

/*--------------------------------------------------------------------------*/
/*-------------------------- IMPLEMENTATION --------------------------------*/
/*--------------------------------------------------------------------------*/

#include "ADS/tree/impl/ParentTree.tpp"

/*--------------------------------------------------------------------------*/

#endif  /* ParentTree.h included */

/*--------------------------------------------------------------------------*/
/*------------------------- End File ParentTree.h --------------------------*/
/*--------------------------------------------------------------------------*/