userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
connection_ptr.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/storages/sqlite/infra/connection_ptr.hpp
4
/// @brief @copybrief storages::sqlite::infra::ConnectionPtr
5
6
#
include
<
memory
>
7
8
#
include
<
userver
/
storages
/
sqlite
/
sqlite_fwd
.
hpp
>
9
10
USERVER_NAMESPACE_BEGIN
11
12
namespace
storages::sqlite::infra {
13
14
/// @brief Owns a SQLite connection and keeps its parent pool alive
15
class
ConnectionPtr
{
16
public
:
17
ConnectionPtr(std::shared_ptr<Pool>&& pool, std::unique_ptr<impl::Connection>&& connection);
18
~ConnectionPtr();
19
20
ConnectionPtr(
ConnectionPtr
&&)
noexcept
;
21
ConnectionPtr
& operator=(
ConnectionPtr
&&)
noexcept
;
22
23
bool
IsValid()
const
noexcept
;
24
impl::Connection* get()
const
noexcept
;
25
26
impl::Connection& operator*()
const
;
27
impl::Connection* operator->()
const
noexcept
;
28
29
private
:
30
void
Reset(std::unique_ptr<impl::Connection> conn, std::shared_ptr<Pool> pool);
31
void
Release();
32
33
std::shared_ptr<Pool> pool_;
34
std::unique_ptr<impl::Connection> conn_;
35
};
36
37
}
// namespace storages::sqlite::infra
38
39
USERVER_NAMESPACE_END
userver
storages
sqlite
infra
connection_ptr.hpp
Generated on
for userver by
Doxygen
1.17.0