16 #ifndef INCLUDE_NN_NLIB_SUCCINCT_BP_H_ 17 #define INCLUDE_NN_NLIB_SUCCINCT_BP_H_ 22 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 23 #undef NLIB_VIS_PUBLIC 24 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 34 NLIB_DEFMOVE_PIMPL(
Bp);
36 BpPrivate* tmp = rhs.prv_;
40 template <
class TREEITER>
42 bool InitDirect(
const uint32_t* bv, uint32_t bv_size)
NLIB_NOEXCEPT;
52 int Parent(uint32_t pos)
const NLIB_NOEXCEPT {
return this->Enclose(pos); }
60 bool Build(
const uint32_t* bv, uint32_t bvsize)
NLIB_NOEXCEPT;
68 template <
class TREEITER>
74 if (num_nodes >= 0x80000000)
return false;
75 if (prv_)
return false;
76 Set* bv = Get1stLevelSet();
81 bv->
Init(num_nodes * 2);
86 const void* parent = iter.ParentNodePtr();
87 const void* node = iter.NodePtr();
88 if (stack.
empty() || stack.
back() == parent) {
95 while (stack.
back() != parent) {
105 }
while (iter.MoveNext());
117 NLIB_DEFINE_STD_SWAP(::nlib_ns::succinct::Bp)
119 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 120 #undef NLIB_VIS_PUBLIC 121 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 124 #endif // INCLUDE_NN_NLIB_SUCCINCT_BP_H_ Defines the basic classes that form the basis to Rank and Select operations.
bool push_back(const T &v) noexcept
Adds an element to the vector.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
uint32_t GetBitVectorSize() const noexcept
Returns the size of the bit vector.
const uint32_t * GetBitVector() const noexcept
Returns the pointer to the bit vector.
~Bp() noexcept
Destructor.
bool TurnOn(uint32_t idx) noexcept
Adds a 32-bit unsigned integer to the set.
T & back()
Gets the last element.
bool pop_back() noexcept
Deletes an element from the end of the vector.
Succinct data structure to hold a set of 32-bit unsigned integers for a Rank/Select operation...
Provides a compact tree structure that can provide various operations in constant time...
bool empty() const noexcept
Determines whether the vector is empty.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
#define NLIB_CEXPR
Defines constexpr if it is available for use. If not, holds an empty string.
void swap(Bp &rhs) noexcept
Swaps the contents of an object.
The class for writing binary to streams (to OutputStream).
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
constexpr Bp() noexcept
Instantiates the object.
bool Init(uint32_t bv_size) noexcept
Initializes an object.
The class for reading binary from streams (from InputStream).
int Parent(uint32_t pos) const noexcept
Returns the position of the parentheses equivalent to the parent node.
The class for realloc-based implementations of vectors with POD-type elements.