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 "pqxx/types.hxx"
20 
21 
22 namespace pqxx
23 {
25 
53 class PQXX_LIBEXPORT PQXX_NOVTABLE notification_receiver
54 {
55 public:
57 
61  notification_receiver(connection_base &c, const std::string &channel);
63  notification_receiver &operator=(const notification_receiver &) =delete;
64  virtual ~notification_receiver();
65 
67  const std::string &channel() const { return m_channel; }
68 
70 
77  virtual void operator()(const std::string &payload, int backend_pid) =0;
78 
79 protected:
80  connection_base &conn() const noexcept { return m_conn; }
81 
82 private:
83  connection_base &m_conn;
84  std::string m_channel;
85 };
86 }
87 
88 #include "pqxx/compiler-internal-post.hxx"
89 #endif
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:22
connection_base & conn() const noexcept
Definition: notification.hxx:80
Definition: notification.hxx:53
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:138
const std::string & channel() const
The channel that this receiver listens on.
Definition: notification.hxx:67