16 #ifndef INCLUDE_NN_NLIB_SUCCINCT_LOUDS_H_ 17 #define INCLUDE_NN_NLIB_SUCCINCT_LOUDS_H_ 20 #include "nn/nlib/Swap.h" 23 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 24 #undef NLIB_VIS_PUBLIC 25 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 35 #ifdef __cpp_rvalue_references 38 sbv_ = std::move(rhs.sbv_);
52 template <
class TREEITER>
55 bool InitDirect(
const uint32_t* bv, uint32_t bv_size)
NLIB_NOEXCEPT;
62 bool IsLeaf(uint32_t pos)
const NLIB_NOEXCEPT {
63 return this->FirstChild(pos) < 0;
65 size_t MemSize() const NLIB_NOEXCEPT {
return sbv_.MemSize(); }
66 void Reset() NLIB_NOEXCEPT { sbv_.Reset(); }
75 template <
class TREEITER>
80 sbv_.Init(2 * num_nodes + 1);
86 idx += iter.GetNumChildren();
88 }
while (iter.BfsMoveNext());
90 NLIB_ASSERT(idx == 2 * num_nodes + 1);
101 NLIB_DEFINE_STD_SWAP(::nlib_ns::succinct::Louds)
103 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 104 #undef NLIB_VIS_PUBLIC 105 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 108 #endif // INCLUDE_NN_NLIB_SUCCINCT_LOUDS_H_ Defines the basic classes that form the basis to Rank and Select operations.
bool Export(BinaryWriter *w) const noexcept
Writes the object to the file.
constexpr Louds() noexcept
Instantiates the object.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
Succinct data structure to hold a set of 32-bit unsigned integers for a Rank/Select operation...
Louds & operator=(Louds &&rhs) noexcept
Move assignment operator. This function is useful when using C++11.
Louds & assign(Louds &rhs, move_tag) noexcept
Corresponds to a move assignment operator.
size_t MemSize() const noexcept
Returns the amount of memory explicitly allocated by the class.
bool Import(BinaryReader *r) noexcept
Reads the written object.
void swap(Louds &rhs) noexcept
Swaps the contents of an object.
An empty structure indicating that an argument to a function needs to be moved.
Louds(Louds &rhs, move_tag) noexcept
Corresponds to a move constructor.
~Louds() noexcept
Destructor.
#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 Reset() noexcept
Returns the object to the state immediately after the constructor is called.
bool IsLeaf(uint32_t pos) const noexcept
Determines whether the specified node is a leaf (or external) node.
Provides a compact tree structure that can provide various operations in constant time...
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.
The class for reading binary from streams (from InputStream).
Louds(Louds &&rhs) noexcept
Instantiates the object (move constructor). This function is useful when using C++11.