3 #ifndef INCLUDE_NN_NLIB_SUCCINCT_BP_H_ 4 #define INCLUDE_NN_NLIB_SUCCINCT_BP_H_ 9 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 10 #undef NLIB_VIS_PUBLIC 11 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 21 NLIB_MOVE_MEMBER_HELPER_1(
Bp, prv_);
23 BpPrivate* tmp = rhs.prv_;
27 template <
class TREEITER>
29 bool InitDirect(
const uint32_t* bv, uint32_t bv_size)
NLIB_NOEXCEPT;
39 int Parent(uint32_t pos)
const NLIB_NOEXCEPT {
return this->Enclose(pos); }
47 bool Build(
const uint32_t* bv, uint32_t bvsize)
NLIB_NOEXCEPT;
55 template <
class TREEITER>
61 if (num_nodes >= 0x80000000)
return false;
62 if (prv_)
return false;
63 Set* bv = Get1stLevelSet();
68 bv->
Init(num_nodes * 2);
73 const void* parent = iter.ParentNodePtr();
74 const void* node = iter.NodePtr();
75 if (stack.
empty() || stack.
back() == parent) {
82 while (stack.
back() != parent) {
92 }
while (iter.MoveNext());
104 NLIB_DEFINE_STD_SWAP(::nlib_ns::succinct::Bp)
106 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 107 #undef NLIB_VIS_PUBLIC 108 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 111 #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.
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.
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.
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.