cpp-common: add SharedObj::release
authorSimon Marchi <simon.marchi@efficios.com>
Sat, 28 May 2022 14:01:44 +0000 (10:01 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 11 Sep 2023 15:24:02 +0000 (11:24 -0400)
commitd0b6533a5d3c3da3c347a5898cbaa7098ba1bd3e
treeb714907987c08cf84e878c4320c85617dd8f8cdc
parent39278ebc70d57de534466c533d6c543a318dfdac
cpp-common: add SharedObj::release

It will sometimes be needed to extract the ownership of a lib object
from a SharedObj, and get the underlying lib object pointer.  For
example:

 - The value returned by queries
 - Messages returned by iterators

Add a SharedObj::release method for that.  The return type is a borrowed
object (e.g. bt2::Value::Shared::release returns a bt2::Value), but
conceptually the caller then owns the reference and is responsible for
manually managing it.

After a release, a Shared object becomes invalid, same as when it is moved
from.

Change-Id: Id31855512b8dd3d5223f2e759ff48f81ceadbfbf
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8169
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10825
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
src/cpp-common/bt2/internal/shared-obj.hpp
This page took 0.025177 seconds and 4 git commands to generate.