cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
TransportMessageBase.h
1//
2// Copyright 2015 - 2024 (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 <cassert>
22
23#include <QtCore/QString>
24
25#include "comms/comms.h"
26#include "ProtocolMessageBase.h"
27#include "cc_tools_qt.h"
28
29namespace cc_tools_qt
30{
31
32namespace details
33{
34
35template <typename TMsgBase, typename TFields>
36class TransportMessageImpl : public
37 comms::MessageBase<
38 TMsgBase,
39 comms::option::NoIdImpl,
40 comms::option::FieldsImpl<TFields>,
41 comms::option::MsgType<TransportMessageImpl<TMsgBase, TFields> >
42 >
43{
44
45};
46
47} // namespace details
48
54template <typename TMessage, typename TAllFields>
57 details::TransportMessageImpl<TMessage, TAllFields>,
58 TransportMessageBase<TMessage, TAllFields>
59 >
60{
61public:
63 virtual ~TransportMessageBase() noexcept = default;
64
65protected:
67 virtual const char* nameImpl() const override
68 {
69 static const char* Str = "Generic Transport Message";
70 return Str;
71 }
72
74 virtual const QVariantList& extraTransportFieldsPropertiesImpl() const override
75 {
76 static const QVariantList List;
77 return List;
78 }
79
81 virtual QString idAsStringImpl() const override
82 {
83 [[maybe_unused]] static constexpr bool Must_not_be_called = false;
84 assert(Must_not_be_called);
85 return QString();
86 }
87
89 virtual void resetImpl() override
90 {
91 [[maybe_unused]] static constexpr bool Must_not_be_called = false;
92 assert(Must_not_be_called);
93 }
94
96 virtual bool assignImpl([[maybe_unused]] const cc_tools_qt::Message& other) override
97 {
98 [[maybe_unused]] static constexpr bool Must_not_be_called = false;
99 assert(Must_not_be_called);
100 return false;
101 }
102};
103
104} // namespace cc_tools_qt
105
106
Single "include all" file.
Main interface class used by CommsChampion Tools to display and manipulate messages.
Definition Message.h:41
Helper class used to implement several pure virtual functions defined in cc_tools_qt::Message interfa...
Definition ProtocolMessageBase.h:44
Base class for TransportMessage definition in protocol plugin.
Definition TransportMessageBase.h:60
virtual bool assignImpl(const cc_tools_qt::Message &other) override
Overriding virtual cc_tools_qt::Message::assignImpl()
Definition TransportMessageBase.h:96
virtual ~TransportMessageBase() noexcept=default
Destructor.
virtual void resetImpl() override
Overriding virtual cc_tools_qt::Message::resetImpl()
Definition TransportMessageBase.h:89
virtual const char * nameImpl() const override
Overriding virtual cc_tools_qt::Message::nameImpl()
Definition TransportMessageBase.h:67
virtual const QVariantList & extraTransportFieldsPropertiesImpl() const override
Overriding virtual cc_tools_qt::Message::extraTransportFieldsPropertiesImpl()
Definition TransportMessageBase.h:74
virtual QString idAsStringImpl() const override
Overriding virtual cc_tools_qt::Message::idAsStringImpl()
Definition TransportMessageBase.h:81
Main namespace for all classes / functions of the shared library.