libpqxx
The C++ client library for PostgreSQL
Toggle main menu visibility
Loading...
Searching...
No Matches
notification.hxx
Go to the documentation of this file.
1
/* Definition of the pqxx::notification_receiver functor interface.
2
*
3
* pqxx::notification_receiver handles incoming notifications.
4
*
5
* DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/notification instead.
6
*
7
* Copyright (c) 2000-2025, Jeroen T. Vermeulen.
8
*
9
* See COPYING for copyright license. If you did not receive a file called
10
* COPYING with this source code, please notify the distributor of this
11
* mistake, or contact the author.
12
*/
13
#ifndef PQXX_H_NOTIFICATION
14
#define PQXX_H_NOTIFICATION
15
16
#if !defined(PQXX_HEADER_PRE)
17
# error "Include libpqxx headers as <pqxx/header>, not <pqxx/header.hxx>."
18
#endif
19
20
#include <string>
21
22
#include "
pqxx/types.hxx
"
23
24
25
namespace
pqxx
26
{
28
56
class
PQXX_LIBEXPORT
PQXX_NOVTABLE
notification_receiver
57
{
58
public
:
60
64
[[deprecated(
"Use pqxx::connection::listen() instead."
)]]
65
notification_receiver
(connection &cx, std::string_view
channel
);
67
[[deprecated(
"Use pqxx::connection::listen() instead."
)]]
68
notification_receiver
(
notification_receiver
const
&) =
delete
;
70
[[deprecated(
"Use pqxx::connection::listen() instead."
)]]
71
notification_receiver
&
operator=
(
notification_receiver
const
&) =
delete
;
73
virtual
~notification_receiver
();
74
76
[[nodiscard]] std::string
const
&
channel
() const & {
return
m_channel; }
77
79
86
virtual
void
operator()
(std::string
const
&payload,
int
backend_pid) = 0;
87
88
protected
:
89
connection &
conn
() const noexcept {
return
m_conn; }
90
91
private
:
92
connection &m_conn;
93
std::string m_channel;
94
};
95
}
// namespace pqxx
96
#endif
pqxx::notification_receiver::notification_receiver
notification_receiver(notification_receiver const &)=delete
Register the receiver with a connection.
pqxx::notification_receiver::notification_receiver
notification_receiver(connection &cx, std::string_view channel)
Register the receiver with a connection.
Definition
notification.cxx:23
pqxx::notification_receiver::channel
std::string const & channel() const &
The channel that this receiver listens on.
Definition
notification.hxx:76
pqxx::notification_receiver::operator()
virtual void operator()(std::string const &payload, int backend_pid)=0
Overridable: action to invoke when notification arrives.
pqxx::notification_receiver::conn
connection & conn() const noexcept
Definition
notification.hxx:89
pqxx::notification_receiver::operator=
notification_receiver & operator=(notification_receiver const &)=delete
Register the receiver with a connection.
PQXX_LIBEXPORT
#define PQXX_LIBEXPORT
Definition
header-pre.hxx:157
PQXX_NOVTABLE
#define PQXX_NOVTABLE
Definition
header-pre.hxx:172
pqxx
The home of all libpqxx classes, functions, templates, etc.
Definition
array.cxx:27
types.hxx
include
pqxx
notification.hxx
Generated by
1.17.0