Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

boss_fsa.h

Go to the documentation of this file.
00001 /* boss_fsa.h    $Revision: 1.3 $ $Date: 2005/12/10 20:33:54 $
00002    Copyright (C) 2000 University of Bonn.
00003    http://www.ikp.uni-bonn.de/boss
00004 
00005    This program is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU General Public License
00007    as published by the Free Software Foundation; either version 2
00008    of the License, or (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 Free Software
00017    Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA  02111-1307, USA.
00019 */
00020 
00026 #ifndef BOSS_FSA_H
00027 #define BOSS_FSA_H
00028 
00029 using namespace std;
00030 
00031 #include "boss_types.h"
00032 #include "boss_exceptions.h"
00033 #include <regex.h>
00034 #include <iterator>
00035 
00036 namespace BOSS
00037 {
00042   struct NoRegexMatch {
00043     string name;
00044     string inf;
00045     NoRegexMatch(const string & N, const string & I, const bool f = false) :
00046       name(N), inf(I) { if(f) printError(false); }
00047     void printError(const bool & fatal = false) const
00048     {
00049       if(fatal) {
00050         cerr << name << " : Fatal: Unknown phone symbol in: " << inf << endl; exit(-1);
00051       }
00052       else {
00053         cerr << name << " : Unknown phone symbol in: " << inf << ". Ignoring!" << endl;
00054       }
00055     }
00056   };
00057 }
00058 
00059 namespace BOSS
00060 {
00061  
00076   class FSA {
00077 
00078   protected:
00079     regex_t preg;
00080     FSA() {}
00081 
00082   public:
00084     FSA(const string & filename) throw(BOSS::FileOpenError, BOSS::FileFormatError);
00085 
00087     FSA(const BOSS::t_SVector & expressions) throw(BOSS::FileFormatError);
00088 
00092     ~FSA();
00093 
00095     BOSS::t_SVector parse(const string & trans) const throw(BOSS::NoRegexMatch);
00096   };
00097 }
00098 #endif

Generated on Tue Dec 20 23:14:37 2005 for BOSS by doxygen 1.3.6