Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve consistency in the C++ interface #653

Merged
merged 4 commits into from
Sep 30, 2024

Conversation

cubicYYY
Copy link
Contributor

@cubicYYY cubicYYY commented Aug 20, 2024

These changes aim to improve the consistency of the C++ API between the 32-bit version and the 64-bit version.

Related issues: #629

Changes:

  • Rename RoaringSetBitForwardIterator to RoaringSetBitBiDirectionalIterator (the old one is now deprecated).
  • Add methods: Roaring::clear Roaring::isFull Roaring::containsRangeClosed.
  • Revise move_equalorlarger methods in iterators.
  • Add the api::roaring_bitmap_flip_inplace_closed method.
  • Add the api::roaring_bitmap_contains_range_closed method.
  • Add the api::roaring_bitmap_flip_closed method.
  • Add the api::roaring_bitmap_range_cardinality_closed method.
  • Other minor changes.

If merged, only the following methods remain that are only implemented in the 32-bit version(in class Roaring) but not in the 64-bit version(in class Roaring64Map):

  • containsRange
  • rangeUint64Array
  • and_cardinality
  • or_cardinality
  • andnot_cardinality
  • xor_cardinality
  • jaccard_index
  • rank_many

Also, the methods mentioned in #549 need to be further implemented.

These changes aim to improve the consistency of the C++ API between the 32-bit version and the 64-bit version.

Details:

- Rename `RoaringSetBitForwardIterator` to `RoaringSetBitBiDirectionalIterator` (the old one is now deprecated).
- Add methods: `Roaring::clear` `Roaring::isFull` `Roaring::containsRangeClosed`.
- Revise `move_equalorlarger` methods in iterators.
- Add `api::roaring_bitmap_flip_inplace_closed` method.
- Add `api::roaring_bitmap_contains_range_closed` method.
- Add `api::roaring_bitmap_flip_closed` method.
- Other minor changes.
cpp/roaring64map.hh Outdated Show resolved Hide resolved
cpp/roaring64map.hh Outdated Show resolved Hide resolved
src/roaring.c Outdated Show resolved Hide resolved
src/roaring.c Outdated Show resolved Hide resolved
src/roaring.c Outdated Show resolved Hide resolved
@lemire lemire requested review from Dr-Emann and SLieve August 20, 2024 17:18
@lemire
Copy link
Member

lemire commented Aug 20, 2024

Looks good to me. I invited others to comment.

Let us keep the breaking changes to a minimum. Deprecation is fine.

Main changes:

- Add the `api::roaring_bitmap_range_cardinality_closed` method.
- Add boundary checks for methods: `api::roaring_bitmap_add_range` `api::roaring_bitmap_remove_range`.
class RoaringSetBitBiDirectionalIterator;

/** DEPRECATED, use `RoaringSetBitBiDirectionalIterator`. */
using RoaringSetBitForwardIterator = RoaringSetBitBiDirectionalIterator;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use CROARING_DEPRECATED?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to, but:

  1. currently, the Roaring64MapSetBitForwardIterator is not marked as deprecated.
  2. CROARING_DEPRECATED expands to __attribute__((deprecated)) for GNUC and Clang, so using xxx CROARING_DEPRECATED = xxx; works. However, for MSVC, it expands to __declspec(deprecated), which won't work in this format.

cpp/roaring.hh Show resolved Hide resolved
Copy link
Contributor

@SLieve SLieve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, some small nits.

cpp/roaring64map.hh Show resolved Hide resolved
cpp/roaring64map.hh Outdated Show resolved Hide resolved
src/roaring.c Show resolved Hide resolved
@lemire
Copy link
Member

lemire commented Sep 19, 2024

Running tests with the latest changes.

@lemire
Copy link
Member

lemire commented Sep 30, 2024

Merging.

@lemire lemire merged commit 5f15802 into RoaringBitmap:master Sep 30, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants