filter_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_FILTER_BASE_H_
22 #define INCLUDE_FKIE_MESSAGE_FILTERS_FILTER_BASE_H_
23 
24 #include "types.h"
25 #include <boost/noncopyable.hpp>
26 #include <functional>
27 
28 namespace fkie_message_filters
29 {
30 namespace helpers
31 {
32 template<class... Types>
33 struct FilterCB
34 {
35  using Type = std::function<void(const Types&...)>;
36 };
37 
38 template<class... Types>
39 struct FilterCB<IO<Types...>>
40 {
41  using Type = std::function<void(const Types&...)>;
42 };
43 
44 } // namespace helpers
45 
49 template<class... Types>
50 using FilterCB = typename helpers::FilterCB<Types...>::Type;
51 
57 class FilterBase : public boost::noncopyable
58 {
59 public:
60  virtual ~FilterBase() {}
65  virtual void disconnect() noexcept = 0;
75  virtual void reset() noexcept {};
76 };
77 
78 } // namespace fkie_message_filters
79 
80 #endif /* INCLUDE_FKIE_MESSAGE_FILTERS_FILTER_BASE_H_ */
std::function< void(const Types &...)> Type
Definition: filter_base.h:41
typename helpers::FilterCB< Types... >::Type FilterCB
Callback function for customizable filters.
Definition: filter_base.h:50
std::function< void(const Types &...)> Type
Definition: filter_base.h:35
Group multiple data types as filter input or output.
Definition: io.h:27
virtual void reset() noexcept
Reset filter state.
Definition: filter_base.h:75
Base class for filters.
Definition: filter_base.h:57
Primary namespace.
Definition: buffer.h:33


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