00001 /****************************************************************************** 00002 * \file 00003 * 00004 * $Id:$ 00005 * 00006 * Copyright (C) Brno University of Technology 00007 * 00008 * This file is part of software developed by dcgm-robotics@FIT group. 00009 * 00010 * Author: Vit Stancl (stancl@fit.vutbr.cz) 00011 * Supervised by: Michal Spanel (spanel@fit.vutbr.cz) 00012 * Date: dd/mm/2012 00013 * 00014 * This file is free software: you can redistribute it and/or modify 00015 * it under the terms of the GNU Lesser General Public License as published by 00016 * the Free Software Foundation, either version 3 of the License, or 00017 * (at your option) any later version. 00018 * 00019 * This file is distributed in the hope that it will be useful, 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 * GNU Lesser General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU Lesser General Public License 00025 * along with this file. If not, see <http://www.gnu.org/licenses/>. 00026 */ 00027 00028 #pragma once 00029 #ifndef OCTOMAP_FILTER_BASE_H_ 00030 #define OCTOMAP_FILTER_BASE_H_ 00031 00032 #include <srs_env_model/but_server/server_tools.h> 00033 #include <boost/timer.hpp> 00034 00035 namespace srs_env_model 00036 { 00037 00038 class COcTreeFilterBase 00039 { 00040 public: 00042 enum ERunMode 00043 { 00044 FILTER_ALLWAYS, 00045 FILTER_TEST_FRAME, 00046 FILTER_TEST_TIME 00047 }; 00048 00049 public: 00051 COcTreeFilterBase( const std::string & octree_frame_id, ERunMode mode = FILTER_ALLWAYS ); 00052 00054 void setFrameSkip( unsigned skip ); 00055 00057 bool setTimerLap( double lap ); 00058 00060 void filter( tButServerOcTree & tree, bool bPruneAfterFinish = true ); 00061 00063 void setRunMode( ERunMode mode ) { m_mode = mode; } 00064 00066 void setTreeFrameId( const std::string & tree_frame_id ) { m_treeFrameId = tree_frame_id; } 00067 00069 virtual void writeLastRunInfo(){} 00070 00071 protected: 00073 bool useFrame(); 00074 00076 virtual void filterInternal( tButServerOcTree & tree ){} 00077 00078 protected: 00080 ERunMode m_mode; 00081 00083 unsigned m_framesSkipped; 00084 00086 long m_framesCount; 00087 00089 boost::timer m_timer; 00090 00092 double m_lap; 00093 00095 std::string m_treeFrameId; 00096 00097 }; // class COcTreeFilter 00098 00099 } // namespace srs_env_model 00100 00101 #endif /* OCTOMAP_FILTER_BASE_H_ */