MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
apm.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/apm-fwd.hpp> // IWYU pragma: export
18
19//
20
22
35
37
38#include <functional>
39
40namespace mongocxx {
41namespace v1 {
42
51class apm {
52 private:
53 class impl;
54 void* _impl;
55
56 public:
61
68 MONGOCXX_ABI_EXPORT_CDECL() apm(apm&& other) noexcept;
69
76 MONGOCXX_ABI_EXPORT_CDECL(apm&) operator=(apm&& other) noexcept;
77
82
86 MONGOCXX_ABI_EXPORT_CDECL(apm&) operator=(apm const& other);
87
95
105 std::function<void MONGOCXX_ABI_CDECL(v1::events::command_started const&)> fn);
106
112
122 std::function<void MONGOCXX_ABI_CDECL(v1::events::command_failed const&)> fn);
123
129
139 std::function<void MONGOCXX_ABI_CDECL(v1::events::command_succeeded const&)> fn);
140
146
156 std::function<void MONGOCXX_ABI_CDECL(v1::events::server_opening const&)> fn);
157
163
173 std::function<void MONGOCXX_ABI_CDECL(v1::events::server_closed const&)> fn);
174
180
190 std::function<void MONGOCXX_ABI_CDECL(v1::events::server_description_changed const&)> fn);
191
197
207 std::function<void MONGOCXX_ABI_CDECL(v1::events::topology_opening const&)> fn);
208
214
224 std::function<void MONGOCXX_ABI_CDECL(v1::events::topology_closed const&)> fn);
225
231
241 std::function<void MONGOCXX_ABI_CDECL(v1::events::topology_description_changed const&)> fn);
242
248
258 std::function<void MONGOCXX_ABI_CDECL(v1::events::server_heartbeat_started const&)> fn);
259
265
275 std::function<void MONGOCXX_ABI_CDECL(v1::events::server_heartbeat_failed const&)> fn);
276
282
292 std::function<void MONGOCXX_ABI_CDECL(v1::events::server_heartbeat_succeeded const&)> fn);
293
299
300 class internal;
301};
302
303} // namespace v1
304} // namespace mongocxx
305
306#include <mongocxx/v1/detail/postlude.hpp>
307
std::function< void(v1::events::topology_opening const &)> topology_opening() const
Return the current the "TopologyOpeningEvent" handler.
apm(apm &&other) noexcept
Move constructor.
std::function< void(v1::events::server_opening const &)> server_opening() const
Return the current the "ServerOpeningEvent" handler.
apm & on_server_description_changed(std::function< void(v1::events::server_description_changed const &)> fn)
Set the "ServerDescriptionChangedEvent" handler.
apm & on_server_opening(std::function< void(v1::events::server_opening const &)> fn)
Set the "ServerOpeningEvent" handler.
apm & on_server_closed(std::function< void(v1::events::server_closed const &)> fn)
Set the "ServerClosedEvent" handler.
apm & on_topology_opening(std::function< void(v1::events::topology_opening const &)> fn)
Set the "TopologyOpeningEvent" handler.
std::function< void(v1::events::server_heartbeat_failed const &)> server_heartbeat_failed() const
Return the current the "ServerHeartbeatFailedEvent" handler.
std::function< void(v1::events::server_heartbeat_started const &)> server_heartbeat_started() const
Return the current the "ServerHeartbeatStartedEvent" handler.
std::function< void(v1::events::server_description_changed const &)> server_description_changed() const
Return the current the "ServerDescriptionChangedEvent" handler.
std::function< void(v1::events::topology_description_changed const &)> topology_description_changed() const
Return the current the "TopologyDescriptionChangedEvent" handler.
std::function< void(v1::events::command_started const &)> command_started() const
Return the current "CommandStartedEvent" handler.
apm & on_command_started(std::function< void(v1::events::command_started const &)> fn)
Set the "CommandStartedEvent" handler.
apm & on_topology_closed(std::function< void(v1::events::topology_closed const &)> fn)
Set the "TopologyClosedEvent" handler.
apm & on_topology_description_changed(std::function< void(v1::events::topology_description_changed const &)> fn)
Set the "TopologyDescriptionChangedEvent" handler.
std::function< void(v1::events::topology_closed const &)> topology_closed() const
Return the current the "TopologyClosedEvent" handler.
apm & on_server_heartbeat_failed(std::function< void(v1::events::server_heartbeat_failed const &)> fn)
Set the "ServerHeartbeatFailedEvent" handler.
std::function< void(v1::events::server_closed const &)> server_closed() const
Return the current the "ServerClosedEvent" handler.
~apm()
Destroy this object.
apm & on_server_heartbeat_succeeded(std::function< void(v1::events::server_heartbeat_succeeded const &)> fn)
Set the "ServerHeartbeatSucceededEvent" handler.
std::function< void(v1::events::command_succeeded const &)> command_succeeded() const
Return the current the "CommandSucceededEvent" handler.
apm & on_server_heartbeat_started(std::function< void(v1::events::server_heartbeat_started const &)> fn)
Set the "ServerHeartbeatStartedEvent" handler.
apm & on_command_succeeded(std::function< void(v1::events::command_succeeded const &)> fn)
Set the "CommandSucceededEvent" handler.
std::function< void(v1::events::server_heartbeat_succeeded const &)> server_heartbeat_succeeded() const
Return the current the "ServerHeartbeatSucceededEvent" handler.
std::function< void(v1::events::command_failed const &)> command_failed() const
Return the current the "CommandFailedEvent" handler.
apm & on_command_failed(std::function< void(v1::events::command_failed const &)> fn)
Set the "CommandFailedEvent" handler.
Declares mongocxx::v1::events::command_failed.
Declares mongocxx::v1::events::command_started.
Declares mongocxx::v1::events::command_succeeded.
Provides macros to control the set of symbols exported in the ABI.
#define MONGOCXX_ABI_CDECL
Expands to __cdecl when built with MSVC on Windows.
Definition export.hpp:49
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v1 macro guard prelude header.
Declares entities describing APM events.
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::events::server_closed.
Declares mongocxx::v1::events::server_description_changed.
Declares mongocxx::v1::events::server_heartbeat_failed.
Declares mongocxx::v1::events::server_heartbeat_started.
Declares mongocxx::v1::events::server_heartbeat_succeeded.
Declares mongocxx::v1::events::server_opening.
Declares mongocxx::v1::events::topology_closed.
Declares mongocxx::v1::events::topology_description_changed.
Declares mongocxx::v1::events::topology_opening.
Declares mongocxx::v1::apm.