Clean-up: sessiond: rename public accessors
[lttng-tools.git] / src / bin / lttng-sessiond / ust-registry-channel.cpp
index ed8a60daf2509fd191ec273fc3b0be866df6a4f4..f8295df4513806d60fb66a7b0903b47a49626894 100644 (file)
@@ -85,9 +85,12 @@ lst::type::cuptr create_event_header(const lst::abi& trace_abi, lst::stream_clas
 
        if (header_type == lst::stream_class::header_type::COMPACT) {
                auto enum_mappings = std::make_shared<lst::unsigned_enumeration_type::mappings>();
+               lst::unsigned_enumeration_type::mapping compact_mapping{
+                               "compact", lst::unsigned_enumeration_type::mapping::range_t(0, 30)};
+               lst::unsigned_enumeration_type::mapping extended_mapping{"extended", 31};
 
-               enum_mappings->emplace_back("compact", lst::unsigned_enumeration_type::mapping::range_t(0, 30));
-               enum_mappings->emplace_back("extended");
+               enum_mappings->emplace_back(compact_mapping);
+               enum_mappings->emplace_back(extended_mapping);
 
                lst::type::cuptr choice_enum = lttng::make_unique<lst::unsigned_enumeration_type>(1,
                                trace_abi.byte_order, 5, lst::integer_type::base::DECIMAL,
@@ -95,7 +98,8 @@ lst::type::cuptr create_event_header(const lst::abi& trace_abi, lst::stream_clas
                                std::initializer_list<lst::integer_type::role>(
                                                {lst::integer_type::role::EVENT_RECORD_CLASS_ID}));
 
-               lst::variant_type::choices variant_choices;
+               lst::variant_type<lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>::
+                               choices variant_choices;
 
                lst::structure_type::fields compact_fields;
                compact_fields.emplace_back(lttng::make_unique<lst::field>("timestamp",
@@ -106,9 +110,9 @@ lst::type::cuptr create_event_header(const lst::abi& trace_abi, lst::stream_clas
                                                                                role>({lst::integer_type::role::
                                                                                DEFAULT_CLOCK_TIMESTAMP}))));
 
-               lst::type::cuptr compact = lttng::make_unique<lst::structure_type>(
+               auto compact_type = lttng::make_unique<lst::structure_type>(
                                0, std::move(compact_fields));
-               variant_choices.emplace_back(lttng::make_unique<lst::field>("compact", std::move(compact)));
+               variant_choices.emplace_back(std::move(compact_mapping), std::move(compact_type));
 
                lst::structure_type::fields extended_fields;
                extended_fields.emplace_back(lttng::make_unique<lst::field>("id",
@@ -128,28 +132,35 @@ lst::type::cuptr create_event_header(const lst::abi& trace_abi, lst::stream_clas
                                                                                role>({lst::integer_type::role::
                                                                                DEFAULT_CLOCK_TIMESTAMP}))));
 
-               lst::type::cuptr extended = lttng::make_unique<lst::structure_type>(0, std::move(extended_fields));
-               variant_choices.emplace_back(lttng::make_unique<lst::field>("extended", std::move(extended)));
+               lst::type::cuptr extended_type = lttng::make_unique<lst::structure_type>(0, std::move(extended_fields));
+               variant_choices.emplace_back(std::move(extended_mapping), std::move(extended_type));
 
-               lst::type::cuptr variant = lttng::make_unique<lst::variant_type>(
-                               0, "id", std::move(variant_choices));
+               auto variant = lttng::make_unique<lst::variant_type<
+                               lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>>(
+                               0,
+                               lst::field_location(lst::field_location::root::EVENT_RECORD_HEADER,
+                                               {"id"}),
+                               std::move(variant_choices));
 
                event_header_fields.emplace_back(lttng::make_unique<lst::field>("id", std::move(choice_enum)));
                event_header_fields.emplace_back(
                                lttng::make_unique<lst::field>("v", std::move(variant)));
        } else {
                auto enum_mappings = std::make_shared<lst::unsigned_enumeration_type::mappings>();
+               lst::unsigned_enumeration_type::mapping compact_mapping{"compact",
+                               lst::unsigned_enumeration_type::mapping::range_t(0, 65534)};
+               lst::unsigned_enumeration_type::mapping extended_mapping{"extended", 65535};
+               enum_mappings->emplace_back(compact_mapping);
+               enum_mappings->emplace_back(extended_mapping);
 
-               enum_mappings->emplace_back("compact", lst::unsigned_enumeration_type::mapping::range_t(0, 65534));
-               enum_mappings->emplace_back("extended");
-
-               lst::type::cuptr choice_enum = lttng::make_unique<lst::unsigned_enumeration_type>(
+               auto choice_enum = lttng::make_unique<lst::unsigned_enumeration_type>(
                                trace_abi.uint16_t_alignment, trace_abi.byte_order, 16,
                                lst::integer_type::base::DECIMAL, std::move(enum_mappings),
                                std::initializer_list<lst::integer_type::role>(
                                                {lst::integer_type::role::EVENT_RECORD_CLASS_ID}));
 
-               lst::variant_type::choices variant_choices;
+               lst::variant_type<lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>::
+                               choices variant_choices;
 
                lst::structure_type::fields compact_fields;
                compact_fields.emplace_back(lttng::make_unique<lst::field>("timestamp",
@@ -161,10 +172,9 @@ lst::type::cuptr create_event_header(const lst::abi& trace_abi, lst::stream_clas
                                                                                role>({lst::integer_type::role::
                                                                                DEFAULT_CLOCK_TIMESTAMP}))));
 
-               lst::type::cuptr compact = lttng::make_unique<lst::structure_type>(
+               lst::type::cuptr compact_type = lttng::make_unique<lst::structure_type>(
                                0, std::move(compact_fields));
-               variant_choices.emplace_back(
-                               lttng::make_unique<lst::field>("compact", std::move(compact)));
+               variant_choices.emplace_back(std::move(compact_mapping), std::move(compact_type));
 
                lst::structure_type::fields extended_fields;
                extended_fields.emplace_back(lttng::make_unique<lst::field>("id",
@@ -184,13 +194,19 @@ lst::type::cuptr create_event_header(const lst::abi& trace_abi, lst::stream_clas
                                                                                role>({lst::integer_type::role::
                                                                                DEFAULT_CLOCK_TIMESTAMP}))));
 
-               lst::type::cuptr extended = lttng::make_unique<lst::structure_type>(0, std::move(extended_fields));
-               variant_choices.emplace_back(lttng::make_unique<lst::field>("extended", std::move(extended)));
+               auto extended_type = lttng::make_unique<lst::structure_type>(
+                               0, std::move(extended_fields));
+               variant_choices.emplace_back(std::move(extended_mapping), std::move(extended_type));
 
-               lst::type::cuptr variant = lttng::make_unique<lst::variant_type>(
-                               0, "id", std::move(variant_choices));
+               auto variant = lttng::make_unique<lst::variant_type<
+                               lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>>(
+                               0,
+                               lst::field_location(lst::field_location::root::EVENT_RECORD_HEADER,
+                                               {"id"}),
+                               std::move(variant_choices));
 
-               event_header_fields.emplace_back(lttng::make_unique<lst::field>("id", std::move(choice_enum)));
+               event_header_fields.emplace_back(
+                               lttng::make_unique<lst::field>("id", std::move(choice_enum)));
                event_header_fields.emplace_back(
                                lttng::make_unique<lst::field>("v", std::move(variant)));
        }
@@ -388,13 +404,13 @@ lsu::registry_channel::~registry_channel()
        lttng_ht_destroy(_events);
 }
 
-const lttng::sessiond::trace::type* lsu::registry_channel::get_event_context() const
+const lttng::sessiond::trace::type* lsu::registry_channel::event_context() const
 {
        LTTNG_ASSERT(_is_registered);
-       return lst::stream_class::get_event_context();
+       return lst::stream_class::event_context();
 }
 
-void lsu::registry_channel::set_event_context(lttng::sessiond::trace::type::cuptr context)
+void lsu::registry_channel::event_context(lttng::sessiond::trace::type::cuptr context)
 {
        /* Must only be set once, on the first channel registration provided by an application. */
        LTTNG_ASSERT(!_event_context);
This page took 0.027057 seconds and 4 git commands to generate.