libpqxx  4.0.1
notification.hxx
1 /*-------------------------------------------------------------------------
2  *
3  * FILE
4  * pqxx/notification.hxx
5  *
6  * DESCRIPTION
7  * definition of the pqxx::notification_receiver functor interface.
8  * pqxx::notification_receiver handles incoming notifications.
9  * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/notification instead.
10  *
11  * Copyright (c) 2011, Jeroen T. Vermeulen <jtv@xs4all.nl>
12  *
13  * See COPYING for copyright license. If you did not receive a file called
14  * COPYING with this source code, please notify the distributor of this mistake,
15  * or contact the author.
16  *
17  *-------------------------------------------------------------------------
18  */
19 #ifndef PQXX_H_NOTIFICATION
20 #define PQXX_H_NOTIFICATION
21 
22 #include "pqxx/compiler-public.hxx"
23 #include "pqxx/compiler-internal-pre.hxx"
24 
25 namespace pqxx
26 {
27 class connection_base;
28 
29 
31 
59 class PQXX_LIBEXPORT PQXX_NOVTABLE notification_receiver :
60  public PGSTD::binary_function<const PGSTD::string &, int, void>
61 {
62 public:
64 
68  notification_receiver(connection_base &c, const PGSTD::string &channel);
69  virtual ~notification_receiver();
70 
72  const PGSTD::string &channel() const { return m_channel; }
73 
75 
82  virtual void operator()(const PGSTD::string &payload, int backend_pid) =0;
83 
84 protected:
85  connection_base &conn() const throw () { return m_conn; }
86 
87 private:
88  // Not allowed.
90  // Not allowed.
91  notification_receiver &operator=(const notification_receiver &);
92 
93  connection_base &m_conn;
94  PGSTD::string m_channel;
95 };
96 }
97 
98 #include "pqxx/compiler-internal-pre.hxx"
99 #include "pqxx/compiler-internal-post.hxx"
100 #endif