libpqxx 4.0
|
00001 /*------------------------------------------------------------------------- 00002 * 00003 * FILE 00004 * pqxx/notification.hxx 00005 * 00006 * DESCRIPTION 00007 * definition of the pqxx::notification_receiver functor interface. 00008 * pqxx::notification_receiver handles incoming notifications. 00009 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/notification instead. 00010 * 00011 * Copyright (c) 2011, Jeroen T. Vermeulen <jtv@xs4all.nl> 00012 * 00013 * See COPYING for copyright license. If you did not receive a file called 00014 * COPYING with this source code, please notify the distributor of this mistake, 00015 * or contact the author. 00016 * 00017 *------------------------------------------------------------------------- 00018 */ 00019 #ifndef PQXX_H_NOTIFICATION 00020 #define PQXX_H_NOTIFICATION 00021 00022 #include "pqxx/compiler-public.hxx" 00023 #include "pqxx/compiler-internal-pre.hxx" 00024 00025 namespace pqxx 00026 { 00027 class connection_base; 00028 00029 00031 00059 class PQXX_LIBEXPORT PQXX_NOVTABLE notification_receiver : 00060 public PGSTD::binary_function<const PGSTD::string &, int, void> 00061 { 00062 public: 00064 00068 notification_receiver(connection_base &c, const PGSTD::string &channel); 00069 virtual ~notification_receiver(); 00070 00072 const PGSTD::string &channel() const { return m_channel; } 00073 00075 00082 virtual void operator()(const PGSTD::string &payload, int backend_pid) =0; 00083 00084 protected: 00085 connection_base &conn() const throw () { return m_conn; } 00086 00087 private: 00088 // Not allowed. 00089 notification_receiver(const notification_receiver &); 00090 // Not allowed. 00091 notification_receiver &operator=(const notification_receiver &); 00092 00093 connection_base &m_conn; 00094 PGSTD::string m_channel; 00095 }; 00096 } 00097 00098 #include "pqxx/compiler-internal-pre.hxx" 00099 #include "pqxx/compiler-internal-post.hxx" 00100 #endif