#include <controller.h>
Public Member Functions | |
void | addCache (Cache< Token > *cache) |
called before the cache is started to add a cache in the chain | |
bool | addToken (Token *token) |
insert the token in the cache if not already present (actual insertion is done on updatePriorities) | |
Controller () | |
void | finish () |
void | flush () |
empty all caches AND REMOVES ALL TOKENS! | |
bool | isWaiting () |
bool | newData () |
void | pause () |
template<class FUNCTOR > | |
void | removeTokens (FUNCTOR functor) |
WARNING: migh stall for the time needed to drop tokens from cache. | |
void | resume () |
void | setMaxTokens (int m) |
if more tokens than m present in the provider, lowest priority ones will be removed | |
void | start () |
start the various cache threads. | |
void | stop () |
stops the cache threads | |
void | updatePriorities () |
~Controller () | |
Public Attributes | |
std::vector< Cache< Token > * > | caches |
should be protected | |
bool | paused |
Provider< Token > | provider |
should be protected | |
bool | stopped |
all cache threads are stopped | |
std::vector< Token * > | tokens |
tokens waiting to be added, should be private |
Definition at line 11 of file controller.h.
vcg::Controller< Token >::Controller | ( | ) | [inline] |
Definition at line 27 of file controller.h.
vcg::Controller< Token >::~Controller | ( | ) | [inline] |
Definition at line 28 of file controller.h.
void vcg::Controller< Token >::addCache | ( | Cache< Token > * | cache | ) | [inline] |
called before the cache is started to add a cache in the chain
The order in which the caches are added is from the lowest to the highest.
Definition at line 32 of file controller.h.
bool vcg::Controller< Token >::addToken | ( | Token * | token | ) | [inline] |
insert the token in the cache if not already present (actual insertion is done on updatePriorities)
Definition at line 42 of file controller.h.
void vcg::Controller< Token >::finish | ( | ) | [inline] |
Definition at line 116 of file controller.h.
void vcg::Controller< Token >::flush | ( | ) | [inline] |
empty all caches AND REMOVES ALL TOKENS!
Definition at line 158 of file controller.h.
bool vcg::Controller< Token >::isWaiting | ( | ) | [inline] |
Definition at line 172 of file controller.h.
bool vcg::Controller< Token >::newData | ( | ) | [inline] |
Definition at line 164 of file controller.h.
void vcg::Controller< Token >::pause | ( | ) | [inline] |
Definition at line 121 of file controller.h.
void vcg::Controller< Token >::removeTokens | ( | FUNCTOR | functor | ) | [inline] |
WARNING: migh stall for the time needed to drop tokens from cache.
Definition at line 52 of file controller.h.
void vcg::Controller< Token >::resume | ( | ) | [inline] |
Definition at line 140 of file controller.h.
void vcg::Controller< Token >::setMaxTokens | ( | int | m | ) | [inline] |
if more tokens than m present in the provider, lowest priority ones will be removed
Definition at line 62 of file controller.h.
void vcg::Controller< Token >::start | ( | ) | [inline] |
start the various cache threads.
Definition at line 83 of file controller.h.
void vcg::Controller< Token >::stop | ( | ) | [inline] |
stops the cache threads
Definition at line 94 of file controller.h.
void vcg::Controller< Token >::updatePriorities | ( | ) | [inline] |
ensure that added tokens are processed and existing ones have their priority updated. potential bug! update is done on the heaps, if something is in transit...
Definition at line 69 of file controller.h.
std::vector<Cache<Token> *> vcg::Controller< Token >::caches |
should be protected
Definition at line 25 of file controller.h.
bool vcg::Controller< Token >::paused |
threads still running, but no door is open in caches, transfers might still be going on!
Definition at line 17 of file controller.h.
Provider<Token> vcg::Controller< Token >::provider |
should be protected
Definition at line 23 of file controller.h.
bool vcg::Controller< Token >::stopped |
all cache threads are stopped
Definition at line 19 of file controller.h.
std::vector<Token *> vcg::Controller< Token >::tokens |
tokens waiting to be added, should be private
Definition at line 14 of file controller.h.