libpqxx
notification.hxx
1 
13 #ifndef PQXX_H_NOTIFICATION
14 #define PQXX_H_NOTIFICATION
15 
16 #include "pqxx/compiler-public.hxx"
17 #include "pqxx/compiler-internal-pre.hxx"
18 
19 #include <string>
20 
21 #include "pqxx/types.hxx"
22 
23 
24 namespace pqxx
25 {
27 
55 class PQXX_LIBEXPORT PQXX_NOVTABLE notification_receiver
56 {
57 public:
59 
63  notification_receiver(connection_base &c, const std::string &channel);
65  notification_receiver &operator=(const notification_receiver &) =delete;
66  virtual ~notification_receiver();
67 
69  const std::string &channel() const { return m_channel; }
70 
72 
79  virtual void operator()(const std::string &payload, int backend_pid) =0;
80 
81 protected:
82  connection_base &conn() const noexcept { return m_conn; }
83 
84 private:
85  connection_base &m_conn;
86  std::string m_channel;
87 };
88 }
89 
90 #include "pqxx/compiler-internal-post.hxx"
91 #endif
pqxx::internal
Private namespace for libpqxx's internal use; do not access.
Definition: connection_base.hxx:43
pqxx::notification_receiver::channel
const std::string & channel() const
The channel that this receiver listens on.
Definition: notification.hxx:69
pqxx::notification_receiver
Definition: notification.hxx:55
pqxx::notification_receiver::conn
connection_base & conn() const noexcept
Definition: notification.hxx:82
pqxx::notification_receiver::notification_receiver
notification_receiver(connection_base &c, const std::string &channel)
Register the receiver with a connection.
Definition: notification.cxx:23
pqxx::connection_base
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:139
pqxx::notification_receiver::~notification_receiver
virtual ~notification_receiver()
Definition: notification.cxx:33
pqxx
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25