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