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.hpp>
36 #include <bsoncxx/builder/basic/document.hpp>
40 #ifdef USE_TIMETRACKER
67 std::string dbcollection,
68 void (T::*callback)(
const bsoncxx::document::view &),
80 mongocxx::client *con;
81 if (std::find(dbnames_distributed_.begin(),
82 dbnames_distributed_.end(),
84 != dbnames_distributed_.end()) {
89 auto db_coll_pair = split_db_collection_string(dbcollection);
90 auto collection = con->database(db_coll_pair.first)[db_coll_pair.second];
94 boost::bind(callback, obj, _1));
95 triggers.push_back(trigger);
101 static std::string
get_db_name(
const std::string &ns);
105 mongocxx::change_stream create_change_stream(mongocxx::collection & collection,
106 bsoncxx::document::view
query);
108 std::string name =
"RobotMemory EventTriggerManager";
115 mongocxx::client *con_local_;
116 mongocxx::client *con_replica_;
118 std::vector<std::string> dbnames_distributed_;
119 std::vector<std::string> dbnames_local_;
122 std::list<EventTrigger *> triggers;
124 #ifdef USE_TIMETRACKER
126 unsigned int tt_loopcount_;
127 unsigned int ttc_trigger_loop_;
128 unsigned int ttc_callback_loop_;
129 unsigned int ttc_callback_;
130 unsigned int ttc_reinit_;
134 #endif //FAWKES_SRC_PLUGINS_ROBOT_MEMORY_EVENT_TRIGGER_MANAGER_H_