Loading...
Searching...
No Matches
instance.hpp
Go to the documentation of this file.
// Copyright 2009-present MongoDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <mongocxx/v1/instance-fwd.hpp> // IWYU pragma: export
//
#include <mongocxx/v1/detail/prelude.hpp>
#include <mongocxx/v1/logger-fwd.hpp>
#include <mongocxx/v1/config/export.hpp>
#include <memory>
#include <system_error>
#include <type_traits>
namespace mongocxx {
namespace v1 {
class instance {
private:
class impl;
std::unique_ptr<impl> _impl;
public:
MONGOCXX_ABI_EXPORT_CDECL() ~instance();
instance(instance&&) = delete;
instance& operator=(instance&&) = delete;
instance(instance const&) = delete;
instance& operator=(instance const&) = delete;
MONGOCXX_ABI_EXPORT_CDECL() instance();
explicit MONGOCXX_ABI_EXPORT_CDECL() instance(std::unique_ptr<v1::logger> handler);
explicit MONGOCXX_ABI_EXPORT_CDECL() instance(v1::default_logger tag);
enum class errc {
zero,
multiple_instances,
};
static MONGOCXX_ABI_EXPORT_CDECL(std::error_category const&) error_category();
friend std::error_code make_error_code(errc v) {
return {static_cast<int>(v), error_category()};
}
};
} // namespace v1
} // namespace mongocxx
template <>
struct std::is_error_code_enum<mongocxx::v1::instance::errc> : true_type {};
#include <mongocxx/v1/detail/postlude.hpp>
mongocxx::v1::default_logger
A tag type representing mongoc's default unstructured log handler.
Definition logger.hpp:111
mongocxx::v1::instance::error_category
static std::error_category const & error_category()
The error category for mongocxx::v1::instance::errc.
mongocxx::v1::instance::operator=
instance & operator=(instance &&)=delete
This class is not moveable.
mongocxx::v1::instance::~instance
~instance()
Cleanup the mongocxx (and mongoc) library.
mongocxx::v1::instance::make_error_code
friend std::error_code make_error_code(errc v)
Support implicit conversion to std::error_code.
Definition instance.hpp:159
mongocxx::v1::instance::instance
instance(instance const &)=delete
This class is not copyable.
mongocxx::v1::instance::instance
instance(instance &&)=delete
This class is not moveable.
mongocxx::v1::instance::errc
errc
Errors codes which may be returned by mongocxx::v1::instance.
Definition instance.hpp:146
mongocxx::v1::instance::errc::multiple_instances
@ multiple_instances
Cannot construct multiple instance objects in a given process.
Definition instance.hpp:148
mongocxx::v1::instance::errc::zero
@ zero
Zero.
Definition instance.hpp:147
mongocxx::v1::instance::operator=
instance & operator=(instance const &)=delete
This class is not copyable.
mongocxx::v1::logger
The interface for an unstructured log message handler.
Definition logger.hpp:55
export.hpp
Provides macros to control the set of symbols exported in the ABI.
MONGOCXX_ABI_EXPORT_CDECL
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
postlude.hpp
The mongocxx v1 macro guard postlude header.
prelude.hpp
The mongocxx v1 macro guard prelude header.
mongocxx::v1
Declares entities whose ABI stability is guaranteed for documented symbols.
mongocxx
The top-level namespace within which all mongocxx library entities are declared.
instance-fwd.hpp
Declares mongocxx::v1::instance.
logger-fwd.hpp
Declares mongocxx::v1::logger.