Add C++ interface for the libbabeltrace2 `bt_integer_range_set_*` API
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 17 Dec 2020 02:13:13 +0000 (21:13 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 28 Jan 2022 16:22:26 +0000 (11:22 -0500)
commit64ded3fba41e6ad038a67a06cf78faf4ffaa753b
treee0a76c3265d72babefa4c38f12ffed2278a8c8f5
parente0c2afae96a9cdfd2a5bab7f97a6342131da499c
Add C++ interface for the libbabeltrace2 `bt_integer_range_set_*` API

This patch adds C++ wrappers for Babeltrace 2 integer range set objects.

The four new available types are:

* `bt2::UnsignedIntegerRange`
* `bt2::ConstUnsignedIntegerRange`
* `bt2::SignedIntegerRange`
* `bt2::ConstSignedIntegerRange`

Implicitly convert from a mutable integer range set to a constant
integer range set with converting constructors and assignment operators.

All classes have the `Shared` type alias which is what the shared()
method returns. You can also implicitly convert from a shared mutable
integer range set to a shared constant integer range set.

The corresponding integer range type of any integer range set type `T`
is `T::Range`.

Borrow an integer range by index from the set with operator[]():

    auto myRange = myRangeSet[3];

Get the number of integer ranges in the set with the size() method.

Compare compatible integer range sets with operator==() and
operator!=().

Create a shared integer range set with the static create() methods, for
example:

    auto myRangeSet = bt2::SignedIntegerRangeSet::create();

Those methods can throw a `LibMemoryError` instance.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I14f00e9a020ec8f429bf632132e030ff4cc881a6
Reviewed-on: https://review.lttng.org/c/babeltrace/+/4599
src/cpp-common/bt2/integer-range-set.hpp [new file with mode: 0644]
This page took 0.024275 seconds and 4 git commands to generate.