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

dom_userdata.h

Go to the documentation of this file.
00001 /* dom_userdata.h    $Revision: 1.4 $ $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 
00021 #ifndef DOM_USERDATA_H
00022 #define DOM_USERDATA_H
00023 
00024 using namespace std;
00025 
00026 #include "boss_mysql/boss_mysql_handler.h"
00027 #include <xercesc/dom/DOM.hpp>
00028 #include "boss_utility/dom_tools.h"
00029 #include <vector>
00030 #include <sstream>
00031 #include "tdsp/dsp_vector.h"
00032 
00038 typedef dsp::vector<short> t_Signal;
00039 
00040 class DOM_UserData {
00041 public:
00042 
00043         enum Node_Type {
00044                 WORD     = 1,
00045                 MORPHEME = 2,
00046                 SYLLABLE = 3,
00047                 PHONE  = 4,
00048                 HALFPHONE = 5,
00049         };
00050 
00051  private:
00052 
00053         MySQL_Result   data_base_query;
00054         unsigned       pos;
00055         Node_Type      type;
00056         unsigned       signal_size;
00057         t_Signal       signal;
00058 
00059 public:
00060 
00061   static const unsigned npos = static_cast<unsigned>(-1);
00062 
00063         DOM_UserData()
00064                 : pos(npos), signal_size(0) {}
00065         DOM_UserData(const MySQL_Result & dbq, const Node_Type & t)
00066                 : data_base_query(dbq), pos(npos), type(t), signal_size(0) {}
00067         ~DOM_UserData();
00068 
00069         ostream & printQueryItems(ostream & out);
00070         ostream & printSelectedRow(ostream & out);
00071         const MySQL_Result & getResult() const
00072                 { return data_base_query; }
00073         string getResult(const unsigned & p, const string & r) const
00074                 { return data_base_query(p, r); }
00075         string getResult(const string & r) const
00076                 { return data_base_query(pos, r); }
00077         Node_Type getType() const
00078                 { return type; }
00079         unsigned getPos() const
00080                 { return pos; }
00081         void setPos(const unsigned & p)
00082                 { pos = p; }
00083         void setSignalSize(const unsigned & s)
00084           { signal_size=s; }
00085         unsigned getSignalSize()
00086           { return signal_size; }
00087         void setSignal(const t_Signal & s)
00088           { signal=s; }
00089         t_Signal & getSignal() {
00090                 return signal;
00091         }
00092 };
00093 
00094 namespace BOSS
00095 {
00096   void writeLabels(const xercesc::DOMNode * sentence, const string & fname);
00097   void getLabels(const xercesc::DOMNode * node, vector< vector< string > > & file, unsigned & last);
00098 }
00099 
00100 #endif

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