Few more things
[apertium.git] / lttoolbox / lttoolbox / MatchNode.H
blobc6aea9393f052bacb96a5d0cf49ae65af8a99276
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  */
20 #ifndef _MATCHNODE_
21 #define _MATCHNODE_
23 #include <cstdlib>
24 #include <list>
25 #include <map>
26 #include <lttoolbox/SortedVector.H>
28 class MatchState;
30 using namespace std;
32 //class MatchNode;
33 //typedef map<int, MatchNode *> MNode;
35 typedef SortedVector MNode;
37 /**
38  * Node class of TransExe.  State is a friend class since the
39  * algorithms are implemented in MatchState
40  */
41 class MatchNode
43 private:
44   friend class MatchState;
45   
46   /**
47    * The outgoing transitions from this node. 
48    * Schema: (input symbol, destination)
49    */
50   MNode transitions;
52   /**
53    * Copy method
54    * @param n the node to be copied
55    */
56   void copy(MatchNode const &n);
58   /**
59    * Destroy method
60    */
61   void destroy();
63 public:
65   /**
66    * Constructor
67    */
68   MatchNode(int const svsize);
70   /**
71    * Destructor
72    */
73   ~MatchNode();
75   /**
76    * Copy constructor 
77    * @param n the node to be copied
78    */
79   MatchNode(MatchNode const &n);
81   /**
82    * Assignment operator
83    * @param n the node to be assigned
84    * @return the assigned object
85    */
86   MatchNode & operator=(MatchNode const &n);
88   /**
89    * Making a link between this node and another
90    * @param i input symbol
91    * @param d destination
92    */
93   void addTransition(int const i, MatchNode * const d, int pos);
96 #endif