cpp-common/bt2/value.hpp: add proxy methods to `bt2::CommonValue`
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 4 Nov 2023 20:43:11 +0000 (16:43 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 14 Dec 2023 15:57:04 +0000 (10:57 -0500)
commita699e23c5d369505002e5283207a871dbd62d59f
tree54c34da4996d9ad3126cdedf53206eb916bd2187
parentac19444e607847c47917c1cc1abfa09311e19e25
cpp-common/bt2/value.hpp: add proxy methods to `bt2::CommonValue`

Those new methods on `bt2::CommonValue` call the corresponding method
while "converting" the current object to another type for the user.

For example:

    void f(const bt2::Value val)
    {
        // We know it's a string value
        val = "mireille";
    }

This is just sugar for common value operations to avoid the redundancy
of calling as*().

The as*() methods already have BT_ASSERT_DBG() lines to make sure that
the conversion is valid.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I475bda3754a984cbd2eca98f5caa14c765ece956
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11241
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
src/cpp-common/bt2/value.hpp
This page took 0.026881 seconds and 4 git commands to generate.