22 #ifndef FAWKES_SRC_PLUGINS_ROBOT_MEMORY_EVENT_TRIGGER_MANAGER_H_
23 #define FAWKES_SRC_PLUGINS_ROBOT_MEMORY_EVENT_TRIGGER_MANAGER_H_
25 #include "event_trigger.h"
27 #include <aspect/configurable.h>
28 #include <aspect/logging.h>
29 #include <core/exception.h>
30 #include <core/threading/mutex_locker.h>
31 #include <plugin/loader.h>
32 #include <plugins/mongodb/aspect/mongodb_conncreator.h>
33 #include <plugins/mongodb/utils.h>
35 #include <boost/bind/bind.hpp>
36 #include <bsoncxx/builder/basic/document.hpp>
40 #ifdef USE_TIMETRACKER
45 using namespace boost::placeholders;
69 std::string dbcollection,
70 void (T::*callback)(
const bsoncxx::document::view &),
82 mongocxx::client *con;
83 if (std::find(dbnames_distributed_.begin(),
84 dbnames_distributed_.end(),
85 get_db_name(dbcollection))
86 != dbnames_distributed_.end()) {
91 auto db_coll_pair = split_db_collection_string(dbcollection);
92 auto collection = con->database(db_coll_pair.first)[db_coll_pair.second];
96 boost::bind(callback, obj, _1));
97 triggers.push_back(trigger);
103 static std::string get_db_name(
const std::string &ns);
107 mongocxx::change_stream create_change_stream(mongocxx::collection & collection,
108 bsoncxx::document::view
query);
110 std::string name =
"RobotMemory EventTriggerManager";
117 mongocxx::client *con_local_;
118 mongocxx::client *con_replica_;
120 std::vector<std::string> dbnames_distributed_;
121 std::vector<std::string> dbnames_local_;
124 std::list<EventTrigger *> triggers;
126 #ifdef USE_TIMETRACKER
128 unsigned int tt_loopcount_;
129 unsigned int ttc_trigger_loop_;
130 unsigned int ttc_callback_loop_;
131 unsigned int ttc_callback_;
132 unsigned int ttc_reinit_;
136 #endif //FAWKES_SRC_PLUGINS_ROBOT_MEMORY_EVENT_TRIGGER_MANAGER_H_