25#include "cc_tools_qt/Message.h"
26#include "comms/MessageBase.h"
42template <
typename TMsgBase,
typename TActualMsg>
45 using Base = TMsgBase;
46 using ActualMsg = TActualMsg;
71 auto& actObj =
static_cast<ActualMsg&
>(*this);
78 auto* castedOther =
dynamic_cast<const ActualMsg*
>(&other);
79 if (castedOther ==
nullptr) {
83 assert(other.
idAsString() == Base::idAsString());
84 auto& actObj =
static_cast<ActualMsg&
>(*this);
85 actObj = *castedOther;
92 static_assert(comms::isMessageBase<TMsgBase>(),
"TMsgBase is expected to be proper message");
94 using Tag =
typename std::conditional<
95 TMsgBase::hasCustomName(),
99 return nameInternal(Tag());
103 struct HasNameTag {};
106 const char* nameInternal(HasNameTag)
const
108 return TMsgBase::doName();
111 const char* nameInternal(NoNameTag)
const
113 [[maybe_unused]]
static constexpr bool Must_be_overriden =
false;
114 assert(Must_be_overriden);