#include <mongocxx/v1/instance.hpp>
An instance of the MongoDB C++ Driver.
All mongocxx API MUST be used within the lifetime of the instance object, with special exemptions listed below. Only ONE instance object may exist for the lifetime of a given process. It is undefined behavior to use the mongocxx API before the instance object is initialized or after the instance object is destroyed. It is undefined behavior to create more than one instance object.
Public Types | |
| enum class | errc |
| Errors codes which may be returned by mongocxx::v1::instance. More... | |
Public Member Functions | |
| instance () | |
| Initialize the mongoc library with unstructured log messages disabled. | |
| instance (instance &&)=delete | |
| This class is not moveable. | |
| instance (instance const &)=delete | |
| This class is not copyable. | |
| instance (std::unique_ptr< v1::logger > handler) | |
| Initialize the mongoc library with the custom unstructured log message handler. | |
| instance (v1::default_logger tag) | |
| Initialize the mongoc library with its default unstructured log handler. | |
| ~instance () | |
| Cleanup the mongocxx (and mongoc) library. | |
| instance & | operator= (instance &&)=delete |
| This class is not moveable. | |
| instance & | operator= (instance const &)=delete |
| This class is not copyable. | |
Static Public Member Functions | |
| static std::error_category const & | error_category () |
| The error category for mongocxx::v1::instance::errc. | |
Friends | |
| std::error_code | make_error_code (errc v) |
| Support implicit conversion to std::error_code. | |
|
strong |
Errors codes which may be returned by mongocxx::v1::instance.
| Enumerator | |
|---|---|
| zero | Zero. |
| multiple_instances | Cannot construct multiple instance objects in a given process. |
| mongocxx::v1::instance::~instance | ( | ) |
Cleanup the mongocxx (and mongoc) library.
Calls mongoc_cleanup().
|
delete |
This class is not moveable.
|
delete |
This class is not copyable.
| mongocxx::v1::instance::instance | ( | ) |
Initialize the mongoc library with unstructured log messages disabled.
Calls mongoc_init() after disabling unstructured log messages by calling mongoc_log_set_handler(nullptr, nullptr).
| mongocxx::v1::exception | with mongocxx::v1::instance::errc::multiple_instances if an instance object has already been created. |
|
explicit |
Initialize the mongoc library with the custom unstructured log message handler.
Calls mongoc_init after registering the custom unstructured log handler by calling mongoc_log_set_handler().
| handler | Disable unstructured logging when null. |
| mongocxx::v1::exception | with mongocxx::v1::instance::errc::multiple_instances if an instance object has already been created. |
|
explicit |
Initialize the mongoc library with its default unstructured log handler.
Calls mongoc_init without registering any custom unstructured log handler.
| tag | Unused: only for overload resolution. |
| mongocxx::v1::exception | with mongocxx::v1::instance::errc::multiple_instances if an instance object has already been created. |
|
static |
The error category for mongocxx::v1::instance::errc.
This class is not copyable.
|
friend |
Support implicit conversion to std::error_code.