knowrob
2.1.0
A Knowledge Base System for Cognition-enabled Robots
|
#include <QueryWatch.h>
Public Member Functions | |
QueryWatch () | |
QueryWatch (const QueryWatch &)=delete | |
~QueryWatch () | |
void | setWatchRate (uint32_t rate) |
long | watch (const std::shared_ptr< Collection > &collection, const bson_t *query, const ChangeStreamCallback &callback) |
void | unwatch (long watcher_id) |
QueryWatch () | |
QueryWatch (const QueryWatch &)=delete | |
~QueryWatch () | |
void | setWatchRate (uint32_t rate) |
long | watch (const std::shared_ptr< Collection > &collection, const bson_t *query, const ChangeStreamCallback &callback) |
void | unwatch (long watcher_id) |
Protected Member Functions | |
void | startWatchThread () |
void | stopWatchThread () |
void | loop () |
void | startWatchThread () |
void | stopWatchThread () |
void | loop () |
Protected Attributes | |
std::map< long, std::unique_ptr< ChangeStream > > | watcher_map_ |
std::thread * | thread_ |
bool | isRunning_ |
std::mutex | lock_ |
uint32_t | watchRate_ |
Static Protected Attributes | |
static std::atomic< long > | id_counter_ = 0 |
Keeps track over time of query results and notifies a callback for each new result.
Definition at line 26 of file QueryWatch.h.
QueryWatch::QueryWatch | ( | ) |
Definition at line 16 of file QueryWatch.cpp.
|
delete |
QueryWatch::~QueryWatch | ( | ) |
Definition at line 22 of file QueryWatch.cpp.
knowrob::mongo::QueryWatch::QueryWatch | ( | ) |
|
delete |
knowrob::mongo::QueryWatch::~QueryWatch | ( | ) |
|
protected |
Definition at line 73 of file QueryWatch.cpp.
|
protected |
|
inline |
The query watch actively polls change streams in this interval.
rate | the rate in milliseconds. |
Definition at line 38 of file QueryWatch.h.
|
inline |
The query watch actively polls change streams in this interval.
rate | the rate in milliseconds. |
Definition at line 38 of file QueryWatch.h.
|
protected |
Definition at line 29 of file QueryWatch.cpp.
|
protected |
|
protected |
Definition at line 37 of file QueryWatch.cpp.
|
protected |
void QueryWatch::unwatch | ( | long | watcher_id | ) |
Stop watching a collection.
watcher_id | the watcher id returned by watch. |
Definition at line 62 of file QueryWatch.cpp.
void knowrob::mongo::QueryWatch::unwatch | ( | long | watcher_id | ) |
Stop watching a collection.
watcher_id | the watcher id returned by watch. |
long QueryWatch::watch | ( | const std::shared_ptr< Collection > & | collection, |
const bson_t * | query, | ||
const ChangeStreamCallback & | callback | ||
) |
Watch for changes in a collection.
collection | the collection to watch. |
query | the query to watch. |
callback | the callback to invoke for each change. |
Definition at line 47 of file QueryWatch.cpp.
long knowrob::mongo::QueryWatch::watch | ( | const std::shared_ptr< Collection > & | collection, |
const bson_t * | query, | ||
const ChangeStreamCallback & | callback | ||
) |
Watch for changes in a collection.
collection | the collection to watch. |
query | the query to watch. |
callback | the callback to invoke for each change. |
|
staticprotected |
Definition at line 64 of file QueryWatch.h.
|
protected |
Definition at line 61 of file QueryWatch.h.
|
protected |
Definition at line 62 of file QueryWatch.h.
|
protected |
Definition at line 60 of file QueryWatch.h.
|
protected |
Definition at line 58 of file QueryWatch.h.
|
protected |
Definition at line 63 of file QueryWatch.h.