COMMS
Template library intended to help with implementation of communication protocols.
Loading...
Searching...
No Matches
MissingOnReadFail.h
1//
2// Copyright 2019 - 2025 (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/cast.h"
11
12#include <utility>
13
14namespace comms
15{
16
17namespace field
18{
19
20namespace adapter
21{
22
23template <typename TBase>
24class MissingOnReadFail : public TBase
25{
26 using BaseImpl = TBase;
27public:
28
29 template <typename TIter>
30 comms::ErrorStatus read(TIter& iter, std::size_t len)
31 {
32 BaseImpl tmp;
33 auto iterTmp = iter;
34 auto es = tmp.read(iterTmp, len);
36 BaseImpl::setMode(comms::field::OptionalMode::Missing);
38 }
39
40 static_cast<BaseImpl&>(*this) = std::move(tmp);
41 iter = iterTmp;
42 return es;
43 }
44
45 static constexpr bool hasReadNoStatus()
46 {
47 return false;
48 }
49
50 template <typename TIter>
51 void readNoStatus(TIter& iter) = delete;
52};
53
54} // namespace adapter
55
56} // namespace field
57
58} // namespace comms
59
Contains definition of various casts.
@ Missing
Field doesn't exist.
Main namespace for all classes / functions of COMMS library.
ErrorStatus
Error statuses reported by the Communication module.
Definition ErrorStatus.h:17
@ Success
Used to indicate successful outcome of the operation.