Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Dec 1, 2023
1 parent ff64834 commit 2cccb7d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
26 changes: 12 additions & 14 deletions data_tamer/include/data_tamer/channel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,29 +290,27 @@ inline void LogChannel::updateTypeRegistry()
FieldsVector fields;

if constexpr (!IsNumericType<T>())
{
auto funcPointer = [this, &fields](const char* field_name, const auto* member) {
using MemberType =
typename std::remove_cv_t<std::remove_reference_t<decltype(*member)>>;
updateTypeRegistryImpl<MemberType>(fields, field_name);
};

auto funcMember = [this, &fields](const char* field_name, const auto& member) {
using MemberType = decltype(getPointerType(member));
updateTypeRegistryImpl<MemberType>(fields, field_name);
};

{
const auto& type_name = DataTamer::TypeDefinition<T>().typeName();
auto added_serializer = _type_registry.addType<T>(type_name, true);
if (added_serializer)
{
if constexpr (has_typedef_with_object<T>())
{
TypeDefinition<T>().typeDef({}, funcPointer);
auto func = [this, &fields](const char* field_name, const auto* member) {
using MemberType =
typename std::remove_cv_t<std::remove_reference_t<decltype(*member)>>;
updateTypeRegistryImpl<MemberType>(fields, field_name);
};
TypeDefinition<T>().typeDef({}, func);
}
else
{
TypeDefinition<T>().typeDef(funcMember);
auto func = [this, &fields](const char* field_name, const auto& member) {
using MemberType = decltype(getPointerType(member));
updateTypeRegistryImpl<MemberType>(fields, field_name);
};
TypeDefinition<T>().typeDef(func);
}
// DataTamer::TypeDefinition<T>().typeDef({}, func);
addCustomType(type_name, fields);
Expand Down
20 changes: 9 additions & 11 deletions data_tamer/include/data_tamer/custom_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,21 @@ inline void GetFixedSize(bool& is_fixed_size, size_t& fixed_size)
fixed_size += info.size * obj_size;
}
else if (is_fixed_size)
{
// type recursion
auto funcA = [&](const char*, auto const* member) {
using MemberType = std::remove_cv_t<std::remove_reference_t<decltype(*member)>>;
GetFixedSize<MemberType>(is_fixed_size, fixed_size);
};
auto funcB = [&](const char*, auto const& member) {
using MemberType = decltype(getPointerType(member));
GetFixedSize<MemberType>(is_fixed_size, fixed_size);
};

{
if constexpr (has_typedef_with_object<T>())
{
auto funcA = [&](const char*, auto const* member) {
using MemberType = std::remove_cv_t<std::remove_reference_t<decltype(*member)>>;
GetFixedSize<MemberType>(is_fixed_size, fixed_size);
};
TypeDefinition<T>().typeDef({}, funcA);
}
else
{
auto funcB = [&](const char*, auto const& member) {
using MemberType = decltype(getPointerType(member));
GetFixedSize<MemberType>(is_fixed_size, fixed_size);
};
TypeDefinition<T>().typeDef(funcB);
}
}
Expand Down

0 comments on commit 2cccb7d

Please sign in to comment.