COMMS
Template library intended to help with implementation of communication protocols.
Loading...
Searching...
No Matches
process.h
Go to the documentation of this file.
1//
2// Copyright 2019 - 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
12
13#pragma once
14
16
17#include <cstddef>
18#include <utility>
19
20namespace comms
21{
22
44template <typename TBufIter, typename TFrame, typename TMsg, typename... TExtraValues>
46 TBufIter& bufIter,
47 std::size_t len,
48 TFrame&& frame,
49 TMsg& msg,
50 TExtraValues... extraValues)
51{
52 return details::ProcessHelper::processSingle(bufIter, len, std::forward<TFrame>(frame), msg, std::forward<TExtraValues>(extraValues)...);
53}
54
82template <typename TBufIter, typename TFrame, typename TMsg, typename THandler, typename... TExtraValues>
84 TBufIter& bufIter,
85 std::size_t len,
86 TFrame&& frame,
87 TMsg& msg,
88 THandler& handler,
89 TExtraValues... extraValues)
90{
91 return details::ProcessHelper::processSingleWithDispatch(bufIter, len, std::forward<TFrame>(frame), msg, handler, std::forward<TExtraValues>(extraValues)...);
92}
93
124template <typename TDispatcher, typename TBufIter, typename TFrame, typename TMsg, typename THandler, typename... TExtraValues>
126 TBufIter& bufIter,
127 std::size_t len,
128 TFrame&& frame,
129 TMsg& msg,
130 THandler& handler,
131 TExtraValues... extraValues)
132{
133 return details::ProcessHelper::processSingleWithDispatchViaDispatcher<TDispatcher>(bufIter, len, std::forward<TFrame>(frame), msg, handler, std::forward<TExtraValues>(extraValues)...);
134}
135
158template <typename TBufIter, typename TFrame, typename THandler, typename... TExtraValues>
160 TBufIter bufIter,
161 std::size_t len,
162 TFrame&& frame,
163 THandler& handler)
164{
165 return details::ProcessHelper::processAllWithDispatch(bufIter, len, std::forward<TFrame>(frame), handler);
166}
167
191template <typename TDispatcher, typename TBufIter, typename TFrame, typename THandler, typename... TExtraValues>
193 TBufIter bufIter,
194 std::size_t len,
195 TFrame&& frame,
196 THandler& handler)
197{
198 return details::ProcessHelper::processAllWithDispatchViaDispatcher<TDispatcher>(bufIter, len, std::forward<TFrame>(frame), handler);
199}
200
201} // namespace comms
Provides auxiliary functions for processing input and dispatching messages.
Main namespace for all classes / functions of COMMS library.
ErrorStatus
Error statuses reported by the Communication module.
Definition ErrorStatus.h:19
std::size_t processAllWithDispatch(TBufIter bufIter, std::size_t len, TFrame &&frame, THandler &handler)
Process all available input and dispatch all created message objects to appropriate handling function...
Definition process.h:159
comms::ErrorStatus processSingle(TBufIter &bufIter, std::size_t len, TFrame &&frame, TMsg &msg, TExtraValues... extraValues)
Process input until first message is recognized and its object is created or missing data is reported...
Definition process.h:45
comms::ErrorStatus processSingleWithDispatch(TBufIter &bufIter, std::size_t len, TFrame &&frame, TMsg &msg, THandler &handler, TExtraValues... extraValues)
Process input until first message is recognized, its object is created and dispatched to appropriate ...
Definition process.h:83
comms::ErrorStatus processSingleWithDispatchViaDispatcher(TBufIter &bufIter, std::size_t len, TFrame &&frame, TMsg &msg, THandler &handler, TExtraValues... extraValues)
Process input until first message is recognized, its object is created and dispatched to appropriate ...
Definition process.h:125
std::size_t processAllWithDispatchViaDispatcher(TBufIter bufIter, std::size_t len, TFrame &&frame, THandler &handler)
Process all available input and dispatch all created message objects to appropriate handling function...
Definition process.h:192