filter.h

00001 /* nprecv and libradar_stp packages
00002  * by Nick Luther <radar@k9nl.net>
00003  *
00004  * filter.h
00005  * AWIPS SBN WMO/PID filter
00006  */
00007  
00008 /* Copyright (C) 2007 Nicholas J. Luther
00009  *
00010  * This program is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU General Public License,
00012  * version 2, as published by the Free Software Foundation.
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 General Public License for more details.
00018  * 
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022  * You may contact the author by writing to Nick Luther, 1655 South
00023  * Westhaven Drive, Oshkosh, Wisconsin 54904, USA.
00024  * 
00025  */
00026  
00027  
00028 #ifndef _LIBRSTP_INC_FILTER_H
00029 #define _LIBRSTP_INC_FILTER_H
00030 
00031 #include <string>
00032 #include <set>
00033 
00034 namespace libradar_stp {
00035 
00050 class Filter {
00051 public:
00052  
00053   Filter();
00054   Filter( const Filter& f );
00055   ~Filter();
00056   
00057   bool setFile( const std::string& file );
00058   void addRule( const std::string& id );
00059   
00060   bool check( const std::string& data, unsigned int wmo_index );
00061   
00062   std::string getLastWMO() const;
00063   std::string getLastAWIPS() const;
00064   
00065   Filter& operator= ( const Filter& f );
00066   
00067 private:
00068 
00069   std::string  m_file;
00070   int          m_modtime;
00071   int          m_stat_counter;
00072   
00073   std::string  m_last_wmo;
00074   std::string  m_last_awips;
00075   
00076   std::set< std::string > m_idset;
00077 
00078 }; // class Filter
00079 
00080 }; // namespace nprecv
00081 
00082 #endif
00083 

Generated on Tue Jul 1 20:25:26 2008 for libradar_stp by  doxygen 1.4.7