increment.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef FILTERS_MEAN_HPP_
31 #define FILTERS_MEAN_HPP_
32 
33 #include <stdint.h>
34 #include <cstring>
35 #include <stdio.h>
36 
37 #include "filters/filter_base.hpp"
38 
39 namespace filters
40 {
41 
45 template <typename T>
46 class IncrementFilter: public FilterBase <T>
47 {
48 public:
51 
55 
56  virtual bool configure();
57 
62  virtual bool update( const T & data_in, T& data_out);
63 
64 };
65 
66 
67 template <typename T>
69 {
70 }
71 
72 template <typename T>
74 {
75 
76  return true;
77 }
78 
79 template <typename T>
81 {
82 }
83 
84 
85 template <typename T>
86 bool IncrementFilter<T>::update(const T & data_in, T& data_out)
87 {
88  data_out = data_in + 1;
89 
90  return true;
91 }
92 
96 template <typename T>
98 {
99 public:
102 
106 
107  virtual bool configure();
108 
113  virtual bool update( const std::vector<T> & data_in, std::vector<T>& data_out);
114 
115 protected:
117 
118 
119 
120 };
121 
122 
123 template <typename T>
125 {
126 }
127 
128 template <typename T>
130 {
131 
132  return true;
133 }
134 
135 template <typename T>
137 {
138 }
139 
140 
141 template <typename T>
142 bool MultiChannelIncrementFilter<T>::update(const std::vector<T> & data_in, std::vector<T>& data_out)
143 {
144  if (data_in.size() != number_of_channels_ || data_out.size() != number_of_channels_)
145  {
146  ROS_ERROR("Configured with wrong size config:%d in:%d out:%d", number_of_channels_, (int)data_in.size(), (int)data_out.size());
147  return false;
148  }
149 
150 
151  //Return each value
152  for (uint32_t i = 0; i < number_of_channels_; i++)
153  {
154  data_out[i] = data_in[i] + 1;
155  }
156 
157  return true;
158 }
159 
160 }
161 #endif// FILTERS_INCREMENT_HPP_
filters::FilterBase
A Base filter class to provide a standard interface for all filters.
Definition: filter_base.hpp:47
filters::MultiChannelIncrementFilter::~MultiChannelIncrementFilter
~MultiChannelIncrementFilter()
Destructor to clean up.
Definition: increment.hpp:136
filter_base.hpp
filters
Definition: filter_base.hpp:38
filters::MultiChannelIncrementFilter::configure
virtual bool configure()
Pure virtual function for the sub class to configure the filter This function must be implemented in ...
Definition: increment.hpp:129
filters::IncrementFilter
A increment filter which works on doubles.
Definition: increment.hpp:46
filters::IncrementFilter::update
virtual bool update(const T &data_in, T &data_out)
Update the filter and return the data seperately.
Definition: increment.hpp:86
filters::MultiChannelIncrementFilter
A increment filter which works on arrays.
Definition: increment.hpp:97
filters::IncrementFilter::~IncrementFilter
~IncrementFilter()
Destructor to clean up.
Definition: increment.hpp:80
filters::MultiChannelFilterBase
Definition: filter_base.hpp:380
filters::MultiChannelIncrementFilter::MultiChannelIncrementFilter
MultiChannelIncrementFilter()
Construct the filter with the expected width and height.
Definition: increment.hpp:124
ROS_ERROR
#define ROS_ERROR(...)
filters::IncrementFilter::configure
virtual bool configure()
Pure virtual function for the sub class to configure the filter This function must be implemented in ...
Definition: increment.hpp:73
filters::MultiChannelIncrementFilter::update
virtual bool update(const std::vector< T > &data_in, std::vector< T > &data_out)
Update the filter and return the data seperately.
Definition: increment.hpp:142
filters::IncrementFilter::IncrementFilter
IncrementFilter()
Construct the filter with the expected width and height.
Definition: increment.hpp:68


filters
Author(s):
autogenerated on Fri Nov 11 2022 03:09:05