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
19#pragma once
20
21#include "cc_tools_qt/ToolsMessage.h"
22#include "cc_tools_qt/ToolsMessageBase.h"
23
24#include "comms/MessageBase.h"
25#include "comms/options.h"
26
27#include <QtCore/QString>
28
29#include <cassert>
30
31namespace cc_tools_qt
32{
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
99
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
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.