MongoDB C++ Driver 4.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 <functional>
18
20
33
35
36namespace mongocxx {
37namespace v_noabi {
38namespace options {
39
47class apm {
48 public:
64 on_command_started(std::function<void MONGOCXX_ABI_CDECL(events::command_started_event const&)> command_started);
65
71 MONGOCXX_ABI_EXPORT_CDECL(std::function<void MONGOCXX_ABI_CDECL(events::command_started_event const&)> const&)
73
89 on_command_failed(std::function<void MONGOCXX_ABI_CDECL(events::command_failed_event const&)> command_failed);
90
96 MONGOCXX_ABI_EXPORT_CDECL(std::function<void MONGOCXX_ABI_CDECL(events::command_failed_event const&)> const&)
98
115 std::function<void MONGOCXX_ABI_CDECL(events::command_succeeded_event const&)> command_succeeded);
116
122 MONGOCXX_ABI_EXPORT_CDECL(std::function<void MONGOCXX_ABI_CDECL(events::command_succeeded_event const&)> const&)
124
140 on_server_opening(std::function<void MONGOCXX_ABI_CDECL(events::server_opening_event const&)> server_opening);
141
147 MONGOCXX_ABI_EXPORT_CDECL(std::function<void MONGOCXX_ABI_CDECL(events::server_opening_event const&)> const&)
149
165 on_server_closed(std::function<void MONGOCXX_ABI_CDECL(events::server_closed_event const&)> server_closed);
166
172 MONGOCXX_ABI_EXPORT_CDECL(std::function<void MONGOCXX_ABI_CDECL(events::server_closed_event const&)> const&)
174
191 on_server_changed(std::function<void MONGOCXX_ABI_CDECL(events::server_changed_event const&)> server_changed);
192
198 MONGOCXX_ABI_EXPORT_CDECL(std::function<void MONGOCXX_ABI_CDECL(events::server_changed_event const&)> const&)
200
216 on_topology_opening(std::function<void MONGOCXX_ABI_CDECL(events::topology_opening_event const&)> topology_opening);
217
223 MONGOCXX_ABI_EXPORT_CDECL(std::function<void MONGOCXX_ABI_CDECL(events::topology_opening_event const&)> const&)
225
241 on_topology_closed(std::function<void MONGOCXX_ABI_CDECL(events::topology_closed_event const&)> topology_closed);
242
248 MONGOCXX_ABI_EXPORT_CDECL(std::function<void MONGOCXX_ABI_CDECL(events::topology_closed_event const&)> const&)
250
267 on_topology_changed(std::function<void MONGOCXX_ABI_CDECL(events::topology_changed_event const&)> topology_changed);
268
274 MONGOCXX_ABI_EXPORT_CDECL(std::function<void MONGOCXX_ABI_CDECL(events::topology_changed_event const&)> const&)
276
293 std::function<void MONGOCXX_ABI_CDECL(events::heartbeat_started_event const&)> heartbeat_started);
294
300 MONGOCXX_ABI_EXPORT_CDECL(std::function<void MONGOCXX_ABI_CDECL(events::heartbeat_started_event const&)> const&)
302
318 on_heartbeat_failed(std::function<void MONGOCXX_ABI_CDECL(events::heartbeat_failed_event const&)> heartbeat_failed);
319
325 MONGOCXX_ABI_EXPORT_CDECL(std::function<void MONGOCXX_ABI_CDECL(events::heartbeat_failed_event const&)> const&)
327
345 std::function<void MONGOCXX_ABI_CDECL(events::heartbeat_succeeded_event const&)> heartbeat_succeeded);
346
352 MONGOCXX_ABI_EXPORT_CDECL(std::function<void MONGOCXX_ABI_CDECL(events::heartbeat_succeeded_event const&)> const&)
354
355 private:
356 std::function<void MONGOCXX_ABI_CDECL(events::command_started_event const&)> _command_started;
357 std::function<void MONGOCXX_ABI_CDECL(events::command_failed_event const&)> _command_failed;
358 std::function<void MONGOCXX_ABI_CDECL(events::command_succeeded_event const&)> _command_succeeded;
359 std::function<void MONGOCXX_ABI_CDECL(events::server_closed_event const&)> _server_closed;
360 std::function<void MONGOCXX_ABI_CDECL(events::server_changed_event const&)> _server_changed;
361 std::function<void MONGOCXX_ABI_CDECL(events::server_opening_event const&)> _server_opening;
362 std::function<void MONGOCXX_ABI_CDECL(events::topology_closed_event const&)> _topology_closed;
363 std::function<void MONGOCXX_ABI_CDECL(events::topology_changed_event const&)> _topology_changed;
364 std::function<void MONGOCXX_ABI_CDECL(events::topology_opening_event const&)> _topology_opening;
365 std::function<void MONGOCXX_ABI_CDECL(events::heartbeat_started_event const&)> _heartbeat_started;
366 std::function<void MONGOCXX_ABI_CDECL(events::heartbeat_failed_event const&)> _heartbeat_failed;
367 std::function<void MONGOCXX_ABI_CDECL(events::heartbeat_succeeded_event const&)> _heartbeat_succeeded;
368};
369
370} // namespace options
371} // namespace v_noabi
372} // namespace mongocxx
373
374#include <mongocxx/config/postlude.hpp>
375
Declares mongocxx::v_noabi::options::apm.
Used by mongocxx::v_noabi::options::client::apm_opts.
Definition apm.hpp:47
std::function< void(events::heartbeat_started_event const &)> const & heartbeat_started() const
Retrieves the heartbeat started monitoring callback.
apm & on_server_opening(std::function< void(events::server_opening_event const &)> server_opening)
Set the server opening monitoring callback. The callback takes a reference to a server_opening_event ...
apm & on_heartbeat_started(std::function< void(events::heartbeat_started_event const &)> heartbeat_started)
Set the heartbeat started monitoring callback. The callback takes a reference to a heartbeat_started_...
std::function< void(events::topology_opening_event const &)> const & topology_opening() const
Retrieves the topology_opening monitoring callback.
std::function< void(events::command_succeeded_event const &)> const & command_succeeded() const
Retrieves the command succeeded monitoring callback.
apm & on_heartbeat_failed(std::function< void(events::heartbeat_failed_event const &)> heartbeat_failed)
Set the heartbeat failed monitoring callback. The callback takes a reference to a heartbeat_failed_ev...
apm & on_server_changed(std::function< void(events::server_changed_event const &)> server_changed)
Set the server description changed monitoring callback. The callback takes a reference to a server_ch...
apm & on_heartbeat_succeeded(std::function< void(events::heartbeat_succeeded_event const &)> heartbeat_succeeded)
Set the heartbeat succeeded monitoring callback. The callback takes a reference to a heartbeat_succee...
std::function< void(events::server_closed_event const &)> const & server_closed() const
Retrieves the server closed monitoring callback.
std::function< void(events::command_failed_event const &)> const & command_failed() const
Retrieves the command failed monitoring callback.
std::function< void(events::server_opening_event const &)> const & server_opening() const
Retrieves the server opening monitoring callback.
std::function< void(events::heartbeat_succeeded_event const &)> const & heartbeat_succeeded() const
Retrieves the heartbeat succeeded monitoring callback.
std::function< void(events::heartbeat_failed_event const &)> const & heartbeat_failed() const
Retrieves the heartbeat failed monitoring callback.
std::function< void(events::command_started_event const &)> const & command_started() const
Retrieves the command started monitoring callback.
apm & on_server_closed(std::function< void(events::server_closed_event const &)> server_closed)
Set the server closed monitoring callback. The callback takes a reference to a server_closed_event wh...
apm & on_topology_opening(std::function< void(events::topology_opening_event const &)> topology_opening)
Set the topology_opening monitoring callback. The callback takes a reference to a topology_opening_ev...
std::function< void(events::topology_changed_event const &)> const & topology_changed() const
Retrieves the topology description changed monitoring callback.
std::function< void(events::topology_closed_event const &)> const & topology_closed() const
Retrieves the topology closed monitoring callback.
apm & on_command_succeeded(std::function< void(events::command_succeeded_event const &)> command_succeeded)
Set the command succeeded monitoring callback. The callback takes a reference to a command_succeeded_...
apm & on_topology_closed(std::function< void(events::topology_closed_event const &)> topology_closed)
Set the topology closed monitoring callback. The callback takes a reference to a topology_closed_even...
std::function< void(events::server_changed_event const &)> const & server_changed() const
Retrieves the server description changed monitoring callback.
apm & on_command_failed(std::function< void(events::command_failed_event const &)> command_failed)
Set the command failed monitoring callback. The callback takes a reference to a command_failed_event ...
apm & on_command_started(std::function< void(events::command_started_event const &)> command_started)
Set the command started monitoring callback. The callback takes a reference to a command_started_even...
apm & on_topology_changed(std::function< void(events::topology_changed_event const &)> topology_changed)
Set the topology description changed monitoring callback. The callback takes a reference to a topolog...
Provides mongocxx::v_noabi::events::command_failed_event.
Provides mongocxx::v_noabi::events::command_started_event.
Provides mongocxx::v_noabi::events::command_succeeded_event.
Provides mongocxx::v_noabi::events::heartbeat_failed_event.
Provides mongocxx::v_noabi::events::heartbeat_started_event.
Provides mongocxx::v_noabi::events::heartbeat_succeeded_event.
#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 v_noabi macro guard prelude header.
Declares entities describing APM events.
Declares entities representing options to use with various commands.
Declares entities whose ABI stability is NOT guaranteed.
The top-level namespace within which all mongocxx library entities are declared.
Provides mongocxx::v_noabi::events::server_changed_event.
Provides mongocxx::v_noabi::events::server_closed_event.
Provides mongocxx::v_noabi::events::server_opening_event.
Provides mongocxx::v_noabi::events::topology_changed_event.
Provides mongocxx::v_noabi::events::topology_closed_event.
Provides mongocxx::v_noabi::events::topology_opening_event.