cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
ToolsBundleFieldImpl.h
1//
2// Copyright 2014 - 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/details/ToolsFieldBase.h"
23#include "cc_tools_qt/field/ToolsBundleField.h"
24
25#include "comms/field/Bundle.h"
26
27#include <cstdint>
28#include <cassert>
29#include <memory>
30#include <vector>
31
32namespace cc_tools_qt
33{
34
35namespace details
36{
37
38template <typename TField>
39class ToolsBundleFieldImpl : public ToolsFieldBase<cc_tools_qt::field::ToolsBundleField, TField>
40{
41 using Base = ToolsFieldBase<cc_tools_qt::field::ToolsBundleField, TField>;
42 using Field = TField;
43
44 static_assert(comms::field::isBundle<Field>(), "Must be of Bundle field type");
45
46public:
47 using Ptr = typename Base::Ptr;
48 using ActPtr = typename Base::ActPtr;
49
50 explicit ToolsBundleFieldImpl(Field& fieldRef)
51 : Base(fieldRef)
52 {
53 }
54
55 ToolsBundleFieldImpl(const ToolsBundleFieldImpl&) = default;
56 ToolsBundleFieldImpl(ToolsBundleFieldImpl&&) = default;
57 virtual ~ToolsBundleFieldImpl() noexcept = default;
58
59 ToolsBundleFieldImpl& operator=(const ToolsBundleFieldImpl&) = delete;
60
61protected:
62 virtual Ptr cloneImpl() override
63 {
64 return ActPtr(new ToolsBundleFieldImpl(Base::field()));
65 }
66
67 virtual bool isHiddenSerializationImpl() const override
68 {
69 return true;
70 }
71};
72
73template <typename TField>
74auto makeBundleField(TField& field)
75{
76 return std::make_unique<ToolsBundleFieldImpl<TField>>(field);
77}
78
79} // namespace details
80
81} // namespace cc_tools_qt
Main namespace for all classes / functions of the shared library.