cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
RawDataMessage.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#include <tuple>
23
24#include <QtCore/QString>
25
26#include "comms/comms.h"
27#include "property/field.h"
28#include "ProtocolMessageBase.h"
29#include "cc_tools_qt.h"
30
31namespace cc_tools_qt
32{
33
34namespace details
35{
36
37template <typename TMsgBase, typename TField>
38class RawDataMessageImpl : public
39 comms::MessageBase<
40 TMsgBase,
41 comms::option::NoIdImpl,
42 comms::option::FieldsImpl<std::tuple<TField> >,
43 comms::option::MsgType<RawDataMessageImpl<TMsgBase, TField> >
44 >
45{
46
47};
48
49} // namespace details
50
52template <typename TProtStack>
53class RawDataMessage : public
55 details::RawDataMessageImpl<
56 typename TProtStack::MsgPtr::element_type,
57 typename std::tuple_element<std::tuple_size<typename TProtStack::AllFields>::value - 1, typename TProtStack::AllFields>::type>,
58 RawDataMessage<TProtStack>
59 >
60{
61public:
62 virtual ~RawDataMessage() noexcept = default;
63
64protected:
65 virtual const char*
66 nameImpl() const override
67 {
68 static const char* Str = "Generic Raw Data Message";
69 return Str;
70 }
71
72 virtual const QVariantList& extraTransportFieldsPropertiesImpl() const override
73 {
74 static const QVariantList List;
75 return List;
76 }
77
78 virtual const QVariantList& fieldsPropertiesImpl() const override
79 {
80 static const QVariantList Props = createFieldsProperties();
81 return Props;
82 }
83
84 virtual QString idAsStringImpl() const override
85 {
86 [[maybe_unused]] static constexpr bool Must_not_be_called = false;
87 assert(Must_not_be_called);
88 return QString();
89 }
90
91 virtual void resetImpl() override
92 {
93 [[maybe_unused]] static constexpr bool Must_not_be_called = false;
94 assert(Must_not_be_called);
95 }
96
97 virtual bool assignImpl([[maybe_unused]] const cc_tools_qt::Message& other) override
98 {
99 [[maybe_unused]] static constexpr bool Must_not_be_called = false;
100 assert(Must_not_be_called);
101 return false;
102 }
103
104private:
105
106 static QVariantList createFieldsProperties()
107 {
108 QVariantList props;
109 props.append(
110 property::field::ArrayList().name("Data").asMap());
111 return props;
112 }
113};
114
115} // namespace cc_tools_qt
116
117
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
Raw data message.
Definition RawDataMessage.h:60
Class to contain all the properties relevant to comms::field::ArrayList fields.
Definition field.h:562
Main namespace for all classes / functions of the shared library.