cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
ToolsRawDataMessage.h
1//
2// Copyright 2015 - 2026 (C). Alex Robenko. All rights reserved.
3//
4// SPDX-License-Identifier: GPL-3.0-or-later
5//
6
7// This file is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20#pragma once
21
22#include "cc_tools_qt/ToolsMessageBase.h"
23#include "cc_tools_qt/ToolsProtMsgInterface.h"
24
25#include "comms/Field.h"
26#include "comms/field/ArrayList.h"
27
28#include <QtCore/QString>
29
30#include <cassert>
31#include <tuple>
32
33namespace cc_tools_qt
34{
35
36namespace details
37{
38
39template <typename TFieldBase>
40class ToolsRawDataMessageField : public
41 comms::field::ArrayList<
42 TFieldBase,
43 std::uint8_t,
44 comms::option::def::HasName>
45{
46public:
47 static const char* name()
48 {
49 return "Data";
50 }
51};
52
53template <typename TMsgBase, typename...>
54class ToolsRawDataMessageImpl : public
55 comms::MessageBase<
56 TMsgBase,
57 comms::option::NoIdImpl,
58 comms::option::FieldsImpl<std::tuple<ToolsRawDataMessageField<typename TMsgBase::Field>>>,
59 comms::option::MsgType<ToolsRawDataMessageImpl<TMsgBase>>
60 >
61{
62};
63
64} // namespace details
65
67template<typename TBase>
68class ToolsRawDataMessage : public
70 TBase,
71 details::ToolsRawDataMessageImpl,
72 ToolsRawDataMessage<TBase>
73 >
74{
75 using Base =
77 TBase,
78 details::ToolsRawDataMessageImpl,
80 >;
81public:
82 using FieldsList = typename Base::FieldsList;
83
84 virtual ~ToolsRawDataMessage() noexcept = default;
85
86protected:
87 [[nodiscard]] virtual const char* nameImpl() const override
88 {
89 static const char* Str = "Generic Raw Data Message";
90 return Str;
91 }
92
93 virtual void resetImpl() override
94 {
95 [[maybe_unused]] static constexpr bool Must_not_be_called = false;
96 assert(Must_not_be_called);
97 }
98
99 virtual bool assignImpl([[maybe_unused]] const cc_tools_qt::ToolsMessage& other) override
100 {
101 [[maybe_unused]] static constexpr bool Must_not_be_called = false;
102 assert(Must_not_be_called);
103 return false;
104 }
105
106 [[nodiscard]] virtual FieldsList transportFieldsImpl() override
107 {
108 return FieldsList();
109 }
110};
111
112} // namespace cc_tools_qt
113
Helper class used to define protocol message class in CommsChampion Tools plugin environment.
Definition ToolsMessageBase.h:47
virtual const char * nameImpl() const override
Definition ToolsMessageBase.h:121
Main interface class used by CommsChampion Tools to display and manipulate messages.
Definition ToolsMessage.h:46
Raw data message.
Definition ToolsRawDataMessage.h:74
Main namespace for all classes / functions of the shared library.