knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
knowrob::mongo::Connection Struct Reference

#include <Connection.h>

Public Member Functions

 Connection (std::string_view uri_string)
 
 ~Connection ()
 
 Connection (std::string_view uri_string)
 
 ~Connection ()
 

Public Attributes

mongoc_uri_t * uri_
 
std::string uri_string_
 
mongoc_client_pool_t * pool_
 

Detailed Description

A connection to a Mongo DB.

Definition at line 16 of file Connection.h.

Constructor & Destructor Documentation

◆ Connection() [1/2]

Connection::Connection ( std::string_view  uri_string)
explicit

Definition at line 12 of file Connection.cpp.

13  : uri_string_(uri_string) {
14  bson_error_t err;
15  uri_ = mongoc_uri_new_with_error(uri_string_.c_str(), &err);
16  if (!uri_) {
17  throw MongoException("invalid_uri", err);
18  }
19  pool_ = mongoc_client_pool_new(uri_);
20  // connectionWatch_ = std::make_shared<QueryWatch>(pool_);
21  mongoc_client_pool_set_error_api(pool_, 2);
22 }
mongoc_client_pool_t * pool_
Definition: Connection.h:32

◆ ~Connection() [1/2]

Connection::~Connection ( )

Definition at line 24 of file Connection.cpp.

24  {
25  mongoc_client_pool_destroy(pool_);
26  mongoc_uri_destroy(uri_);
27  mongoc_cleanup();
28 }

◆ Connection() [2/2]

knowrob::mongo::Connection::Connection ( std::string_view  uri_string)
explicit

◆ ~Connection() [2/2]

knowrob::mongo::Connection::~Connection ( )

Member Data Documentation

◆ pool_

mongoc_client_pool_t * knowrob::mongo::Connection::pool_

The connection pool.

Definition at line 32 of file Connection.h.

◆ uri_

mongoc_uri_t * knowrob::mongo::Connection::uri_

The URI of the connection.

Definition at line 24 of file Connection.h.

◆ uri_string_

std::string knowrob::mongo::Connection::uri_string_

The URI string.

Definition at line 28 of file Connection.h.


The documentation for this struct was generated from the following files: