00001 /* -*- c++ -*- (for Emacs) 00002 * 00003 * stlrecognitioncommon.h 00004 * Digest 00005 * 00006 * Created by Aidan Lane on Sun Apr 9 2006. 00007 * Copyright (c) 2006 Optimisation and Constraint Solving Group, 00008 * Monash University. All rights reserved. 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 */ 00024 00025 #ifndef STLRECOGNITIONCOMMON_H 00026 #define STLRECOGNITIONCOMMON_H 00027 00028 00029 #include <list> 00030 #include <map> 00031 #include <sstream> 00032 #include <string> 00033 #include <vector> 00034 00035 00036 typedef double StlClassProbabilityT; 00037 typedef std::map<int, StlClassProbabilityT> StlClassProbabilities; 00038 00039 typedef double StlFeatureResultT; 00040 typedef std::vector<StlFeatureResultT> StlFeatureVec; 00041 00042 00043 typedef float StlStrokeCoordT; 00044 typedef float StlStrokePressureT; 00045 typedef uint32_t StlStrokeTimeT; 00046 00047 struct StlStrokePoint { 00048 StlStrokePoint( StlStrokeCoordT x = 0.0, 00049 StlStrokeCoordT y = 0.0, 00050 StlStrokePressureT pressure = 0.0, 00051 StlStrokeTimeT milliTime = 0 ) 00052 : x(x), 00053 y(y), 00054 pressure(pressure), 00055 milliTime(milliTime) 00056 {} 00057 00058 StlStrokeCoordT x; 00059 StlStrokeCoordT y; 00060 StlStrokePressureT pressure; 00061 StlStrokeTimeT milliTime; 00062 #if 0 00063 float rotation; 00064 float xTilt; 00065 float yTilt; 00066 #endif 00067 }; 00068 00069 typedef std::vector<StlStrokePoint> StlStroke; 00070 typedef std::list<StlStroke> StlStrokeList; 00071 00072 00073 template <class T> 00074 bool from_string( T& t, 00075 const std::string& s, 00076 std::ios_base& (*f)(std::ios_base&) = std::dec ) { 00077 std::istringstream iss(s); 00078 return !(iss >> f >> t).fail(); 00079 } 00080 00081 00082 #endif // ! STLRECOGNITIONCOMMON_H
1.5.2