presage  0.8.7
predictor.cpp
Go to the documentation of this file.
00001 
00002 /******************************************************
00003  *  Presage, an extensible predictive text entry system
00004  *  ---------------------------------------------------
00005  *
00006  *  Copyright (C) 2008  Matteo Vescovi <matteo.vescovi@yahoo.co.uk>
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License along
00019     with this program; if not, write to the Free Software Foundation, Inc.,
00020     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00021                                                                              *
00022                                                                 **********(*)*/
00023 
00024 
00025 #include "predictor.h"
00026 
00027 #ifdef HAVE_STDLIB_H
00028 # include <stdlib.h>
00029 #endif
00030 
00039 Predictor::Predictor(Configuration* config,
00040                      ContextTracker* ct,
00041                      const char* predictorName,
00042                      const char* shortDesc,
00043                      const char* longDesc)
00044     : name            (predictorName),
00045       shortDescription(shortDesc ),
00046       longDescription (longDesc  ),
00047       contextTracker  (ct        ),
00048       configuration   (config    ),
00049       logger          (predictorName, std::cerr)
00050 {
00051     // NOTE: predictor implementations deriving from this class should
00052     // use profile to query the value of needed configuration
00053     // variables.
00054 }
00055 
00059 Predictor::~Predictor()
00060 {}
00061 
00065 const std::string Predictor::getName() const
00066 {
00067     return name;
00068 }
00069 
00073 const std::string Predictor::getShortDescription() const
00074 {
00075     return shortDescription;
00076 }
00077 
00081 const std::string Predictor::getLongDescription() const
00082 {
00083     return longDescription;
00084 }
00085 
00086 
00087 void Predictor::set_logger (const std::string& level)
00088 {
00089     logger << setlevel (level);
00090     logger << INFO << "LOGGER: " << level << endl;
00091 }
00092