CRoaring  4.2.1
Roaring bitmaps in C (and C++)
roaring.hh
Go to the documentation of this file.
1 /*
2 A C++ header for Roaring Bitmaps.
3 */
4 #ifndef INCLUDE_ROARING_HH_
5 #define INCLUDE_ROARING_HH_
6 
7 #include <algorithm>
8 #include <cstdarg>
9 #include <initializer_list>
10 #include <limits>
11 #include <new>
12 #include <stdexcept>
13 #include <string>
14 
15 #if !defined(ROARING_EXCEPTIONS)
16 // __cpp_exceptions is required by C++98 and we require C++11 or better.
17 #ifndef __cpp_exceptions
18 #error "__cpp_exceptions should be defined"
19 #endif
20 #if __cpp_exceptions
21 #define ROARING_EXCEPTIONS 1
22 #else
23 #define ROARING_EXCEPTIONS 0
24 #endif
25 #endif
26 
27 #ifndef ROARING_TERMINATE
28 #if ROARING_EXCEPTIONS
29 #define ROARING_TERMINATE(_s) throw std::runtime_error(_s)
30 #else
31 #define ROARING_TERMINATE(_s) std::terminate()
32 #endif
33 #endif
34 
35 #define ROARING_API_NOT_IN_GLOBAL_NAMESPACE // see remarks in roaring.h
36 #include <roaring/roaring.h>
37 #undef ROARING_API_NOT_IN_GLOBAL_NAMESPACE
38 
39 #include <roaring/roaring_array.h> // roaring::internal array functions used
40 
41 namespace roaring {
42 
44 
47 
55 class BulkContext {
56  public:
57  friend class Roaring;
59  BulkContext() : context_{nullptr, 0, 0, 0} {}
60 
61  BulkContext(const BulkContext &) = delete;
62  BulkContext &operator=(const BulkContext &) = delete;
63  BulkContext(BulkContext &&) noexcept = default;
64  BulkContext &operator=(BulkContext &&) noexcept = default;
65 
66  private:
68 };
69 
70 class Roaring {
71  typedef api::roaring_bitmap_t roaring_bitmap_t; // class-local name alias
72 
73  public:
78  Roaring() : roaring{} {
79  // The empty constructor roaring{} silences warnings from pedantic
80  // static analyzers.
82  }
83 
87  Roaring(size_t n, const uint32_t *data) : Roaring() {
89  }
90 
94  Roaring(std::initializer_list<uint32_t> l) : Roaring() {
95  addMany(l.size(), l.begin());
96  }
97 
104  explicit Roaring(roaring_bitmap_t *s) noexcept : roaring(*s) {
105  roaring_free(s); // deallocate the passed-in pointer
106  }
107 
112  Roaring(const Roaring &r) : Roaring() {
114  ROARING_TERMINATE("failed roaring_bitmap_overwrite in constructor");
115  }
118  }
119 
124  Roaring(Roaring &&r) noexcept : roaring(r.roaring) {
125  //
126  // !!! This clones the bits of the roaring structure to a new location
127  // and then overwrites the old bits...assuming that this will still
128  // work. There are scenarios where this could break; e.g. if some of
129  // those bits were pointers into the structure memory itself. If such
130  // things were possible, a roaring_bitmap_move() API would be needed.
131  //
133  }
134 
138  static Roaring bitmapOf(size_t n, ...) {
139  Roaring ans;
140  va_list vl;
141  va_start(vl, n);
142  for (size_t i = 0; i < n; i++) {
143  ans.add(va_arg(vl, uint32_t));
144  }
145  va_end(vl);
146  return ans;
147  }
148 
154  Roaring &operator=(const Roaring &r) {
156  ROARING_TERMINATE("failed memory alloc in assignment");
157  }
160  return *this;
161  }
162 
167  Roaring &operator=(Roaring &&r) noexcept {
168  api::roaring_bitmap_clear(&roaring); // free this class's allocations
169 
170  // !!! See notes in the Move Constructor regarding roaring_bitmap_move()
171  //
172  roaring = r.roaring;
174 
175  return *this;
176  }
177 
181  Roaring &operator=(std::initializer_list<uint32_t> l) {
182  // Delegate to move assignment operator
183  *this = Roaring(l);
184  return *this;
185  }
186 
191  static Roaring bitmapOfList(std::initializer_list<uint32_t> l) {
192  Roaring ans;
193  ans.addMany(l.size(), l.begin());
194  return ans;
195  }
196 
200  void add(uint32_t x) noexcept { api::roaring_bitmap_add(&roaring, x); }
201 
207  bool addChecked(uint32_t x) noexcept {
209  }
210 
214  void addRange(const uint64_t min, const uint64_t max) noexcept {
215  return api::roaring_bitmap_add_range(&roaring, min, max);
216  }
217 
221  void addRangeClosed(const uint32_t min, const uint32_t max) noexcept {
223  }
224 
228  void addMany(size_t n_args, const uint32_t *vals) noexcept {
229  api::roaring_bitmap_add_many(&roaring, n_args, vals);
230  }
231 
240  void addBulk(BulkContext &context, uint32_t x) noexcept {
241  api::roaring_bitmap_add_bulk(&roaring, &context.context_, x);
242  }
243 
252  bool containsBulk(BulkContext &context, uint32_t x) const noexcept {
253  return api::roaring_bitmap_contains_bulk(&roaring, &context.context_,
254  x);
255  }
256 
260  void remove(uint32_t x) noexcept {
262  }
263 
269  bool removeChecked(uint32_t x) noexcept {
271  }
272 
276  void removeRange(uint64_t min, uint64_t max) noexcept {
277  return api::roaring_bitmap_remove_range(&roaring, min, max);
278  }
279 
283  void removeRangeClosed(uint32_t min, uint32_t max) noexcept {
285  }
286 
291 
295  uint32_t maximum() const noexcept {
297  }
298 
302  uint32_t minimum() const noexcept {
304  }
305 
309  bool contains(uint32_t x) const noexcept {
311  }
312 
316  bool containsRange(const uint64_t x, const uint64_t y) const noexcept {
318  }
319 
320  bool containsRangeClosed(const uint32_t x,
321  const uint32_t y) const noexcept {
323  }
324 
333  Roaring &operator&=(const Roaring &r) noexcept {
335  return *this;
336  }
337 
343  Roaring &operator-=(const Roaring &r) noexcept {
345  return *this;
346  }
347 
355  Roaring &operator|=(const Roaring &r) noexcept {
357  return *this;
358  }
359 
365  Roaring &operator^=(const Roaring &r) noexcept {
367  return *this;
368  }
369 
373  void swap(Roaring &r) noexcept { std::swap(r.roaring, roaring); }
374 
378  uint64_t cardinality() const noexcept {
380  }
381 
385  bool isEmpty() const noexcept {
387  }
388 
394  bool isFull() const noexcept {
396  ((uint64_t)(std::numeric_limits<uint32_t>::max)()) + 1;
397  }
398 
402  bool isSubset(const Roaring &r) const noexcept {
403  return api::roaring_bitmap_is_subset(&roaring, &r.roaring);
404  }
405 
409  bool isStrictSubset(const Roaring &r) const noexcept {
410  return api::roaring_bitmap_is_strict_subset(&roaring, &r.roaring);
411  }
412 
418  void toUint32Array(uint32_t *ans) const noexcept {
420  }
424  void rangeUint32Array(uint32_t *ans, size_t offset,
425  size_t limit) const noexcept {
426  api::roaring_bitmap_range_uint32_array(&roaring, offset, limit, ans);
427  }
428 
432  bool operator==(const Roaring &r) const noexcept {
433  return api::roaring_bitmap_equals(&roaring, &r.roaring);
434  }
435 
440  void flip(uint64_t range_start, uint64_t range_end) noexcept {
441  api::roaring_bitmap_flip_inplace(&roaring, range_start, range_end);
442  }
443 
448  void flipClosed(uint32_t range_start, uint32_t range_end) noexcept {
450  range_end);
451  }
452 
457  bool removeRunCompression() noexcept {
459  }
460 
467  bool runOptimize() noexcept {
469  }
470 
475  size_t shrinkToFit() noexcept {
477  }
478 
488  void iterate(api::roaring_iterator iterator, void *ptr) const {
489  api::roaring_iterate(&roaring, iterator, ptr);
490  }
491 
500  bool select(uint32_t rnk, uint32_t *element) const noexcept {
501  return api::roaring_bitmap_select(&roaring, rnk, element);
502  }
503 
507  uint64_t and_cardinality(const Roaring &r) const noexcept {
508  return api::roaring_bitmap_and_cardinality(&roaring, &r.roaring);
509  }
510 
514  bool intersect(const Roaring &r) const noexcept {
515  return api::roaring_bitmap_intersect(&roaring, &r.roaring);
516  }
517 
525  double jaccard_index(const Roaring &r) const noexcept {
526  return api::roaring_bitmap_jaccard_index(&roaring, &r.roaring);
527  }
528 
532  uint64_t or_cardinality(const Roaring &r) const noexcept {
533  return api::roaring_bitmap_or_cardinality(&roaring, &r.roaring);
534  }
535 
539  uint64_t andnot_cardinality(const Roaring &r) const noexcept {
540  return api::roaring_bitmap_andnot_cardinality(&roaring, &r.roaring);
541  }
542 
547  uint64_t xor_cardinality(const Roaring &r) const noexcept {
548  return api::roaring_bitmap_xor_cardinality(&roaring, &r.roaring);
549  }
550 
559  uint64_t rank(uint32_t x) const noexcept {
560  return api::roaring_bitmap_rank(&roaring, x);
561  }
562 
568  void rank_many(const uint32_t *begin, const uint32_t *end,
569  uint64_t *ans) const noexcept {
570  return api::roaring_bitmap_rank_many(&roaring, begin, end, ans);
571  }
572 
580  int64_t getIndex(uint32_t x) const noexcept {
582  }
583 
623  size_t write(char *buf, bool portable = true) const noexcept {
624  if (portable) {
626  } else {
628  }
629  }
630 
647  static Roaring read(const char *buf, bool portable = true) {
648  roaring_bitmap_t *r =
651  if (r == NULL) {
652  ROARING_TERMINATE("failed alloc while reading");
653  }
654  return Roaring(r);
655  }
656 
680  static Roaring readSafe(const char *buf, size_t maxbytes) {
681  roaring_bitmap_t *r =
683  if (r == NULL) {
684  ROARING_TERMINATE("failed alloc while reading");
685  }
686  return Roaring(r);
687  }
688 
697  size_t getSizeInBytes(bool portable = true) const noexcept {
698  if (portable) {
700  } else {
702  }
703  }
704 
709  static const Roaring frozenView(const char *buf, size_t length) {
710  const roaring_bitmap_t *s =
711  api::roaring_bitmap_frozen_view(buf, length);
712  if (s == NULL) {
713  ROARING_TERMINATE("failed to read frozen bitmap");
714  }
715  Roaring r;
716  r.roaring = *s;
717  return r;
718  }
719 
724  static const Roaring portableDeserializeFrozen(const char *buf) {
725  const roaring_bitmap_t *s =
727  if (s == NULL) {
728  ROARING_TERMINATE("failed to read portable frozen bitmap");
729  }
730  Roaring r;
731  r.roaring = *s;
732  return r;
733  }
734 
738  void writeFrozen(char *buf) const noexcept {
740  }
741 
745  size_t getFrozenSizeInBytes() const noexcept {
747  }
748 
759  Roaring operator&(const Roaring &o) const {
760  roaring_bitmap_t *r = api::roaring_bitmap_and(&roaring, &o.roaring);
761  if (r == NULL) {
762  ROARING_TERMINATE("failed materalization in and");
763  }
764  return Roaring(r);
765  }
766 
772  Roaring operator-(const Roaring &o) const {
773  roaring_bitmap_t *r = api::roaring_bitmap_andnot(&roaring, &o.roaring);
774  if (r == NULL) {
775  ROARING_TERMINATE("failed materalization in andnot");
776  }
777  return Roaring(r);
778  }
779 
785  Roaring operator|(const Roaring &o) const {
786  roaring_bitmap_t *r = api::roaring_bitmap_or(&roaring, &o.roaring);
787  if (r == NULL) {
788  ROARING_TERMINATE("failed materalization in or");
789  }
790  return Roaring(r);
791  }
792 
798  Roaring operator^(const Roaring &o) const {
799  roaring_bitmap_t *r = api::roaring_bitmap_xor(&roaring, &o.roaring);
800  if (r == NULL) {
801  ROARING_TERMINATE("failed materalization in xor");
802  }
803  return Roaring(r);
804  }
805 
809  void setCopyOnWrite(bool val) noexcept {
811  }
812 
816  void printf() const noexcept { api::roaring_bitmap_printf(&roaring); }
817 
821  std::string toString() const noexcept {
822  struct iter_data {
823  std::string str{}; // The empty constructor silences warnings from
824  // pedantic static analyzers.
825  char first_char = '{';
826  } outer_iter_data;
827  if (!isEmpty()) {
828  iterate(
829  [](uint32_t value, void *inner_iter_data) -> bool {
830  ((iter_data *)inner_iter_data)->str +=
831  ((iter_data *)inner_iter_data)->first_char;
832  ((iter_data *)inner_iter_data)->str +=
833  std::to_string(value);
834  ((iter_data *)inner_iter_data)->first_char = ',';
835  return true;
836  },
837  (void *)&outer_iter_data);
838  } else
839  outer_iter_data.str = '{';
840  outer_iter_data.str += '}';
841  return outer_iter_data.str;
842  }
843 
847  bool getCopyOnWrite() const noexcept {
849  }
850 
856  static Roaring fastunion(size_t n, const Roaring **inputs) {
857  const roaring_bitmap_t **x = (const roaring_bitmap_t **)roaring_malloc(
858  n * sizeof(roaring_bitmap_t *));
859  if (x == NULL) {
860  ROARING_TERMINATE("failed memory alloc in fastunion");
861  }
862  for (size_t k = 0; k < n; ++k) x[k] = &inputs[k]->roaring;
863 
864  roaring_bitmap_t *c_ans = api::roaring_bitmap_or_many(n, x);
865  if (c_ans == NULL) {
866  roaring_free(x);
867  ROARING_TERMINATE("failed memory alloc in fastunion");
868  }
869  Roaring ans(c_ans);
870  roaring_free(x);
871  return ans;
872  }
873 
879  if (!(roaring.high_low_container.flags & ROARING_FLAG_FROZEN)) {
881  } else {
882  // The roaring member variable copies the `roaring_bitmap_t` and
883  // nested `roaring_array_t` structures by value and is freed in the
884  // constructor, however the underlying memory arena used for the
885  // container data is not freed with it. Here we derive the arena
886  // pointer from the second arena allocation in
887  // `roaring_bitmap_frozen_view` and free it as well.
889  (roaring_bitmap_t *)((char *)
890  roaring.high_low_container.containers -
891  sizeof(roaring_bitmap_t)));
892  }
893  }
894 
898 
908  const_iterator begin() const;
909 
914  const_iterator &end() const;
915 
916  roaring_bitmap_t roaring;
917 };
918 
923  public:
924  typedef std::bidirectional_iterator_tag iterator_category;
925  typedef uint32_t *pointer;
926  typedef uint32_t &reference_type;
927  typedef uint32_t value_type;
928  typedef int32_t difference_type;
930 
932  bool exhausted = false) {
933  if (exhausted) {
934  i.parent = &parent.roaring;
935  i.container_index = INT32_MAX;
936  i.has_value = false;
937  i.current_value = UINT32_MAX;
938  } else {
939  api::roaring_iterator_init(&parent.roaring, &i);
940  }
941  }
942 
946  value_type operator*() const { return i.current_value; }
947 
948  bool operator<(const type_of_iterator &o) const {
949  if (!i.has_value) return false;
950  if (!o.i.has_value) return true;
951  return i.current_value < *o;
952  }
953 
954  bool operator<=(const type_of_iterator &o) const {
955  if (!o.i.has_value) return true;
956  if (!i.has_value) return false;
957  return i.current_value <= *o;
958  }
959 
960  bool operator>(const type_of_iterator &o) const {
961  if (!o.i.has_value) return false;
962  if (!i.has_value) return true;
963  return i.current_value > *o;
964  }
965 
966  bool operator>=(const type_of_iterator &o) const {
967  if (!i.has_value) return true;
968  if (!o.i.has_value) return false;
969  return i.current_value >= *o;
970  }
971 
972  type_of_iterator &operator++() { // ++i, must returned inc. value
974  return *this;
975  }
976 
977  type_of_iterator operator++(int) { // i++, must return orig. value
980  return orig;
981  }
982 
989  }
990 
992  CROARING_DEPRECATED void equalorlarger(uint32_t val) {
994  }
995 
996  type_of_iterator &operator--() { // prefix --
998  return *this;
999  }
1000 
1001  type_of_iterator operator--(int) { // postfix --
1004  return orig;
1005  }
1006 
1008  return i.current_value == *o && i.has_value == o.i.has_value;
1009  }
1010 
1012  return i.current_value != *o || i.has_value != o.i.has_value;
1013  }
1014 
1016  i{}; // The empty constructor silences warnings from pedantic static
1017  // analyzers.
1018 };
1019 
1021  return RoaringSetBitBiDirectionalIterator(*this);
1022 }
1023 
1025  static RoaringSetBitBiDirectionalIterator e(*this, true);
1026  return e;
1027 }
1028 
1029 } // namespace roaring
1030 
1031 #endif /* INCLUDE_ROARING_HH_ */
BulkContext(const BulkContext &)=delete
friend class Roaring
Definition: roaring.hh:57
BulkContext(BulkContext &&) noexcept=default
api::roaring_bulk_context_t roaring_bitmap_bulk_context_t
Definition: roaring.hh:58
BulkContext & operator=(const BulkContext &)=delete
bool operator>=(const type_of_iterator &o) const
Definition: roaring.hh:966
bool operator<=(const type_of_iterator &o) const
Definition: roaring.hh:954
bool operator==(const RoaringSetBitBiDirectionalIterator &o) const
Definition: roaring.hh:1007
api::roaring_uint32_iterator_t i
Definition: roaring.hh:1016
CROARING_DEPRECATED void equalorlarger(uint32_t val)
Definition: roaring.hh:992
bool operator<(const type_of_iterator &o) const
Definition: roaring.hh:948
RoaringSetBitBiDirectionalIterator type_of_iterator
Definition: roaring.hh:929
bool operator>(const type_of_iterator &o) const
Definition: roaring.hh:960
std::bidirectional_iterator_tag iterator_category
Definition: roaring.hh:924
RoaringSetBitBiDirectionalIterator(const Roaring &parent, bool exhausted=false)
Definition: roaring.hh:931
bool operator!=(const RoaringSetBitBiDirectionalIterator &o) const
Definition: roaring.hh:1011
Roaring operator-(const Roaring &o) const
Definition: roaring.hh:772
Roaring(roaring_bitmap_t *s) noexcept
Definition: roaring.hh:104
static Roaring fastunion(size_t n, const Roaring **inputs)
Definition: roaring.hh:856
size_t getFrozenSizeInBytes() const noexcept
Definition: roaring.hh:745
size_t shrinkToFit() noexcept
Definition: roaring.hh:475
uint64_t xor_cardinality(const Roaring &r) const noexcept
Definition: roaring.hh:547
static Roaring readSafe(const char *buf, size_t maxbytes)
Definition: roaring.hh:680
bool addChecked(uint32_t x) noexcept
Definition: roaring.hh:207
uint64_t rank(uint32_t x) const noexcept
Definition: roaring.hh:559
Roaring & operator=(std::initializer_list< uint32_t > l)
Definition: roaring.hh:181
void addRange(const uint64_t min, const uint64_t max) noexcept
Definition: roaring.hh:214
size_t write(char *buf, bool portable=true) const noexcept
Definition: roaring.hh:623
void addRangeClosed(const uint32_t min, const uint32_t max) noexcept
Definition: roaring.hh:221
uint64_t or_cardinality(const Roaring &r) const noexcept
Definition: roaring.hh:532
Roaring(Roaring &&r) noexcept
Definition: roaring.hh:124
static Roaring bitmapOfList(std::initializer_list< uint32_t > l)
Definition: roaring.hh:191
static Roaring read(const char *buf, bool portable=true)
Definition: roaring.hh:647
bool runOptimize() noexcept
Definition: roaring.hh:467
Roaring operator|(const Roaring &o) const
Definition: roaring.hh:785
uint64_t cardinality() const noexcept
Definition: roaring.hh:378
bool containsRange(const uint64_t x, const uint64_t y) const noexcept
Definition: roaring.hh:316
bool removeRunCompression() noexcept
Definition: roaring.hh:457
void add(uint32_t x) noexcept
Definition: roaring.hh:200
bool containsRangeClosed(const uint32_t x, const uint32_t y) const noexcept
Definition: roaring.hh:320
static Roaring bitmapOf(size_t n,...)
Definition: roaring.hh:138
void addBulk(BulkContext &context, uint32_t x) noexcept
Definition: roaring.hh:240
void addMany(size_t n_args, const uint32_t *vals) noexcept
Definition: roaring.hh:228
const_iterator begin() const
Definition: roaring.hh:1020
bool isFull() const noexcept
Definition: roaring.hh:394
bool intersect(const Roaring &r) const noexcept
Definition: roaring.hh:514
std::string toString() const noexcept
Definition: roaring.hh:821
static const Roaring frozenView(const char *buf, size_t length)
Definition: roaring.hh:709
Roaring(size_t n, const uint32_t *data)
Definition: roaring.hh:87
bool containsBulk(BulkContext &context, uint32_t x) const noexcept
Definition: roaring.hh:252
RoaringSetBitBiDirectionalIterator const_iterator
Definition: roaring.hh:896
Roaring & operator^=(const Roaring &r) noexcept
Definition: roaring.hh:365
bool operator==(const Roaring &r) const noexcept
Definition: roaring.hh:432
void flipClosed(uint32_t range_start, uint32_t range_end) noexcept
Definition: roaring.hh:448
void writeFrozen(char *buf) const noexcept
Definition: roaring.hh:738
bool removeChecked(uint32_t x) noexcept
Definition: roaring.hh:269
Roaring & operator=(const Roaring &r)
Definition: roaring.hh:154
Roaring operator&(const Roaring &o) const
Definition: roaring.hh:759
uint64_t andnot_cardinality(const Roaring &r) const noexcept
Definition: roaring.hh:539
bool contains(uint32_t x) const noexcept
Definition: roaring.hh:309
static const Roaring portableDeserializeFrozen(const char *buf)
Definition: roaring.hh:724
bool getCopyOnWrite() const noexcept
Definition: roaring.hh:847
void rangeUint32Array(uint32_t *ans, size_t offset, size_t limit) const noexcept
Definition: roaring.hh:424
Roaring & operator&=(const Roaring &r) noexcept
Definition: roaring.hh:333
uint64_t and_cardinality(const Roaring &r) const noexcept
Definition: roaring.hh:507
size_t getSizeInBytes(bool portable=true) const noexcept
Definition: roaring.hh:697
void flip(uint64_t range_start, uint64_t range_end) noexcept
Definition: roaring.hh:440
void iterate(api::roaring_iterator iterator, void *ptr) const
Definition: roaring.hh:488
Roaring & operator=(Roaring &&r) noexcept
Definition: roaring.hh:167
void rank_many(const uint32_t *begin, const uint32_t *end, uint64_t *ans) const noexcept
Definition: roaring.hh:568
Roaring(std::initializer_list< uint32_t > l)
Definition: roaring.hh:94
roaring_bitmap_t roaring
Definition: roaring.hh:916
void toUint32Array(uint32_t *ans) const noexcept
Definition: roaring.hh:418
void remove(uint32_t x) noexcept
Definition: roaring.hh:260
bool isEmpty() const noexcept
Definition: roaring.hh:385
void removeRange(uint64_t min, uint64_t max) noexcept
Definition: roaring.hh:276
Roaring & operator|=(const Roaring &r) noexcept
Definition: roaring.hh:355
Roaring operator^(const Roaring &o) const
Definition: roaring.hh:798
void setCopyOnWrite(bool val) noexcept
Definition: roaring.hh:809
Roaring & operator-=(const Roaring &r) noexcept
Definition: roaring.hh:343
void printf() const noexcept
Definition: roaring.hh:816
uint32_t minimum() const noexcept
Definition: roaring.hh:302
double jaccard_index(const Roaring &r) const noexcept
Definition: roaring.hh:525
RoaringSetBitBiDirectionalIterator const_bidirectional_iterator
Definition: roaring.hh:897
bool isSubset(const Roaring &r) const noexcept
Definition: roaring.hh:402
bool select(uint32_t rnk, uint32_t *element) const noexcept
Definition: roaring.hh:500
int64_t getIndex(uint32_t x) const noexcept
Definition: roaring.hh:580
void swap(Roaring &r) noexcept
Definition: roaring.hh:373
Roaring(const Roaring &r)
Definition: roaring.hh:112
uint32_t maximum() const noexcept
Definition: roaring.hh:295
bool isStrictSubset(const Roaring &r) const noexcept
Definition: roaring.hh:409
const_iterator & end() const
Definition: roaring.hh:1024
void removeRangeClosed(uint32_t min, uint32_t max) noexcept
Definition: roaring.hh:283
roaring_bitmap_t * roaring_bitmap_and(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
bool roaring_bitmap_select(const roaring_bitmap_t *r, uint32_t rank, uint32_t *element)
roaring_bitmap_t * roaring_bitmap_portable_deserialize_safe(const char *buf, size_t maxbytes)
bool roaring_bitmap_add_checked(roaring_bitmap_t *r, uint32_t x)
void roaring_bitmap_andnot_inplace(roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
void roaring_bitmap_add_range_closed(roaring_bitmap_t *r, uint32_t min, uint32_t max)
bool roaring_bitmap_contains_bulk(const roaring_bitmap_t *r, roaring_bulk_context_t *context, uint32_t val)
size_t roaring_bitmap_portable_serialize(const roaring_bitmap_t *r, char *buf)
bool roaring_bitmap_equals(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
void roaring_bitmap_flip_inplace(roaring_bitmap_t *r1, uint64_t range_start, uint64_t range_end)
size_t roaring_bitmap_shrink_to_fit(roaring_bitmap_t *r)
roaring_bitmap_t * roaring_bitmap_or_many(size_t number, const roaring_bitmap_t **rs)
void roaring_bitmap_clear(roaring_bitmap_t *r)
bool roaring_bitmap_intersect(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
bool roaring_bitmap_run_optimize(roaring_bitmap_t *r)
void roaring_bitmap_and_inplace(roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
uint64_t roaring_bitmap_or_cardinality(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
void roaring_iterator_init(const roaring_bitmap_t *r, roaring_uint32_iterator_t *newit)
size_t roaring_bitmap_frozen_size_in_bytes(const roaring_bitmap_t *r)
bool roaring_bitmap_range_uint32_array(const roaring_bitmap_t *r, size_t offset, size_t limit, uint32_t *ans)
bool roaring_bitmap_get_copy_on_write(const roaring_bitmap_t *r)
Definition: roaring.h:84
void roaring_bitmap_to_uint32_array(const roaring_bitmap_t *r, uint32_t *ans)
bool roaring_bitmap_overwrite(roaring_bitmap_t *dest, const roaring_bitmap_t *src)
void roaring_bitmap_xor_inplace(roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
bool roaring_uint32_iterator_move_equalorlarger(roaring_uint32_iterator_t *it, uint32_t val)
roaring_bitmap_t * roaring_bitmap_or(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
double roaring_bitmap_jaccard_index(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
size_t roaring_bitmap_size_in_bytes(const roaring_bitmap_t *r)
bool roaring_uint32_iterator_previous(roaring_uint32_iterator_t *it)
bool roaring_bitmap_remove_run_compression(roaring_bitmap_t *r)
bool roaring_iterate(const roaring_bitmap_t *r, roaring_iterator iterator, void *ptr)
void roaring_bitmap_init_cleared(roaring_bitmap_t *r)
Definition: roaring.h:59
void roaring_bitmap_add_bulk(roaring_bitmap_t *r, roaring_bulk_context_t *context, uint32_t val)
void roaring_bitmap_frozen_serialize(const roaring_bitmap_t *r, char *buf)
void roaring_bitmap_remove_range(roaring_bitmap_t *r, uint64_t min, uint64_t max)
Definition: roaring.h:410
void roaring_bitmap_add_many(roaring_bitmap_t *r, size_t n_args, const uint32_t *vals)
bool roaring_bitmap_contains_range(const roaring_bitmap_t *r, uint64_t range_start, uint64_t range_end)
roaring_bitmap_t * roaring_bitmap_deserialize(const void *buf)
bool roaring_bitmap_is_empty(const roaring_bitmap_t *r)
roaring_bitmap_t * roaring_bitmap_portable_deserialize_frozen(const char *buf)
void roaring_bitmap_free(const roaring_bitmap_t *r)
bool roaring_bitmap_contains(const roaring_bitmap_t *r, uint32_t val)
void roaring_bitmap_remove(roaring_bitmap_t *r, uint32_t x)
void roaring_bitmap_set_copy_on_write(roaring_bitmap_t *r, bool cow)
Definition: roaring.h:87
void roaring_bitmap_remove_range_closed(roaring_bitmap_t *r, uint32_t min, uint32_t max)
const roaring_bitmap_t * roaring_bitmap_frozen_view(const char *buf, size_t length)
bool roaring_bitmap_is_strict_subset(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
roaring_bitmap_t * roaring_bitmap_portable_deserialize(const char *buf)
struct roaring_bitmap_s roaring_bitmap_t
uint64_t roaring_bitmap_xor_cardinality(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
uint64_t roaring_bitmap_andnot_cardinality(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
size_t roaring_bitmap_portable_size_in_bytes(const roaring_bitmap_t *r)
bool roaring_bitmap_is_subset(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
void roaring_bitmap_rank_many(const roaring_bitmap_t *r, const uint32_t *begin, const uint32_t *end, uint64_t *ans)
roaring_bitmap_t * roaring_bitmap_xor(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
void roaring_bitmap_or_inplace(roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
uint64_t roaring_bitmap_rank(const roaring_bitmap_t *r, uint32_t x)
uint32_t roaring_bitmap_maximum(const roaring_bitmap_t *r)
void roaring_bitmap_add_range(roaring_bitmap_t *r, uint64_t min, uint64_t max)
Definition: roaring.h:388
void roaring_bitmap_flip_inplace_closed(roaring_bitmap_t *r1, uint32_t range_start, uint32_t range_end)
int64_t roaring_bitmap_get_index(const roaring_bitmap_t *r, uint32_t x)
uint64_t roaring_bitmap_get_cardinality(const roaring_bitmap_t *r)
size_t roaring_bitmap_serialize(const roaring_bitmap_t *r, char *buf)
uint64_t roaring_bitmap_and_cardinality(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
roaring_bitmap_t * roaring_bitmap_andnot(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
struct roaring_bulk_context_s roaring_bulk_context_t
struct roaring_uint32_iterator_s roaring_uint32_iterator_t
bool roaring_bitmap_contains_range_closed(const roaring_bitmap_t *r, uint32_t range_start, uint32_t range_end)
bool roaring_bitmap_remove_checked(roaring_bitmap_t *r, uint32_t x)
void roaring_bitmap_printf(const roaring_bitmap_t *r)
bool roaring_uint32_iterator_advance(roaring_uint32_iterator_t *it)
uint32_t roaring_bitmap_minimum(const roaring_bitmap_t *r)
void roaring_bitmap_add(roaring_bitmap_t *r, uint32_t x)
#define ROARING_TERMINATE(_s)
Definition: roaring.hh:31