X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Ffield.cpp;h=df2808841e6c2dfb324a635c0aa85ec1e520fd64;hb=65cd3c0cfa205aa6f67ff974f561882d5eafdd89;hp=25f0e4676bf2f28aed15c311f218ac59a418ce9f;hpb=0220be14254fac4f7af642fd6630282b29776a70;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/field.cpp b/src/bin/lttng-sessiond/field.cpp index 25f0e4676..df2808841 100644 --- a/src/bin/lttng-sessiond/field.cpp +++ b/src/bin/lttng-sessiond/field.cpp @@ -10,6 +10,8 @@ #include #include +#include + namespace lst = lttng::sessiond::trace; namespace { @@ -72,8 +74,8 @@ lst::integer_type::integer_type(unsigned int in_alignment, type(in_alignment), byte_order{in_byte_order}, size{in_size}, - signedness{in_signedness}, - base{in_base} + signedness_{in_signedness}, + base_{in_base} { } @@ -83,8 +85,8 @@ bool lst::integer_type::_is_equal(const type &base_other) const noexcept return this->byte_order == other.byte_order && this->size == other.size && - this->signedness == other.signedness && - this->base == other.base; + this->signedness_ == other.signedness_ && + this->base_ == other.base_; } void lst::integer_type::accept(type_visitor& visitor) const @@ -111,19 +113,16 @@ lst::floating_point_type::floating_point_type(unsigned int in_alignment, mantissa_digits(in_mantissa_digits) { /* Allowed (exponent, mantissa) pairs. */ - static const std::vector> allowed_pairs{ + static const std::set> allowed_pairs{ {5, 11}, /* binary16 */ {8, 24}, /* binary32 */ {11, 53}, /* binary64 */ {15, 113}, /* binary128 */ }; - const auto input_pair = decltype(allowed_pairs)::value_type(exponent_digits, mantissa_digits); - for (const auto& pair : allowed_pairs) { - if (input_pair == pair) { - /* mantissa and exponent digits is a valid pair. */ - return; - } + if (allowed_pairs.find({exponent_digits, mantissa_digits}) != allowed_pairs.end()) { + /* mantissa and exponent digits is a valid pair. */ + return; } LTTNG_THROW_INVALID_ARGUMENT_ERROR( @@ -220,7 +219,7 @@ void lst::dynamic_length_array_type::accept(type_visitor& visitor) const } lst::string_type::string_type(unsigned int in_alignment, enum encoding in_encoding) : - type(in_alignment), encoding{in_encoding} + type(in_alignment), encoding_{in_encoding} { } @@ -228,7 +227,7 @@ bool lst::string_type::_is_equal(const type& base_other) const noexcept { const auto& other = static_cast(base_other); - return this->encoding == other.encoding; + return this->encoding_ == other.encoding_; } lst::static_length_string_type::static_length_string_type( @@ -317,4 +316,4 @@ bool lst::variant_type::_is_equal(const type& base_other) const noexcept void lst::variant_type::accept(type_visitor& visitor) const { visitor.visit(*this); -} \ No newline at end of file +}