projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
.clang-tidy: remove modernize-concat-nested-namespaces
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
field.cpp
diff --git
a/src/bin/lttng-sessiond/field.cpp
b/src/bin/lttng-sessiond/field.cpp
index e46e06631eae121b4736547b31995839783bd381..94d002167556a87fe3901359a25d9f28d49c4872 100644
(file)
--- a/
src/bin/lttng-sessiond/field.cpp
+++ b/
src/bin/lttng-sessiond/field.cpp
@@
-15,45
+15,43
@@
namespace lst = lttng::sessiond::trace;
namespace {
namespace lst = lttng::sessiond::trace;
namespace {
-template <class FieldType
Set
>
-bool fields_are_equal(const FieldType
Set& a, const FieldTypeSet
& b)
+template <class FieldType
ContainerType
>
+bool fields_are_equal(const FieldType
ContainerType& a, const FieldTypeContainerType
& b)
{
if (a.size() != b.size()) {
return false;
}
{
if (a.size() != b.size()) {
return false;
}
- return std::equal(a.cbegin(), a.cend(), b.cbegin(),
- [](typename FieldTypeSet::const_reference field_a,
- typename FieldTypeSet::const_reference field_b) {
- return *field_a == *field_b;
- });
+ return std::equal(a.cbegin(),
+ a.cend(),
+ b.cbegin(),
+ [](typename FieldTypeContainerType::const_reference field_a,
+ typename FieldTypeContainerType::const_reference field_b) {
+ return *field_a == *field_b;
+ });
}
} /* namespace */
lst::field_location::field_location(lst::field_location::root in_lookup_root,
}
} /* namespace */
lst::field_location::field_location(lst::field_location::root in_lookup_root,
- lst::field_location::elements in_elements) :
- root_{
in_lookup_root}, elements_{std::move(in_elements)
}
+
lst::field_location::elements in_elements) :
+ root_{
in_lookup_root }, elements_{ std::move(in_elements)
}
{
}
bool lst::field_location::operator==(const lst::field_location& other) const noexcept
{
{
}
bool lst::field_location::operator==(const lst::field_location& other) const noexcept
{
- return root_ == other.root_ &&
- elements_ == other.elements_;
+ return root_ == other.root_ && elements_ == other.elements_;
}
}
-lst::type::type(unsigned int in_alignment) : alignment{
in_alignment
}
+lst::type::type(unsigned int in_alignment) : alignment{
in_alignment
}
{
}
{
}
-lst::type::~type()
-{
-}
+lst::type::~type() = default;
bool lst::type::operator==(const lst::type& other) const noexcept
{
bool lst::type::operator==(const lst::type& other) const noexcept
{
- return typeid(*this) == typeid(other) &&
- alignment == other.alignment &&
+ return typeid(*this) == typeid(other) && alignment == other.alignment &&
/* defer to concrete type comparison */
this->_is_equal(other);
}
/* defer to concrete type comparison */
this->_is_equal(other);
}
@@
-64,10
+62,11
@@
bool lst::type::operator!=(const lst::type& other) const noexcept
}
lst::field::field(std::string in_name, lst::type::cuptr in_type) :
}
lst::field::field(std::string in_name, lst::type::cuptr in_type) :
- name{
std::move(in_name)}, _type{std::move(in_type)
}
+ name{
std::move(in_name) }, _type{ std::move(in_type)
}
{
if (!_type) {
{
if (!_type) {
- LTTNG_THROW_ERROR(fmt::format("Invalid type used to create field: field name = `{}`", name));
+ LTTNG_THROW_ERROR(lttng::format(
+ "Invalid type used to create field: field name = `{}`", name));
}
}
}
}
@@
-86,44
+85,44
@@
lst::type::cuptr lst::field::move_type() noexcept
return std::move(_type);
}
return std::move(_type);
}
-const lst::type
&
lst::field::get_type() const
+const lst::type
&
lst::field::get_type() const
{
if (_type) {
return *_type;
} else {
{
if (_type) {
return *_type;
} else {
- LTTNG_THROW_ERROR(fmt::format("Invalid attempt to access field type after transfer: field name = `{}`", name));
+ LTTNG_THROW_ERROR(lttng::format(
+ "Invalid attempt to access field type after transfer: field name = `{}`",
+ name));
}
}
lst::integer_type::integer_type(unsigned int in_alignment,
}
}
lst::integer_type::integer_type(unsigned int in_alignment,
- enum lst::byte_order in_byte_order,
- unsigned int in_size,
- enum lst::integer_type::signedness in_signedness,
- enum lst::integer_type::base in_base,
- roles in_roles) :
+
enum lst::byte_order in_byte_order,
+
unsigned int in_size,
+
enum lst::integer_type::signedness in_signedness,
+
enum lst::integer_type::base in_base,
+
roles in_roles) :
type(in_alignment),
type(in_alignment),
- byte_order{
in_byte_order
},
- size{
in_size
},
- signedness_{
in_signedness
},
- base_{
in_base
},
- roles_{
std::move(in_roles)
}
+ byte_order{
in_byte_order
},
+ size{
in_size
},
+ signedness_{
in_signedness
},
+ base_{
in_base
},
+ roles_{
std::move(in_roles)
}
{
}
lst::type::cuptr lst::integer_type::copy() const
{
return lttng::make_unique<integer_type>(
{
}
lst::type::cuptr lst::integer_type::copy() const
{
return lttng::make_unique<integer_type>(
-
alignment, byte_order, size, signedness_, base_, roles_);
+ alignment, byte_order, size, signedness_, base_, roles_);
}
}
-bool lst::integer_type::_is_equal(const type
&
base_other) const noexcept
+bool lst::integer_type::_is_equal(const type
&
base_other) const noexcept
{
const auto& other = static_cast<decltype(*this)&>(base_other);
{
const auto& other = static_cast<decltype(*this)&>(base_other);
- return this->byte_order == other.byte_order &&
- this->size == other.size &&
- this->signedness_ == other.signedness_ &&
- this->base_ == other.base_ &&
+ return this->byte_order == other.byte_order && this->size == other.size &&
+ this->signedness_ == other.signedness_ && this->base_ == other.base_ &&
this->roles_ == other.roles_;
}
this->roles_ == other.roles_;
}
@@
-142,36
+141,35
@@
lst::byte_order lst::type::reverse_byte_order(lst::byte_order byte_order) noexce
}
lst::floating_point_type::floating_point_type(unsigned int in_alignment,
}
lst::floating_point_type::floating_point_type(unsigned int in_alignment,
- lst::byte_order in_byte_order,
- unsigned int in_exponent_digits,
- unsigned int in_mantissa_digits) :
+
lst::byte_order in_byte_order,
+
unsigned int in_exponent_digits,
+
unsigned int in_mantissa_digits) :
type(in_alignment),
byte_order(in_byte_order),
type(in_alignment),
byte_order(in_byte_order),
- exponent_digits{
in_exponent_digits
},
+ exponent_digits{
in_exponent_digits
},
mantissa_digits(in_mantissa_digits)
{
/* Allowed (exponent, mantissa) pairs. */
static const std::set<std::pair<unsigned int, unsigned int>> allowed_pairs{
mantissa_digits(in_mantissa_digits)
{
/* Allowed (exponent, mantissa) pairs. */
static const std::set<std::pair<unsigned int, unsigned int>> allowed_pairs{
-
{5, 11
}, /* binary16 */
-
{8, 24
}, /* binary32 */
-
{11, 53
}, /* binary64 */
-
{15, 113
}, /* binary128 */
+
{ 5, 11
}, /* binary16 */
+
{ 8, 24
}, /* binary32 */
+
{ 11, 53
}, /* binary64 */
+
{ 15, 113
}, /* binary128 */
};
};
- if (allowed_pairs.find({
exponent_digits, mantissa_digits
}) != allowed_pairs.end()) {
+ if (allowed_pairs.find({
exponent_digits, mantissa_digits
}) != allowed_pairs.end()) {
/* mantissa and exponent digits is a valid pair. */
return;
}
/* mantissa and exponent digits is a valid pair. */
return;
}
- LTTNG_THROW_INVALID_ARGUMENT_ERROR(
- fmt::format("Invalid exponent/mantissa values provided while creating {}",
- typeid(*this)));
+ LTTNG_THROW_INVALID_ARGUMENT_ERROR(lttng::format(
+ "Invalid exponent/mantissa values provided while creating {}", typeid(*this)));
}
lst::type::cuptr lst::floating_point_type::copy() const
{
return lttng::make_unique<floating_point_type>(
}
lst::type::cuptr lst::floating_point_type::copy() const
{
return lttng::make_unique<floating_point_type>(
-
alignment, byte_order, exponent_digits, mantissa_digits);
+ alignment, byte_order, exponent_digits, mantissa_digits);
}
void lst::floating_point_type::accept(type_visitor& visitor) const
}
void lst::floating_point_type::accept(type_visitor& visitor) const
@@
-184,22
+182,18
@@
bool lst::floating_point_type::_is_equal(const type& base_other) const noexcept
const auto& other = static_cast<decltype(*this)&>(base_other);
return this->byte_order == other.byte_order &&
const auto& other = static_cast<decltype(*this)&>(base_other);
return this->byte_order == other.byte_order &&
-
this->exponent_digits == other.exponent_digits &&
-
this->mantissa_digits == other.mantissa_digits;
+ this->exponent_digits == other.exponent_digits &&
+ this->mantissa_digits == other.mantissa_digits;
}
lst::enumeration_type::enumeration_type(unsigned int in_alignment,
}
lst::enumeration_type::enumeration_type(unsigned int in_alignment,
- enum lst::byte_order in_byte_order,
- unsigned int in_size,
- enum signedness in_signedness,
- enum base in_base,
- lst::integer_type::roles in_roles) :
- integer_type(in_alignment,
- in_byte_order,
- in_size,
- in_signedness,
- in_base,
- std::move(in_roles))
+ enum lst::byte_order in_byte_order,
+ unsigned int in_size,
+ enum signedness in_signedness,
+ enum base in_base,
+ lst::integer_type::roles in_roles) :
+ integer_type(
+ in_alignment, in_byte_order, in_size, in_signedness, in_base, std::move(in_roles))
{
}
{
}
@@
-225,14
+219,14
@@
void unsigned_enumeration_type::accept(type_visitor& visitor) const
template <>
void variant_type<lst::signed_enumeration_type::mapping::range_t::range_integer_t>::accept(
template <>
void variant_type<lst::signed_enumeration_type::mapping::range_t::range_integer_t>::accept(
-
lst::type_visitor& visitor) const
+ lst::type_visitor& visitor) const
{
visitor.visit(*this);
}
template <>
void variant_type<lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>::accept(
{
visitor.visit(*this);
}
template <>
void variant_type<lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>::accept(
-
lst::type_visitor& visitor) const
+ lst::type_visitor& visitor) const
{
visitor.visit(*this);
}
{
visitor.visit(*this);
}
@@
-241,7
+235,7
@@
void variant_type<lst::unsigned_enumeration_type::mapping::range_t::range_intege
} /* namespace lttng */
lst::array_type::array_type(unsigned int in_alignment, type::cuptr in_element_type) :
} /* namespace lttng */
lst::array_type::array_type(unsigned int in_alignment, type::cuptr in_element_type) :
- type(in_alignment), element_type{
std::move(in_element_type)
}
+ type(in_alignment), element_type{
std::move(in_element_type)
}
{
}
{
}
@@
-253,10
+247,9
@@
bool lst::array_type::_is_equal(const type& base_other) const noexcept
}
lst::static_length_array_type::static_length_array_type(unsigned int in_alignment,
}
lst::static_length_array_type::static_length_array_type(unsigned int in_alignment,
- type::cuptr in_element_type,
- uint64_t in_length) :
- array_type(in_alignment, std::move(in_element_type)),
- length{in_length}
+ type::cuptr in_element_type,
+ uint64_t in_length) :
+ array_type(in_alignment, std::move(in_element_type)), length{ in_length }
{
}
{
}
@@
-270,7
+263,7
@@
bool lst::static_length_array_type::_is_equal(const type& base_other) const noex
lst::type::cuptr lst::static_length_array_type::copy() const
{
return lttng::make_unique<static_length_array_type>(
lst::type::cuptr lst::static_length_array_type::copy() const
{
return lttng::make_unique<static_length_array_type>(
-
alignment, element_type->copy(), length);
+ alignment, element_type->copy(), length);
}
void lst::static_length_array_type::accept(type_visitor& visitor) const
}
void lst::static_length_array_type::accept(type_visitor& visitor) const
@@
-278,11
+271,12
@@
void lst::static_length_array_type::accept(type_visitor& visitor) const
visitor.visit(*this);
}
visitor.visit(*this);
}
-lst::dynamic_length_array_type::dynamic_length_array_type(unsigned int in_alignment,
- type::cuptr in_element_type,
- lst::field_location in_length_field_location) :
+lst::dynamic_length_array_type::dynamic_length_array_type(
+ unsigned int in_alignment,
+ type::cuptr in_element_type,
+ lst::field_location in_length_field_location) :
array_type(in_alignment, std::move(in_element_type)),
array_type(in_alignment, std::move(in_element_type)),
- length_field_location{
std::move(in_length_field_location)
}
+ length_field_location{
std::move(in_length_field_location)
}
{
}
{
}
@@
-291,13
+285,13
@@
bool lst::dynamic_length_array_type::_is_equal(const type& base_other) const noe
const auto& other = static_cast<decltype(*this)&>(base_other);
return array_type::_is_equal(base_other) &&
const auto& other = static_cast<decltype(*this)&>(base_other);
return array_type::_is_equal(base_other) &&
-
this->length_field_location == other.length_field_location;
+ this->length_field_location == other.length_field_location;
}
lst::type::cuptr lst::dynamic_length_array_type::copy() const
{
return lttng::make_unique<dynamic_length_array_type>(
}
lst::type::cuptr lst::dynamic_length_array_type::copy() const
{
return lttng::make_unique<dynamic_length_array_type>(
-
alignment, element_type->copy(), length_field_location);
+ alignment, element_type->copy(), length_field_location);
}
void lst::dynamic_length_array_type::accept(type_visitor& visitor) const
}
void lst::dynamic_length_array_type::accept(type_visitor& visitor) const
@@
-305,9
+299,10
@@
void lst::dynamic_length_array_type::accept(type_visitor& visitor) const
visitor.visit(*this);
}
visitor.visit(*this);
}
-lst::static_length_blob_type::static_length_blob_type(
- unsigned int in_alignment, uint64_t in_length_bytes, roles in_roles) :
- type(in_alignment), length_bytes{in_length_bytes}, roles_{std::move(in_roles)}
+lst::static_length_blob_type::static_length_blob_type(unsigned int in_alignment,
+ uint64_t in_length_bytes,
+ roles in_roles) :
+ type(in_alignment), length_bytes{ in_length_bytes }, roles_{ std::move(in_roles) }
{
}
{
}
@@
-329,8
+324,8
@@
void lst::static_length_blob_type::accept(type_visitor& visitor) const
}
lst::dynamic_length_blob_type::dynamic_length_blob_type(
}
lst::dynamic_length_blob_type::dynamic_length_blob_type(
-
unsigned int in_alignment, lst::field_location in_length_field_location) :
- type(in_alignment), length_field_location{
std::move(in_length_field_location)
}
+ unsigned int in_alignment, lst::field_location in_length_field_location) :
+ type(in_alignment), length_field_location{
std::move(in_length_field_location)
}
{
}
{
}
@@
-352,7
+347,7
@@
void lst::dynamic_length_blob_type::accept(type_visitor& visitor) const
}
lst::string_type::string_type(unsigned int in_alignment, enum encoding in_encoding) :
}
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
}
{
}
{
}
@@
-363,9
+358,10
@@
bool lst::string_type::_is_equal(const type& base_other) const noexcept
return this->encoding_ == other.encoding_;
}
return this->encoding_ == other.encoding_;
}
-lst::static_length_string_type::static_length_string_type(
- unsigned int in_alignment, enum encoding in_encoding, uint64_t in_length) :
- string_type(in_alignment, in_encoding), length{in_length}
+lst::static_length_string_type::static_length_string_type(unsigned int in_alignment,
+ enum encoding in_encoding,
+ uint64_t in_length) :
+ string_type(in_alignment, in_encoding), length{ in_length }
{
}
{
}
@@
-386,11
+382,12
@@
void lst::static_length_string_type::accept(type_visitor& visitor) const
visitor.visit(*this);
}
visitor.visit(*this);
}
-lst::dynamic_length_string_type::dynamic_length_string_type(unsigned int in_alignment,
- enum encoding in_encoding,
- field_location in_length_field_location) :
+lst::dynamic_length_string_type::dynamic_length_string_type(
+ unsigned int in_alignment,
+ enum encoding in_encoding,
+ field_location in_length_field_location) :
string_type(in_alignment, in_encoding),
string_type(in_alignment, in_encoding),
- length_field_location{
std::move(in_length_field_location)
}
+ length_field_location{
std::move(in_length_field_location)
}
{
}
{
}
@@
-399,13
+396,13
@@
bool lst::dynamic_length_string_type::_is_equal(const type& base_other) const no
const auto& other = static_cast<decltype(*this)&>(base_other);
return string_type::_is_equal(base_other) &&
const auto& other = static_cast<decltype(*this)&>(base_other);
return string_type::_is_equal(base_other) &&
-
this->length_field_location == other.length_field_location;
+ this->length_field_location == other.length_field_location;
}
lst::type::cuptr lst::dynamic_length_string_type::copy() const
{
return lttng::make_unique<dynamic_length_string_type>(
}
lst::type::cuptr lst::dynamic_length_string_type::copy() const
{
return lttng::make_unique<dynamic_length_string_type>(
-
alignment, encoding_, length_field_location);
+ alignment, encoding_, length_field_location);
}
void lst::dynamic_length_string_type::accept(type_visitor& visitor) const
}
void lst::dynamic_length_string_type::accept(type_visitor& visitor) const
@@
-414,7
+411,7
@@
void lst::dynamic_length_string_type::accept(type_visitor& visitor) const
}
lst::null_terminated_string_type::null_terminated_string_type(unsigned int in_alignment,
}
lst::null_terminated_string_type::null_terminated_string_type(unsigned int in_alignment,
- enum encoding in_encoding) :
+
enum encoding in_encoding) :
string_type(in_alignment, in_encoding)
{
}
string_type(in_alignment, in_encoding)
{
}
@@
-430,13
+427,13
@@
void lst::null_terminated_string_type::accept(type_visitor& visitor) const
}
lst::structure_type::structure_type(unsigned int in_alignment, fields in_fields) :
}
lst::structure_type::structure_type(unsigned int in_alignment, fields in_fields) :
- type(in_alignment), fields_{
std::move(in_fields)
}
+ type(in_alignment), fields_{
std::move(in_fields)
}
{
}
bool lst::structure_type::_is_equal(const type& base_other) const noexcept
{
{
}
bool lst::structure_type::_is_equal(const type& base_other) const noexcept
{
- const auto
&
other = static_cast<decltype(*this)&>(base_other);
+ const auto
&
other = static_cast<decltype(*this)&>(base_other);
return fields_are_equal(this->fields_, other.fields_);
}
return fields_are_equal(this->fields_, other.fields_);
}
@@
-447,8
+444,8
@@
lst::type::cuptr lst::structure_type::copy() const
copy_of_fields.reserve(fields_.size());
for (const auto& field : fields_) {
copy_of_fields.reserve(fields_.size());
for (const auto& field : fields_) {
- copy_of_fields.emplace_back(
lttng::make_unique<lst::field>(
-
field->name, field->get_type().copy()));
+ copy_of_fields.emplace_back(
+
lttng::make_unique<lst::field>(
field->name, field->get_type().copy()));
}
return lttng::make_unique<structure_type>(alignment, std::move(copy_of_fields));
}
return lttng::make_unique<structure_type>(alignment, std::move(copy_of_fields));
This page took
0.029354 seconds
and
4
git commands to generate.