MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
server_changed_event.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/events/server_changed_event-fwd.hpp> // IWYU pragma: export
18
19//
20
21#include <mongocxx/v1/events/server_description_changed.hpp> // IWYU pragma: export
22
23#include <cstdint>
24
25#include <bsoncxx/oid.hpp>
27
29
31
32namespace mongocxx {
33namespace v_noabi {
34namespace events {
35
43 private:
45
46 public:
50 explicit MONGOCXX_ABI_NO_EXPORT server_changed_event(void const* event);
51
55 /* explicit(false) */ server_changed_event(v1::events::server_description_changed const& event) : _event{event} {}
56
60 explicit operator v1::events::server_description_changed() const {
61 return _event;
62 }
63
70 return _event.host();
71 }
72
78 std::uint16_t port() const {
79 return _event.port();
80 }
81
89 return _event.topology_id();
90 }
91
98
105};
106
107} // namespace events
108} // namespace v_noabi
109} // namespace mongocxx
110
111namespace mongocxx {
112namespace v_noabi {
113
120
127
128} // namespace v_noabi
129} // namespace mongocxx
130
132
A polyfill for std::string_view.
Definition string_view.hpp:412
Represents a MongoDB BSON ObjectId.
Definition oid.hpp:41
ServerDescriptionChangedEvent from the SDAM Logging and Monitoring specification.
Definition server_description_changed.hpp:45
A change in the description of a connected MongoDB server.
Definition server_changed_event.hpp:42
bsoncxx::v_noabi::oid const topology_id() const
An opaque id, unique to this topology for this mongocxx::v_noabi::client or mongocxx::v_noabi::pool.
Definition server_changed_event.hpp:88
bsoncxx::v_noabi::stdx::string_view host() const
Returns the server host name.
Definition server_changed_event.hpp:69
server_description const previous_description() const
The server's description before it changed.
server_description const new_description() const
The server's description after it changed.
std::uint16_t port() const
Returns the server port.
Definition server_changed_event.hpp:78
server_changed_event(v1::events::server_description_changed const &event)
Construct with the mongocxx::v1 equivalent.
Definition server_changed_event.hpp:55
The description of a connected MongoDB server.
Definition server_description.hpp:41
#define MONGOCXX_ABI_NO_EXPORT
Excludes the associated entity from being part of the ABI.
Definition export.hpp:20
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v_noabi macro guard postlude header.
The mongocxx v_noabi macro guard prelude header.
Declares entities describing APM events.
Declares entities whose ABI stability is NOT guaranteed.
v1::bulk_write to_v1(v_noabi::bulk_write v)
Convert to the mongocxx::v1 equivalent of v.
Definition bulk_write.hpp:162
v_noabi::bulk_write from_v1(v1::bulk_write v)
Convert to the mongocxx::v_noabi equivalent of v.
Definition bulk_write.hpp:155
The top-level namespace within which all mongocxx library entities are declared.
Declares mongocxx::v_noabi::events::server_changed_event.
Provides mongocxx::v1::events::server_description_changed.
Provides bsoncxx::v_noabi::oid.
Provides std::string_view-related polyfills for library API usage.
Provides mongocxx::v_noabi::events::server_description.