COMMS
Template library intended to help with implementation of communication protocols.
Loading...
Searching...
No Matches
FieldBase.h
1//
2// Copyright 2015 - 2026 (C). Alex Robenko. All rights reserved.
3//
4// SPDX-License-Identifier: MPL-2.0
5//
6// This Source Code Form is subject to the terms of the Mozilla Public
7// License, v. 2.0. If a copy of the MPL was not distributed with this
8// file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10#pragma once
11
12#include "comms/options.h"
13#include "comms/traits.h"
14
15namespace comms
16{
17
18namespace details
19{
20
21template <typename... TOptions>
22class FieldBase;
23
24template <>
25class FieldBase<>
26{
27protected:
28 // Use big endian by default
30
31 // Use unsigned type by default for versioning
32 using VersionType = unsigned;
33};
34
35template <typename TEndian, typename... TOptions>
36class FieldBase<comms::option::def::Endian<TEndian>, TOptions...> : public FieldBase<TOptions...>
37{
38protected:
39 using Endian = TEndian;
40};
41
42template <typename T, typename... TOptions>
43class FieldBase<comms::option::def::VersionType<T>, TOptions...> : public FieldBase<TOptions...>
44{
45protected:
46 using VersionType = T;
47};
48
49template <typename... TOptions>
50class FieldBase<comms::option::app::EmptyOption, TOptions...> : public FieldBase<TOptions...>
51{
52};
53
54template <typename... TTuple, typename... TOptions>
55class FieldBase<std::tuple<TTuple...>, TOptions...> : public FieldBase<TTuple..., TOptions...>
56{
57};
58
59} // namespace details
60
61} // namespace comms
62
comms::option::def::VersionType< T > VersionType
Same as comms::option::def::VersionType.
Definition options.h:1930
comms::option::def::Endian< TEndian > Endian
Same as comms::option::def::Endian.
Definition options.h:1473
util::traits::endian::Big Big
Empty class used in traits to indicate Big Endian.
Definition traits.h:30
Main namespace for all classes / functions of COMMS library.
STL namespace.
Contains definition of all the options used by the COMMS library.
This file contains all the classes necessary to properly define message traits.