increment.h
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_H
31 #define FILTERS_MEAN_H
32 
33 #include <stdint.h>
34 #include <cstring>
35 #include <stdio.h>
36 
37 #include <boost/scoped_ptr.hpp>
38 
39 #include "filters/filter_base.h"
40 
41 namespace filters
42 {
43 
47 template <typename T>
48 class IncrementFilter: public FilterBase <T>
49 {
50 public:
53 
57 
58  virtual bool configure();
59 
64  virtual bool update( const T & data_in, T& data_out);
65 
66 };
67 
68 
69 template <typename T>
71 {
72 }
73 
74 template <typename T>
76 {
77 
78  return true;
79 }
80 
81 template <typename T>
83 {
84 }
85 
86 
87 template <typename T>
88 bool IncrementFilter<T>::update(const T & data_in, T& data_out)
89 {
90  data_out = data_in + 1;
91 
92  return true;
93 };
94 
98 template <typename T>
100 {
101 public:
104 
108 
109  virtual bool configure();
110 
115  virtual bool update( const std::vector<T> & data_in, std::vector<T>& data_out);
116 
117 protected:
119 
120 
121 
122 };
123 
124 
125 template <typename T>
127 {
128 }
129 
130 template <typename T>
132 {
133 
134  return true;
135 }
136 
137 template <typename T>
139 {
140 }
141 
142 
143 template <typename T>
144 bool MultiChannelIncrementFilter<T>::update(const std::vector<T> & data_in, std::vector<T>& data_out)
145 {
146  // ROS_ASSERT(data_in.size() == width_);
147  //ROS_ASSERT(data_out.size() == width_);
148  if (data_in.size() != number_of_channels_ || data_out.size() != number_of_channels_)
149  {
150  ROS_ERROR("Configured with wrong size config:%d in:%d out:%d", number_of_channels_, (int)data_in.size(), (int)data_out.size());
151  return false;
152  }
153 
154 
155  //Return each value
156  for (uint32_t i = 0; i < number_of_channels_; i++)
157  {
158  data_out[i] = data_in[i] + 1;
159  }
160 
161  return true;
162 };
163 
164 }
165 #endif// FILTERS_INCREMENT_H
virtual bool update(const std::vector< T > &data_in, std::vector< T > &data_out)
Update the filter and return the data seperately.
Definition: increment.h:144
~MultiChannelIncrementFilter()
Destructor to clean up.
Definition: increment.h:138
A increment filter which works on doubles.
Definition: increment.h:48
virtual bool update(const T &data_in, T &data_out)
Update the filter and return the data seperately.
Definition: increment.h:88
virtual bool configure()
Pure virtual function for the sub class to configure the filter This function must be implemented in ...
Definition: increment.h:131
MultiChannelIncrementFilter()
Construct the filter with the expected width and height.
Definition: increment.h:126
A Base filter class to provide a standard interface for all filters.
Definition: filter_base.h:50
~IncrementFilter()
Destructor to clean up.
Definition: increment.h:82
virtual bool configure()
Pure virtual function for the sub class to configure the filter This function must be implemented in ...
Definition: increment.h:75
IncrementFilter()
Construct the filter with the expected width and height.
Definition: increment.h:70
A increment filter which works on arrays.
Definition: increment.h:99
#define ROS_ERROR(...)


filters
Author(s):
autogenerated on Sat Jun 8 2019 04:37:52