X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Ffield.cpp;fp=src%2Fbin%2Flttng-sessiond%2Ffield.cpp;h=e46e06631eae121b4736547b31995839783bd381;hp=c00f6d1351085ec92b5bf7dd75c8ea6f5cf33fdc;hb=b6bbb1d666531bf061f29884da1b0d7c10f59aa0;hpb=88277a52069ed0135254ce29da617ebb6ecddbb8 diff --git a/src/bin/lttng-sessiond/field.cpp b/src/bin/lttng-sessiond/field.cpp index c00f6d135..e46e06631 100644 --- a/src/bin/lttng-sessiond/field.cpp +++ b/src/bin/lttng-sessiond/field.cpp @@ -110,6 +110,12 @@ lst::integer_type::integer_type(unsigned int in_alignment, { } +lst::type::cuptr lst::integer_type::copy() const +{ + return lttng::make_unique( + alignment, byte_order, size, signedness_, base_, roles_); +} + bool lst::integer_type::_is_equal(const type &base_other) const noexcept { const auto& other = static_cast(base_other); @@ -162,6 +168,12 @@ lst::floating_point_type::floating_point_type(unsigned int in_alignment, typeid(*this))); } +lst::type::cuptr lst::floating_point_type::copy() const +{ + return lttng::make_unique( + alignment, byte_order, exponent_digits, mantissa_digits); +} + void lst::floating_point_type::accept(type_visitor& visitor) const { visitor.visit(*this); @@ -255,6 +267,12 @@ bool lst::static_length_array_type::_is_equal(const type& base_other) const noex return array_type::_is_equal(base_other) && this->length == other.length; } +lst::type::cuptr lst::static_length_array_type::copy() const +{ + return lttng::make_unique( + alignment, element_type->copy(), length); +} + void lst::static_length_array_type::accept(type_visitor& visitor) const { visitor.visit(*this); @@ -276,6 +294,12 @@ bool lst::dynamic_length_array_type::_is_equal(const type& base_other) const noe this->length_field_location == other.length_field_location; } +lst::type::cuptr lst::dynamic_length_array_type::copy() const +{ + return lttng::make_unique( + alignment, element_type->copy(), length_field_location); +} + void lst::dynamic_length_array_type::accept(type_visitor& visitor) const { visitor.visit(*this); @@ -294,6 +318,11 @@ bool lst::static_length_blob_type::_is_equal(const type& base_other) const noexc return length_bytes == other.length_bytes && roles_ == other.roles_; } +lst::type::cuptr lst::static_length_blob_type::copy() const +{ + return lttng::make_unique(alignment, length_bytes, roles_); +} + void lst::static_length_blob_type::accept(type_visitor& visitor) const { visitor.visit(*this); @@ -312,6 +341,11 @@ bool lst::dynamic_length_blob_type::_is_equal(const type& base_other) const noex return length_field_location == other.length_field_location; } +lst::type::cuptr lst::dynamic_length_blob_type::copy() const +{ + return lttng::make_unique(alignment, length_field_location); +} + void lst::dynamic_length_blob_type::accept(type_visitor& visitor) const { visitor.visit(*this); @@ -342,6 +376,11 @@ bool lst::static_length_string_type::_is_equal(const type& base_other) const noe return string_type::_is_equal(base_other) && this->length == other.length; } +lst::type::cuptr lst::static_length_string_type::copy() const +{ + return lttng::make_unique(alignment, encoding_, length); +} + void lst::static_length_string_type::accept(type_visitor& visitor) const { visitor.visit(*this); @@ -363,6 +402,12 @@ bool lst::dynamic_length_string_type::_is_equal(const type& base_other) const no this->length_field_location == other.length_field_location; } +lst::type::cuptr lst::dynamic_length_string_type::copy() const +{ + return lttng::make_unique( + alignment, encoding_, length_field_location); +} + void lst::dynamic_length_string_type::accept(type_visitor& visitor) const { visitor.visit(*this); @@ -374,6 +419,11 @@ lst::null_terminated_string_type::null_terminated_string_type(unsigned int in_al { } +lst::type::cuptr lst::null_terminated_string_type::copy() const +{ + return lttng::make_unique(alignment, encoding_); +} + void lst::null_terminated_string_type::accept(type_visitor& visitor) const { visitor.visit(*this); @@ -391,6 +441,19 @@ bool lst::structure_type::_is_equal(const type& base_other) const noexcept return fields_are_equal(this->fields_, other.fields_); } +lst::type::cuptr lst::structure_type::copy() const +{ + structure_type::fields copy_of_fields; + + copy_of_fields.reserve(fields_.size()); + for (const auto& field : fields_) { + copy_of_fields.emplace_back(lttng::make_unique( + field->name, field->get_type().copy())); + } + + return lttng::make_unique(alignment, std::move(copy_of_fields)); +} + void lst::structure_type::accept(type_visitor& visitor) const { visitor.visit(*this);