knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
Database.h
Go to the documentation of this file.
1 /*
2  * This file is part of KnowRob, please consult
3  * https://github.com/knowrob/knowrob for license details.
4  */
5 
6 #ifndef KNOWROB_MONGO_DATABASE_H
7 #define KNOWROB_MONGO_DATABASE_H
8 
9 #include <memory>
10 #include <vector>
11 #include <string>
12 #include <mongoc.h>
13 #include "Index.h"
14 
15 namespace knowrob::mongo {
19  class Database {
20  public:
21  Database(mongoc_client_pool_t *pool, std::string_view db_name);
23 
24  mongoc_database_t* db() { return db_; }
25 
26  bool create_index(const char *coll_name, const std::vector<IndexKey> &indexes);
27 
28  private:
29  mongoc_client_pool_t *pool_;
30  mongoc_client_t *client_;
31  mongoc_database_t *db_;
32  };
33 }
34 
35 #endif //KNOWROB_MONGO_DATABASE_H
Database(mongoc_client_pool_t *pool, std::string_view db_name)
mongoc_database_t * db()
Definition: Database.h:24
bool create_index(const char *coll_name, const std::vector< IndexKey > &indexes)