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