presage
0.9.1
src
lib
core
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
31
class
ContextTracker
;
32
46
class
PredictorRegistry
:
public
Observer
{
47
public
:
48
PredictorRegistry
(
Configuration
*
config
);
49
~PredictorRegistry
();
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
67
Iterator
iterator
();
68
void
setContextTracker
(
ContextTracker
* ct);
69
70
class
PredictorRegistryException
:
public
PresageException
{
71
public
:
72
PredictorRegistryException
(
presage_error_code_t
code,
const
std::string& desc)
throw
() :
PresageException
(code, desc) { }
73
virtual
~PredictorRegistryException
() throw() { }
74
75
private
:
76
PredictorRegistryException
() throw() :
PresageException
(
PRESAGE_ERROR
, "") { }
77
78
};
79
80
static
const
char
*
LOGGER
;
81
static
const
char
*
PREDICTORS
;
82
83
private
:
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
90
Configuration
*
config
;
91
ContextTracker
*
contextTracker
;
92
Logger<char>
logger
;
93
94
std::string
predictors_list
;
95
std::vector<Predictor*>
predictors
;
// active Predictors
96
97
Dispatcher<PredictorRegistry>
dispatcher
;
98
};
99
100
#endif // PRESAGE_PREDICTORREGISTRY
Logger< char >
presage_error_code_t
presage_error_code_t
Definition:
presageException.h:32
PRESAGE_ERROR
Definition:
presageException.h:35
PredictorRegistry::PREDICTORS
static const char * PREDICTORS
Definition:
predictorRegistry.h:81
Dispatcher< PredictorRegistry >
PredictorRegistry::removePredictor
void removePredictor(const std::string &predictor_name)
Definition:
predictorRegistry.cpp:204
PredictorRegistry::Iterator::iter_curr
std::vector< Predictor * >::iterator iter_curr
Definition:
predictorRegistry.h:63
Predictor
Definition:
predictor.h:46
PredictorRegistry::~PredictorRegistry
~PredictorRegistry()
Definition:
predictorRegistry.cpp:55
PredictorRegistry::config
Configuration * config
Definition:
predictorRegistry.h:90
PredictorRegistry::PredictorRegistryException::PredictorRegistryException
PredictorRegistryException()
Definition:
predictorRegistry.h:76
PredictorRegistry::Iterator::Iterator
Iterator(std::vector< Predictor *> &)
Definition:
predictorRegistry.cpp:240
PredictorRegistry::update
virtual void update(const Observable *variable)
Definition:
predictorRegistry.cpp:262
PredictorRegistry::Iterator::~Iterator
~Iterator()
Definition:
predictorRegistry.cpp:245
PredictorRegistry::logger
Logger< char > logger
Definition:
predictorRegistry.h:92
PredictorRegistry::PredictorRegistry
PredictorRegistry(Configuration *config)
Definition:
predictorRegistry.cpp:43
PredictorRegistry
Definition:
predictorRegistry.h:46
PredictorRegistry::predictors
std::vector< Predictor * > predictors
Definition:
predictorRegistry.h:95
PredictorRegistry::dispatcher
Dispatcher< PredictorRegistry > dispatcher
Definition:
predictorRegistry.h:97
PredictorRegistry::addPredictor
void addPredictor(const std::string &predictor_name)
Definition:
predictorRegistry.cpp:131
PredictorRegistry::iterator
Iterator iterator()
Definition:
predictorRegistry.cpp:232
PredictorRegistry::removePredictors
void removePredictors()
Definition:
predictorRegistry.cpp:223
PresageException
Definition:
presageException.h:67
PredictorRegistry::LOGGER
static const char * LOGGER
Definition:
predictorRegistry.h:80
PredictorRegistry::predictors_list
std::string predictors_list
Definition:
predictorRegistry.h:94
PredictorRegistry::Iterator::hasNext
bool hasNext() const
Definition:
predictorRegistry.cpp:248
PredictorRegistry::Iterator::iter_end
std::vector< Predictor * >::iterator iter_end
Definition:
predictorRegistry.h:62
PredictorRegistry::setContextTracker
void setContextTracker(ContextTracker *ct)
Definition:
predictorRegistry.cpp:67
Observer
Definition:
observer.h:34
dispatcher.h
PredictorRegistry::PredictorRegistryException::~PredictorRegistryException
virtual ~PredictorRegistryException()
Definition:
predictorRegistry.h:73
PredictorRegistry::Iterator::next
Predictor * next()
Definition:
predictorRegistry.cpp:255
Configuration
Definition:
configuration.h:36
PredictorRegistry::Iterator
Definition:
predictorRegistry.h:53
PredictorRegistry::setLogger
void setLogger(const std::string &level)
Definition:
predictorRegistry.cpp:60
ContextTracker
Tracks user interaction and context.
Definition:
contextTracker.h:155
PredictorRegistry::PredictorRegistryException::PredictorRegistryException
PredictorRegistryException(presage_error_code_t code, const std::string &desc)
Definition:
predictorRegistry.h:72
Observable
Definition:
observable.h:37
PredictorRegistry::PredictorRegistryException
Definition:
predictorRegistry.h:70
PredictorRegistry::setPredictors
void setPredictors(const std::string &predictor_list)
Definition:
predictorRegistry.cpp:75
PredictorRegistry::contextTracker
ContextTracker * contextTracker
Definition:
predictorRegistry.h:91
Generated on Tue Dec 10 2019 19:53:40 for presage by
1.8.13