MongoDB C++ Driver
current
Loading...
Searching...
No Matches
mongocxx
v_noabi
mongocxx
change_stream.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 <memory>
18
19
#include <
mongocxx/change_stream-fwd.hpp
>
20
#include <
mongocxx/client-fwd.hpp
>
21
#include <
mongocxx/collection-fwd.hpp
>
22
#include <
mongocxx/database-fwd.hpp
>
23
24
#include <
bsoncxx/document/view.hpp
>
25
#include <
bsoncxx/stdx/optional.hpp
>
26
27
#include <
mongocxx/config/prelude.hpp
>
28
29
namespace
mongocxx
{
30
namespace
v_noabi {
31
35
class
change_stream
{
36
public
:
38
class
iterator
;
39
43
MONGOCXX_ABI_EXPORT_CDECL
()
change_stream
(
change_stream
&& other) noexcept;
44
48
MONGOCXX_ABI_EXPORT_CDECL
(
change_stream
&) operator=(
change_stream
&& other) noexcept;
49
53
MONGOCXX_ABI_EXPORT_CDECL
() ~
change_stream
();
54
75
MONGOCXX_ABI_EXPORT_CDECL
(
iterator
)
begin
() const;
76
84
MONGOCXX_ABI_EXPORT_CDECL
(
iterator
)
end
() const;
85
110
MONGOCXX_ABI_EXPORT_CDECL
(
bsoncxx
::v_noabi::stdx::optional<
bsoncxx
::v_noabi::document::view>)
111
get_resume_token
() const;
112
113
private:
114
friend ::
mongocxx
::v_noabi::
client
;
115
friend ::
mongocxx
::v_noabi::
collection
;
116
friend ::
mongocxx
::v_noabi::
database
;
117
118
friend ::
mongocxx
::v_noabi::
change_stream
::
iterator
;
119
120
change_stream
(
void
* change_stream_ptr);
121
122
class impl;
123
std::unique_ptr<impl> _impl;
124
};
125
129
class
change_stream
::
iterator
{
130
public
:
131
// Support input-iterator (caveat of post-increment returning void)
132
using
difference_type = std::int64_t;
133
using
value_type =
bsoncxx::v_noabi::document::view
const
;
134
using
pointer = std::add_pointer<value_type>::type;
135
using
reference = std::add_lvalue_reference<value_type>::type;
136
using
iterator_category = std::input_iterator_tag;
137
143
MONGOCXX_ABI_EXPORT_CDECL
()
iterator
();
144
151
MONGOCXX_ABI_EXPORT_CDECL
(
bsoncxx
::v_noabi::document::view const&) operator*() const;
152
159
MONGOCXX_ABI_EXPORT_CDECL
(
bsoncxx
::v_noabi::document::view const*) operator->() const;
160
174
MONGOCXX_ABI_EXPORT_CDECL
(
iterator
&) operator++();
175
189
MONGOCXX_ABI_EXPORT_CDECL
(
void
) operator++(
int
);
190
200
friend
MONGOCXX_ABI_EXPORT_CDECL
(
bool
) operator==(
201
change_stream
::
iterator
const&,
202
change_stream
::
iterator
const&) noexcept;
203
204
friend
MONGOCXX_ABI_EXPORT_CDECL
(
bool
) operator!=(
205
change_stream
::
iterator
const&,
206
change_stream
::
iterator
const&) noexcept;
209
210
private:
211
friend ::
mongocxx
::v_noabi::
change_stream
;
212
213
enum class iter_type { k_tracking, k_default_constructed, k_end };
214
215
explicit
iterator
(iter_type type,
change_stream
const
*
change_stream
);
216
217
bool
is_exhausted()
const
;
218
219
// iter_type==k_default_constructed is equivalent to _change_stream==nullptr
220
iter_type _type;
221
change_stream
const
* _change_stream;
222
};
223
224
}
// namespace v_noabi
225
}
// namespace mongocxx
226
227
#include <
mongocxx/config/postlude.hpp
>
228
change_stream-fwd.hpp
Declares mongocxx::v_noabi::change_stream.
bsoncxx::v_noabi::document::view
A read-only, non-owning view of a BSON document.
Definition
view.hpp:35
mongocxx::v_noabi::change_stream::iterator
A MongoDB change stream iterator.
Definition
change_stream.hpp:129
mongocxx::v_noabi::change_stream
A MongoDB change stream.
Definition
change_stream.hpp:35
mongocxx::v_noabi::change_stream::get_resume_token
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view > get_resume_token() const
Returns a resume token for this change stream.
mongocxx::v_noabi::change_stream::end
iterator end() const
A change_stream::iterator indicating stream exhaustion, meaning that no notifications are available f...
mongocxx::v_noabi::change_stream::begin
iterator begin() const
A change_stream::iterator points to the beginning of any available notifications. Each call to begin(...
mongocxx::v_noabi::client
A client connection to a MongoDB server.
Definition
client.hpp:61
mongocxx::v_noabi::collection
A MongoDB collection.
Definition
collection.hpp:87
mongocxx::v_noabi::database
A MongoDB database.
Definition
database.hpp:46
client-fwd.hpp
Declares mongocxx::v_noabi::client.
collection-fwd.hpp
Declares mongocxx::v_noabi::collection.
database-fwd.hpp
Declares mongocxx::v_noabi::database.
view.hpp
Provides bsoncxx::v_noabi::document::view.
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 v_noabi macro guard postlude header.
prelude.hpp
The mongocxx v_noabi macro guard prelude header.
bsoncxx
The top-level namespace within which all bsoncxx library entities are declared.
mongocxx
The top-level namespace within which all mongocxx library entities are declared.
optional.hpp
Provides std::optional-related polyfills for library API usage.
Generated by
1.9.8