filter_impl.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 #ifndef INCLUDE_FKIE_MESSAGE_FILTERS_FILTER_IMPL_H_
21 #define INCLUDE_FKIE_MESSAGE_FILTERS_FILTER_IMPL_H_
22 
23 #include "filter.h"
24 
25 namespace fkie_message_filters
26 {
27 
28 template<class In, class Out>
29 void Filter<In, Out>::disconnect() noexcept
30 {
31  this->disconnect_from_all_sources();
32  this->disconnect_from_all_sinks();
33 }
34 
35 namespace helpers
36 {
37 
38 template<typename Filter>
39 void chain_impl(Filter& flt) noexcept
40 {
41 }
42 
43 template<typename Filter1, typename Filter2, typename... MoreFilters>
44 void chain_impl(Filter1& flt1, Filter2& flt2, MoreFilters&... filters) noexcept
45 {
46  chain_impl(flt2, filters...);
47  flt1.connect_to_sink(flt2);
48 }
49 
50 } // namespace helpers
51 
52 template<typename Filter1, typename Filter2, typename... MoreFilters>
53 void chain(Filter1& flt1, Filter2& flt2, MoreFilters&... filters) noexcept
54 {
55  helpers::chain_impl(flt1, flt2, filters...);
56 }
57 
58 } // namespace fkie_message_filters
59 
60 #endif /* INCLUDE_FKIE_MESSAGE_FILTERS_FILTER_IMPL_H_ */
fkie_message_filters
Definition: buffer.h:33
fkie_message_filters::chain
void chain(Filter1 &flt1, Filter2 &flt2, MoreFilters &... filters) noexcept
Convenience function to chain multiple filters.
Definition: filter_impl.h:71
Filter
filter.h
fkie_message_filters::helpers::chain_impl
void chain_impl(Filter &flt) noexcept
Definition: filter_impl.h:57
fkie_message_filters::Filter::disconnect
virtual void disconnect() noexcept override
Disconnect from all connected sources and sinks.
Definition: filter_impl.h:47


fkie_message_filters
Author(s): Timo Röhling
autogenerated on Wed Mar 2 2022 00:18:57