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
19#pragma once
20
21#include "cc_tools_qt/ToolsMessageBase.h"
22#include "cc_tools_qt/ToolsProtMsgInterface.h"
23
24#include "comms/Field.h"
25#include "comms/field/ArrayList.h"
26
27#include <QtCore/QString>
28
29#include <cassert>
30#include <tuple>
31
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 virtual const char*
88 nameImpl() const override
89 {
90 static const char* Str = "Generic Raw Data Message";
91 return Str;
92 }
93
94 virtual void resetImpl() override
95 {
96 [[maybe_unused]] static constexpr bool Must_not_be_called = false;
97 assert(Must_not_be_called);
98 }
99
100 virtual bool assignImpl([[maybe_unused]] const cc_tools_qt::ToolsMessage& other) override
101 {
102 [[maybe_unused]] static constexpr bool Must_not_be_called = false;
103 assert(Must_not_be_called);
104 return false;
105 }
106
107 virtual FieldsList transportFieldsImpl() override
108 {
109 return FieldsList();
110 }
111};
112
113} // namespace cc_tools_qt
114
115
Helper class used to define protocol message class in CommsChampion Tools plugin environment.
Definition ToolsMessageBase.h:46
Main interface class used by CommsChampion Tools to display and manipulate messages.
Definition ToolsMessage.h:44
Raw data message.
Definition ToolsRawDataMessage.h:74
Main namespace for all classes / functions of the shared library.