presage 0.9.1
predictorRegistry.h
Go to the documentation of this file.
1
2/******************************************************
3 * Presage, an extensible predictive text entry system
4 * ---------------------------------------------------
5 *
6 * Copyright (C) 2008 Matteo Vescovi <matteo.vescovi@yahoo.co.uk>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 **********(*)*/
23
24
25#ifndef PRESAGE_PREDICTORREGISTRY
26#define PRESAGE_PREDICTORREGISTRY
27
28#include "dispatcher.h"
29#include "../predictors/predictor.h"
30
31class ContextTracker;
32
47public:
50
51 virtual void update (const Observable* variable);
52
53 class Iterator {
54 public:
55 Iterator(std::vector<Predictor*>&);
56 ~Iterator();
57
58 bool hasNext() const;
59 Predictor* next();
60
61 private:
62 std::vector<Predictor*>::iterator iter_end;
63 std::vector<Predictor*>::iterator iter_curr;
64
65 };
66
69
71 public:
72 PredictorRegistryException(presage_error_code_t code, const std::string& desc) throw() : PresageException(code, desc) { }
73 virtual ~PredictorRegistryException() throw() { }
74
75 private:
77
78 };
79
80 static const char* LOGGER;
81 static const char* PREDICTORS;
82
83private:
84 void setLogger (const std::string& level);
85 void setPredictors(const std::string& predictor_list);
86 void addPredictor(const std::string& predictor_name);
87 void removePredictor(const std::string& predictor_name);
88 void removePredictors();
89
93
94 std::string predictors_list;
95 std::vector<Predictor*> predictors; // active Predictors
96
98};
99
100#endif // PRESAGE_PREDICTORREGISTRY
Tracks user interaction and context.
Definition: logger.h:57
Iterator(std::vector< Predictor * > &)
std::vector< Predictor * >::iterator iter_end
std::vector< Predictor * >::iterator iter_curr
PredictorRegistryException(presage_error_code_t code, const std::string &desc)
PredictorRegistry(Configuration *config)
void setLogger(const std::string &level)
void setContextTracker(ContextTracker *ct)
std::vector< Predictor * > predictors
Logger< char > logger
static const char * LOGGER
static const char * PREDICTORS
void addPredictor(const std::string &predictor_name)
ContextTracker * contextTracker
void removePredictor(const std::string &predictor_name)
std::string predictors_list
Configuration * config
void setPredictors(const std::string &predictor_list)
virtual void update(const Observable *variable)
Dispatcher< PredictorRegistry > dispatcher
virtual const presage_error_code_t code() const
PresageException(presage_error_code_t code, const std::string &msg)
presage_error_code_t
@ PRESAGE_ERROR