wlcacheddb.h

00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Michael Moritz                                  *
00003  *   mimo@restoel.net                                                      *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef WLCACHEDDB_H
00021 #define WLCACHEDDB_H
00022 
00023 #include <exception>
00024 #include <string>
00025 #include <map>
00026 #include "triplet.h"
00027 #include "db.h"
00028 #include "wlmodule.h"
00029 
00034 class WlCachedDB
00035 {
00036         class Heading : public std::map<std::string, unsigned>
00037         {
00038         };
00039         class Entry : public std::map<unsigned, std::string>
00040         {
00041         };
00042         class Data : public std::map<std::string, Entry>
00043         {
00044         };
00045 public:
00046     WlCachedDB(class DB& db,
00047                 bool initmode,
00048                 const WLStaticDef& staticDef) throw(std::exception);
00049         bool check(const class Triplet& triplet) throw(std::exception);
00050     ~WlCachedDB();
00051 protected:
00052         bool exactMatch(const std::string logprefix,const class Triplet& triplet);
00053         bool patternMatch(const std::string logprefix,const class Triplet& triplet);
00054         std::string getRowComment(Data::const_iterator& itr) const;
00055         void logMatch(const std::string& logprefix,Data::const_iterator& itr,const class Triplet& triplet) const;
00056 private:
00057         class DB& _db;  
00058         const WLStaticDef& _staticDef;
00059         Heading _heading;
00060         Data _data;
00061 };
00063 struct ToLower
00064 {
00065      char operator() (char c) const  { return std::tolower(c); }
00066 };
00067 #endif

Generated on Tue Jul 24 16:36:54 2007 for gps by  doxygen 1.5.1