cpp-common/bt2: add bt2::wrap() overloads
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 4 Nov 2023 19:34:09 +0000 (15:34 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 14 Dec 2023 15:57:04 +0000 (10:57 -0500)
commit87fc9c82b669ae81025a264ce32f6b7999c0e259
tree85c651297648ef1f75d8812dbe7c569e7cfb5219
parentc83761b9ef60278016167607f09a06ff7b636a42
cpp-common/bt2: add bt2::wrap() overloads

You may now call bt2::wrap() with any libbabeltrace2 object pointer with
which you could build a borrowed object wrapper. Therefore, this
excludes `bt2::MessageArray` which is a special case (ownership is
transferred).

For example:

    void f(bt_value * const val)
    {
        const auto wrappedVal = bt2::wrap(val);

        if (wrappedVal.isUnsignedInteger()) {
            *wrappedVal = 23;
        }

        // ...
    }

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I49cc7121bb3c85dc49b9682c219940d4cb2aab5d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11240
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
CI-Build: Simon Marchi <simon.marchi@efficios.com>
src/Makefile.am
src/cpp-common/bt2/wrap.hpp [new file with mode: 0644]
This page took 0.025299 seconds and 4 git commands to generate.