policy_base.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * fkie_message_filters
4  * Copyright © 2018-2020 Fraunhofer FKIE
5  * Author: Timo Röhling
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ****************************************************************************/
20 
21 #ifndef INCLUDE_FKIE_MESSAGE_FILTERS_COMBINER_POLICIES_POLICY_BASE_H_
22 #define INCLUDE_FKIE_MESSAGE_FILTERS_COMBINER_POLICIES_POLICY_BASE_H_
23 
24 #include "../types.h"
25 #include <boost/optional.hpp>
26 
27 namespace fkie_message_filters
28 {
29 
30 template<template<typename...> class, class...> class Combiner;
31 
32 namespace combiner_policies
33 {
34 
36 template<class... IOs>
38 {
39 public:
40  template<template<typename...> class, class...> friend class fkie_message_filters::Combiner;
42  using IncomingTuples = std::tuple<helpers::io_tuple_t<IOs>...>;
46  using EmitterCB = std::function<void(const OutgoingTuple&)>;
47  virtual ~PolicyBase() {}
48 protected:
53  void set_emitter_callback(const EmitterCB&) noexcept;
58  virtual void reset() noexcept = 0;
64  using MaybeOutgoingTuples = std::tuple<boost::optional<helpers::io_tuple_t<IOs>>...>;
69  void emit (const OutgoingTuple& out);
70 private:
72 };
73 
74 } // namespace combiner_policies
75 } // namespace fkie_message_filters
76 
77 #include "policy_base_impl.h"
78 
79 #endif /* INCLUDE_FKIE_MESSAGE_FILTERS_COMBINER_POLICIES_POLICY_BASE_H_ */
Base class for combiner policies.
Definition: policy_base.h:37
std::tuple< helpers::io_tuple_t< IOs >... > IncomingTuples
Tuple type of incoming data tuples.
Definition: policy_base.h:42
std::function< void(const OutgoingTuple &)> EmitterCB
Callback for assembled outputs.
Definition: policy_base.h:46
std::tuple< boost::optional< helpers::io_tuple_t< IOs > >... > MaybeOutgoingTuples
Tuple of outgoing tuple candidates.
Definition: policy_base.h:64
helpers::io_tuple_t< helpers::io_concat_t< IOs... > > OutgoingTuple
Combined tuple type for data output.
Definition: policy_base.h:44
Primary namespace.
Definition: buffer.h:33
typename io_tuple< IO >::type io_tuple_t
Definition: io.h:111
Combine multiple sources into a single one.
Definition: combiner.h:72
typename io_concat< Ts... >::type io_concat_t
Definition: io.h:102


fkie_message_filters
Author(s): Timo Röhling
autogenerated on Mon Feb 28 2022 22:21:43