22 #ifndef FAWKES_SRC_PLUGINS_ROBOT_MEMORY_COMPUTABLES_COMPUTABLES_MANAGER_H_
23 #define FAWKES_SRC_PLUGINS_ROBOT_MEMORY_COMPUTABLES_COMPUTABLES_MANAGER_H_
25 #include "computable.h"
27 #include <aspect/clock.h>
28 #include <aspect/configurable.h>
29 #include <aspect/logging.h>
31 #include <boost/bind/bind.hpp>
33 #include <mongocxx/client.hpp>
41 #ifdef USE_TIMETRACKER
46 using namespace boost::placeholders;
54 bool check_and_compute(
const bsoncxx::document::view &query, std::string collection);
55 void remove_computable(
Computable *computable);
56 void cleanup_computed_docs();
71 const std::string & collection,
72 std::list<bsoncxx::document::value> (
73 T::*compute_func)(
const bsoncxx::document::view &,
const std::string &),
75 double caching_time = 0.0,
79 query_to_compute, collection, boost::bind(compute_func, obj, _1, _2), caching_time, priority);
81 std::list<Computable *>::iterator pos = computables.begin();
82 while (pos != computables.end() && priority < (*pos)->get_priority())
84 computables.insert(pos, comp);
92 std::string name =
"RobotMemory ComputablesManager";
96 std::list<Computable *> computables;
97 std::string matching_test_collection_;
99 std::map<std::tuple<std::string, std::string>,
long long> cached_querries_;
100 #ifdef USE_TIMETRACKER
102 unsigned int tt_loopcount_;
103 unsigned int ttc_cleanup_;
104 unsigned int ttc_cleanup_inner_loop_;
105 unsigned int ttc_cleanup_remove_query_;