6 #ifndef KNOWROB_MONGO_INTERFACE_H
7 #define KNOWROB_MONGO_INTERFACE_H
14 #define PL_SAFE_ARG_MACROS
21 #include <knowrob/storage/mongo/MongoException.h>
22 #include <knowrob/storage/mongo/Database.h>
23 #include <knowrob/storage/mongo/Collection.h>
24 #include <knowrob/storage/mongo/Cursor.h>
25 #include <knowrob/storage/mongo/QueryWatch.h>
29 class MongoInterface {
33 std::shared_ptr<Database>
connect(
const PlTerm &dbTerm);
35 std::shared_ptr<Collection>
connect(
const PlTerm &dbTerm,
const char* collectionName);
37 std::shared_ptr<Collection>
connect(
const char* db_uri,
const char* db_name,
const char* collectionName);
39 std::shared_ptr<Cursor>
cursor_create(
const PlTerm &db_term,
const char *coll_name);
43 std::shared_ptr<Cursor>
cursor(
const char *curser_id);
52 std::shared_ptr<Connection> getOrCreateConnection(
const char *uri_string_c);
55 std::map<std::string, std::shared_ptr<Connection>> connections_;
56 std::map<std::string, std::shared_ptr<Cursor>> cursors_;
57 std::map<long, std::shared_ptr<Connection>> watcher_;
59 std::mutex mongo_mutex_;
std::shared_ptr< Cursor > cursor(const char *curser_id)
std::shared_ptr< Cursor > cursor_create(const PlTerm &db_term, const char *coll_name)
std::shared_ptr< Collection > connect(const PlTerm &dbTerm, const char *collectionName)
std::shared_ptr< Database > connect(const PlTerm &dbTerm)
std::shared_ptr< Collection > connect(const char *db_uri, const char *db_name, const char *collectionName)
static MongoInterface & get()
void cursor_destroy(const char *curser_id)