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 - 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
10
11#pragma once
12
14
15#include <cstddef>
16#include <utility>
17
18namespace comms
19{
20
42template <typename TBufIter, typename TFrame, typename TMsg, typename... TExtraValues>
44 TBufIter& bufIter,
45 std::size_t len,
46 TFrame&& frame,
47 TMsg& msg,
48 TExtraValues... extraValues)
49{
50 return details::ProcessHelper::processSingle(bufIter, len, std::forward<TFrame>(frame), msg, std::forward<TExtraValues>(extraValues)...);
51}
52
80template <typename TBufIter, typename TFrame, typename TMsg, typename THandler, typename... TExtraValues>
82 TBufIter& bufIter,
83 std::size_t len,
84 TFrame&& frame,
85 TMsg& msg,
86 THandler& handler,
87 TExtraValues... extraValues)
88{
89 return details::ProcessHelper::processSingleWithDispatch(bufIter, len, std::forward<TFrame>(frame), msg, handler, std::forward<TExtraValues>(extraValues)...);
90}
91
122template <typename TDispatcher, typename TBufIter, typename TFrame, typename TMsg, typename THandler, typename... TExtraValues>
124 TBufIter& bufIter,
125 std::size_t len,
126 TFrame&& frame,
127 TMsg& msg,
128 THandler& handler,
129 TExtraValues... extraValues)
130{
131 return details::ProcessHelper::processSingleWithDispatchViaDispatcher<TDispatcher>(bufIter, len, std::forward<TFrame>(frame), msg, handler, std::forward<TExtraValues>(extraValues)...);
132}
133
156template <typename TBufIter, typename TFrame, typename THandler, typename... TExtraValues>
158 TBufIter bufIter,
159 std::size_t len,
160 TFrame&& frame,
161 THandler& handler)
162{
163 return details::ProcessHelper::processAllWithDispatch(bufIter, len, std::forward<TFrame>(frame), handler);
164}
165
189template <typename TDispatcher, typename TBufIter, typename TFrame, typename THandler, typename... TExtraValues>
191 TBufIter bufIter,
192 std::size_t len,
193 TFrame&& frame,
194 THandler& handler)
195{
196 return details::ProcessHelper::processAllWithDispatchViaDispatcher<TDispatcher>(bufIter, len, std::forward<TFrame>(frame), handler);
197}
198
199} // 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:17
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:157
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:43
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:81
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:123
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:190