Few more things
[apertium.git] / lttoolbox / lttoolbox / MatchExe.H
blob246ef0a9906e9b2cca5eaea595204d95cfef1c43
1 /*
2  * Copyright (C) 2005 Universitat d'Alacant / Universidad de Alicante
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17  * 02111-1307, USA.
18  */
19         
20 #ifndef _MATCHEXE_
21 #define _MATCHEXE_
23 #include <cstdio>
24 #include <cstdlib>
25 #include <map>
26 #include <set>
27 #include <vector>
29 #include <lttoolbox/MatchNode.H>
30 #include <lttoolbox/Transducer.H>
32 using namespace std;
34 /**
35  * Matcher class for execution of lexical recognizing algorithms
36  */
37 class MatchExe
39 private:
40   /**
41    * Initial state
42    */
43   int initial_id;
45   /**
46    * MatchNode list
47    */
48   vector<MatchNode> node_list;
50   /**
51    * Set of final nodes
52    */
53   map<MatchNode *, int> finals;
55   /**
56    * Copy function
57    * @param te the transducer to be copied
58    */
59   void copy(MatchExe const &te);
61   /**
62    * Destroy function
63    */
64   void destroy();
66 public:
67   
68   /**
69    * Constructor
70    */
71   MatchExe();
73   /**
74    * From transducer constructor
75    * @param t the transducer
76    * @param final_type the final types
77    */
78    MatchExe(Transducer const &t, map<int, int> const &final_type);
80   /**
81    * Destructor
82    */
83   ~MatchExe();
85   /**
86    * Copy constructor
87    * @param te the transducer to be copied
88    */
89   MatchExe(MatchExe const &te);
91   /**
92    * Assignment operator
93    * @param te the transducer to be assigned
94    * @return the assigned object
95    */
96   MatchExe & operator =(MatchExe const &te);
98   /**
99    * Gets the initial node of the transducer
100    * @return the initial node
101    */
102   MatchNode * getInitial();
104   /**
105    * Gets the set of final nodes
106    * @return the set of final nodes
107    */
108   map<MatchNode *, int> & getFinals();
111 #endif