notify-listen.hxx
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PQXX_H_NOTIFY_LISTEN
00020 #define PQXX_H_NOTIFY_LISTEN
00021
00022 #include "pqxx/compiler-public.hxx"
00023 #include "pqxx/compiler-internal-pre.hxx"
00024
00025 #include "pqxx/connection_base"
00026
00027
00028
00029
00030
00031 namespace pqxx
00032 {
00034
00059 class PQXX_LIBEXPORT PQXX_NOVTABLE notify_listener :
00060 public PGSTD::unary_function<int, void>
00061 {
00062 public:
00064
00068 notify_listener(connection_base &C, const PGSTD::string &N) :
00069 m_Conn(C), m_Name(N) { m_Conn.add_listener(this); }
00070
00071 virtual ~notify_listener() throw ()
00072 {
00073 #ifdef PQXX_QUIET_DESTRUCTORS
00074 disable_noticer Quiet(Conn());
00075 #endif
00076 m_Conn.remove_listener(this);
00077 }
00078
00079 const PGSTD::string &name() const { return m_Name; }
00080
00082
00087 virtual void operator()(int be_pid) =0;
00088
00089
00090 protected:
00091 connection_base &Conn() const throw () { return m_Conn; }
00092
00093 private:
00095 notify_listener(const notify_listener &);
00097 notify_listener &operator=(const notify_listener &);
00098
00099 connection_base &m_Conn;
00100 PGSTD::string m_Name;
00101 };
00102
00103 }
00104
00105
00106 #include "pqxx/compiler-internal-post.hxx"
00107
00108 #endif
00109