Add bt2::Common{Field,FieldClass,Value,Message}<>::as<>()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 20 May 2022 01:50:36 +0000 (21:50 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 11 Sep 2023 15:24:02 +0000 (11:24 -0400)
commit45e0ded5cd688d00bd39feace0720cba4e63a298
tree19b9da43419c1cb8018a6f5f6b2cfeaa750c1766
parent462e86286c967092b5c116d9d936cc6f0f7295c1
Add bt2::Common{Field,FieldClass,Value,Message}<>::as<>()

Those new as() method templates conceptually cast their object to the
first template parameter. Those are shorthands to use specific types
within a template function, for example:

    template <typename FieldT, typename ValT>
    void g(bt2::Field field, const ValT val)
    {
        // ...
        field.as<FieldT>() = val;
        // ...
    }

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ifc1f49487ac6ef9c143bf4c2faa3373f4eaccd9e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8099
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10803
Tested-by: jenkins <jenkins@lttng.org>
src/cpp-common/bt2/field-class.hpp
src/cpp-common/bt2/field.hpp
src/cpp-common/bt2/message.hpp
src/cpp-common/bt2/value.hpp
This page took 0.039769 seconds and 4 git commands to generate.