00001 #ifndef FG_SXREL_H
00002 #define FG_SXREL_H
00003
00004 #include <map>
00005 #include <string>
00006 #include <iostream>
00007
00008 using namespace std;
00009
00026 class SxRel
00027 {
00028
00029 public:
00030
00032 enum SxTokenRel
00033 {
00034 SxR_NONE = 0,
00035 SxR_ADJ,
00036 SxR_ADV,
00037 SxR_ATT,
00038 SxR_CC,
00039 SxR_DET,
00040 SxR_EPI,
00041 SxR_NN,
00042 SxR_NNPR,
00043 SxR_NOMPREP,
00044 SxR_OBJ,
00045 SxR_PRDE,
00046 SxR_PREP,
00047 SxR_REL,
00048 SxR_SUJ,
00049 SxR_VBATT,
00050 };
00051
00053 typedef map<string, SxTokenRel, less<string> > SxRelMap;
00055 typedef map<SxTokenRel, string> SxInvRelMap;
00056
00058 SxRel();
00059
00069 SxRel( const string &relStr, unsigned int recteur, unsigned int regi );
00071 virtual ~SxRel();
00072
00078 inline const string &getRelTypeText() const;
00086 bool setRelType( const string &relTypeText );
00091 inline SxTokenRel getRelType() const;
00096 void setRelType( SxTokenRel relType );
00097
00102 inline unsigned int getRegi() const;
00107 inline void setRegi( unsigned int regi );
00108
00113 inline unsigned int getRecteur() const;
00118 inline void setRecteur( unsigned int recteur );
00119
00127 static SxTokenRel stringToRel( const string &relTxt );
00136 static const string &relToString( SxTokenRel rel );
00137
00146 friend ostream &operator<< ( ostream &os, const SxRel &rel );
00147
00148 private:
00149
00151 static int initRelMap();
00153 static const int m_iIsMapInit;
00155 static SxRelMap m_mRelMap;
00157 static SxInvRelMap m_mInvRelMap;
00158
00160 SxTokenRel m_eRel;
00162 unsigned int m_uiRegi;
00164 unsigned int m_uiRecteur;
00165 };
00166
00167
00168
00169 inline unsigned int SxRel::getRegi() const
00170 {
00171 return m_uiRegi;
00172 }
00173
00174 inline unsigned int SxRel::getRecteur() const
00175 {
00176 return m_uiRecteur;
00177 }
00178
00179 inline void SxRel::setRegi( unsigned int regi )
00180 {
00181 m_uiRegi = regi;
00182 }
00183
00184 inline void SxRel::setRecteur( unsigned int recteur )
00185 {
00186 m_uiRecteur = recteur;
00187 }
00188
00189 inline SxRel::SxTokenRel SxRel::getRelType() const
00190 {
00191 return m_eRel;
00192 }
00193
00194 inline const string &SxRel::getRelTypeText() const
00195 {
00196 return SxRel::relToString( getRelType() );
00197 }
00198
00199 #endif // #ifndef FG_SXREL_H