MongoDB C++ Driver 4.4.0
Loading...
Searching...
No Matches
instance.hpp
Go to the documentation of this file.
1// Copyright 2009-present MongoDB, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <mongocxx/v1/instance-fwd.hpp> // IWYU pragma: export
18
19//
20
22
24
26
27#include <memory>
28#include <system_error>
29#include <type_traits>
30
31namespace mongocxx {
32namespace v1 {
33
64class instance {
65 private:
66 class impl;
67 std::unique_ptr<impl> _impl;
68
69 public:
76
80 instance(instance&&) = delete;
81
86
90 instance(instance const&) = delete;
91
95 instance& operator=(instance const&) = delete;
96
113
128 explicit MONGOCXX_ABI_EXPORT_CDECL() instance(std::unique_ptr<v1::logger> handler);
129
142
146 enum class errc {
149 };
150
154 static MONGOCXX_ABI_EXPORT_CDECL(std::error_category const&) error_category();
155
159 friend std::error_code make_error_code(errc v) {
160 return {static_cast<int>(v), error_category()};
161 }
162};
163
164} // namespace v1
165} // namespace mongocxx
166
167template <>
168struct std::is_error_code_enum<mongocxx::v1::instance::errc> : true_type {};
169
171
A tag type representing mongoc's default unstructured log handler.
Definition logger.hpp:111
static std::error_category const & error_category()
The error category for mongocxx::v1::instance::errc.
instance & operator=(instance &&)=delete
This class is not moveable.
~instance()
Cleanup the mongocxx (and mongoc) library.
friend std::error_code make_error_code(errc v)
Support implicit conversion to std::error_code.
Definition instance.hpp:159
instance(instance const &)=delete
This class is not copyable.
instance(instance &&)=delete
This class is not moveable.
errc
Errors codes which may be returned by mongocxx::v1::instance.
Definition instance.hpp:146
@ multiple_instances
Cannot construct multiple instance objects in a given process.
Definition instance.hpp:148
@ zero
Zero.
Definition instance.hpp:147
instance & operator=(instance const &)=delete
This class is not copyable.
The interface for an unstructured log message handler.
Definition logger.hpp:55
Provides macros to control the set of symbols exported in the ABI.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v1 macro guard postlude header.
The mongocxx v1 macro guard prelude header.
Declares entities whose ABI stability is guaranteed for documented symbols.
The top-level namespace within which all mongocxx library entities are declared.
Declares mongocxx::v1::instance.
Declares mongocxx::v1::logger.