Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * filter.h - Laser data filter interface 00004 * 00005 * Created: Fri Oct 10 17:11:04 2008 00006 * Copyright 2006-2011 Tim Niemueller [www.niemueller.de] 00007 ****************************************************************************/ 00008 00009 /* This program is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU Library General Public License for more details. 00018 * 00019 * Read the full text in the LICENSE.GPL file in the doc directory. 00020 */ 00021 00022 #ifndef __PLUGINS_LASER_FILTER_FILTER_H_ 00023 #define __PLUGINS_LASER_FILTER_FILTER_H_ 00024 00025 #include <vector> 00026 #include <string> 00027 00028 class LaserDataFilter 00029 { 00030 public: 00031 class Buffer { 00032 public: 00033 Buffer(size_t num_values = 0); 00034 std::string frame; ///< reference coordinate frame ID 00035 float *values; ///< values 00036 }; 00037 00038 LaserDataFilter(unsigned int in_data_size, 00039 std::vector<Buffer *> &in, unsigned int out_size); 00040 virtual ~LaserDataFilter(); 00041 00042 virtual std::vector<Buffer *> & get_out_vector(); 00043 virtual void set_out_vector(std::vector<Buffer *> &out); 00044 virtual unsigned int get_out_data_size(); 00045 00046 virtual void filter() = 0; 00047 00048 void set_array_ownership(bool own_in, bool own_out); 00049 /** Check if input arrays are owned by filter. 00050 * @return true if arrays are owned by this filter, false otherwise. */ 00051 bool owns_in() const { return __own_in; }; 00052 /** Check if output arrays are owned by filter. 00053 * @return true if arrays are owned by this filter, false otherwise. */ 00054 bool owns_out() const { return __own_out; }; 00055 00056 protected: 00057 virtual void set_out_data_size(unsigned int data_size); 00058 00059 void reset_outbuf(Buffer *b); 00060 void copy_to_outbuf(Buffer *outbuf, const Buffer *inbuf); 00061 00062 00063 protected: 00064 unsigned int out_data_size; 00065 unsigned int in_data_size; 00066 std::vector<Buffer *> in; 00067 std::vector<Buffer *> out; 00068 00069 private: 00070 bool __own_in; 00071 bool __own_out; 00072 }; 00073 00074 00075 #endif