A bitmap that supports positive 64-bit positions, optimized for cases where most positions fit in 32 bits.
More...
#include <roaring_position_bitmap.h>
|
|
| RoaringPositionBitmap (RoaringPositionBitmap &&other) noexcept |
| |
|
RoaringPositionBitmap & | operator= (RoaringPositionBitmap &&other) noexcept |
| |
|
| RoaringPositionBitmap (const RoaringPositionBitmap &other) |
| |
|
RoaringPositionBitmap & | operator= (const RoaringPositionBitmap &other) |
| |
| void | Add (int64_t pos) |
| | Sets a position in the bitmap.
|
| |
| void | AddRange (int64_t pos_start, int64_t pos_end) |
| | Sets a range of positions [pos_start, pos_end).
|
| |
| bool | Contains (int64_t pos) const |
| | Checks if a position is set in the bitmap.
|
| |
|
bool | IsEmpty () const |
| | Returns true if the bitmap has no positions set.
|
| |
|
size_t | Cardinality () const |
| | Returns the number of set positions in the bitmap.
|
| |
|
void | Or (const RoaringPositionBitmap &other) |
| | Merges all positions from the other bitmap into this one (in-place union).
|
| |
| bool | Optimize () |
| | Optimizes the bitmap by applying run-length encoding to containers where it is more space efficient than array or bitset representations.
|
| |
|
void | ForEach (const std::function< void(int64_t)> &fn) const |
| | Iterates over all set positions in ascending order.
|
| |
|
size_t | SerializedSizeInBytes () const |
| | Returns the serialized size in bytes.
|
| |
|
Result< std::string > | Serialize () const |
| | Serializes using the portable format (little-endian).
|
| |
|
|
static Result< RoaringPositionBitmap > | Deserialize (std::string_view bytes) |
| | Deserializes a bitmap from bytes.
|
| |
|
|
static constexpr int64_t | kMaxPosition = 0x7FFFFFFE80000000LL |
| | Maximum supported position (aligned with the Java implementation).
|
| |
A bitmap that supports positive 64-bit positions, optimized for cases where most positions fit in 32 bits.
Incoming 64-bit positions are divided into a 32-bit "key" using the most significant 4 bytes and a 32-bit position using the least significant 4 bytes. For each key, a 32-bit Roaring bitmap is maintained to store positions for that key.
- Note
- This class is used to represent deletion vectors. The Puffin reader/writer handle adding the additional required framing (length prefix, magic bytes, CRC-32) for
deletion-vector-v1 persistence.
◆ Add()
| void iceberg::RoaringPositionBitmap::Add |
( |
int64_t |
pos | ) |
|
Sets a position in the bitmap.
- Parameters
-
| pos | the position (must be >= 0 and <= kMaxPosition) |
- Note
- Invalid positions are silently ignored
◆ AddRange()
| void iceberg::RoaringPositionBitmap::AddRange |
( |
int64_t |
pos_start, |
|
|
int64_t |
pos_end |
|
) |
| |
Sets a range of positions [pos_start, pos_end).
- Parameters
-
| pos_start | the start of the range (inclusive), clamped to 0 |
| pos_end | the end of the range (exclusive), clamped to kMaxPosition + 1 |
- Note
- If pos_start > pos_end, the call is silently ignored. If pos_start == pos_end, this method does nothing. Positions outside [0, kMaxPosition] are silently ignored.
◆ Contains()
| bool iceberg::RoaringPositionBitmap::Contains |
( |
int64_t |
pos | ) |
const |
Checks if a position is set in the bitmap.
- Parameters
-
- Returns
- true if the position is set, false otherwise (including invalid positions)
◆ Optimize()
| bool iceberg::RoaringPositionBitmap::Optimize |
( |
| ) |
|
Optimizes the bitmap by applying run-length encoding to containers where it is more space efficient than array or bitset representations.
- Returns
- true if any container was changed
The documentation for this class was generated from the following files: