cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
ToolsTransportMessageBase.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/ToolsMessage.h"
23#include "cc_tools_qt/ToolsMessageBase.h"
24
25#include "comms/MessageBase.h"
26#include "comms/options.h"
27
28#include <QtCore/QString>
29
30#include <cassert>
31
32namespace cc_tools_qt
33{
34
41template <typename TBase, template<typename...> class TProtMsg, typename TActualMsg>
44 TBase,
45 TProtMsg,
46 TActualMsg
47 >
48{
49 using Base =
51 TBase,
52 TProtMsg,
53 TActualMsg
54 >;
55public:
56 using FieldsList = typename Base::FieldsList;
57
59 virtual ~ToolsTransportMessageBase() noexcept = default;
60
61protected:
63 virtual const char* nameImpl() const override
64 {
65 static const char* Str = "Generic Transport Message";
66 return Str;
67 }
68
69 virtual qlonglong numericIdImpl() const override
70 {
71 [[maybe_unused]] static constexpr bool Must_be_overriden = false;
72 assert(Must_be_overriden);
73 return 0;
74 }
75
77 virtual void resetImpl() override
78 {
79 [[maybe_unused]] static constexpr bool Must_not_be_called = false;
80 assert(Must_not_be_called);
81 }
82
84 virtual bool assignImpl([[maybe_unused]] const cc_tools_qt::ToolsMessage& other) override
85 {
86 [[maybe_unused]] static constexpr bool Must_not_be_called = false;
87 assert(Must_not_be_called);
88 return false;
89 }
90
91 virtual FieldsList transportFieldsImpl() override
92 {
93 return FieldsList();
94 }
95};
96
97} // namespace cc_tools_qt
98
Helper class used to define protocol message class in CommsChampion Tools plugin environment.
Definition ToolsMessageBase.h:47
Main interface class used by CommsChampion Tools to display and manipulate messages.
Definition ToolsMessage.h:46
Base class for TransportMessage definition in protocol plugin.
Definition ToolsTransportMessageBase.h:48
virtual qlonglong numericIdImpl() const override
Overriding polymorphic retrieval of the numeric id.
Definition ToolsTransportMessageBase.h:69
virtual bool assignImpl(const cc_tools_qt::ToolsMessage &other) override
Overriding virtual cc_tools_qt::ToolsMessage::assignImpl()
Definition ToolsTransportMessageBase.h:84
virtual void resetImpl() override
Overriding virtual cc_tools_qt::ToolsMessage::resetImpl()
Definition ToolsTransportMessageBase.h:77
virtual ~ToolsTransportMessageBase() noexcept=default
Destructor.
virtual const char * nameImpl() const override
Overriding virtual cc_tools_qt::ToolsMessage::nameImpl()
Definition ToolsTransportMessageBase.h:63
Main namespace for all classes / functions of the shared library.