presage
0.8.8
Main Page
Classes
Files
File List
File Members
src
lib
core
predictorActivator.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_PREDICTORACTIVATOR
26
#define PRESAGE_PREDICTORACTIVATOR
27
28
#ifdef HAVE_CONFIG_H
29
# include "config.h"
30
#endif
31
32
#include "
configuration.h
"
33
#include "
predictorRegistry.h
"
34
#include "
context_tracker/contextTracker.h
"
35
#include "
prediction.h
"
36
#include "
logger.h
"
37
#include "
dispatcher.h
"
38
39
#include "
combiner.h
"
40
#include "
meritocracyCombiner.h
"
41
42
#include "
predictors/predictor.h
"
43
44
45
#ifdef STDC_HEADERS
46
# include <stdlib.h>
// needed for abort function
47
#endif
48
49
62
class
PredictorActivator
:
public
Observer
{
63
public
:
64
//PLUMP PredictorActivator(HistoryTracker&,
65
//PLUMP plump::Plump&);
66
77
PredictorActivator
(
Configuration
*
config
,
PredictorRegistry
* registry,
ContextTracker
*
contextTracker
);
78
82
~PredictorActivator
();
83
92
Prediction
predict
(
unsigned
int
multiplier,
const
char
** filter);
93
98
void
setPredictors
(
const
std::string& predictorList);
99
104
void
addPredictor
(
const
std::string& predictorName);
105
109
void
removePredictors
();
110
118
int
getPredictTime
()
const
;
119
125
void
setPredictTime
(
const
std::string& predictTime);
126
135
std::string
getCombinationPolicy
()
const
;
136
148
void
setCombinationPolicy
(
const
std::string& policy);
149
154
void
setMaxPartialPredictionSize
(
const
std::string& size);
155
160
void
setLogger
(
const
std::string& level);
161
162
void
parse_internal_commands
(
Prediction
& pred);
163
164
virtual
void
update
(
const
Observable
* variable);
165
166
static
const
char
*
LOGGER
;
167
static
const
char
*
PREDICT_TIME
;
168
static
const
char
*
MAX_PARTIAL_PREDICTION_SIZE
;
169
static
const
char
*
COMBINATION_POLICY
;
170
171
private
:
172
// execute predictor function (invoked in thread)
173
void
*
execute
(
void
*);
174
175
176
Configuration
*
config
;
177
PredictorRegistry
*
predictorRegistry
;
178
ContextTracker
*
contextTracker
;
179
180
Logger<char>
logger
;
181
182
Combiner
*
combiner
;
183
std::string
combinationPolicy
;
184
185
int
max_partial_prediction_size
;
186
187
std::vector<Prediction>
predictions
;
// predictions computed by each predictor are returned here
188
189
int
predict_time
;
190
191
Dispatcher<PredictorActivator>
dispatcher
;
192
};
193
194
#endif // PRESAGE_PREDICTORACTIVATOR
Generated on Wed Jun 13 2012 10:34:24 for presage by
1.8.1