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