libpqxx  3.1.1
notify-listen.hxx
1 /*-------------------------------------------------------------------------
2  *
3  * FILE
4  * pqxx/notify-listen.hxx
5  *
6  * DESCRIPTION
7  * definition of the pqxx::notify_listener functor interface.
8  * pqxx::notify_listener describes a notification to wait on, and what it does
9  * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/notify-listen instead.
10  *
11  * Copyright (c) 2001-2008, 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_NOTIFY_LISTEN
20 #define PQXX_H_NOTIFY_LISTEN
21 
22 #include "pqxx/compiler-public.hxx"
23 #include "pqxx/compiler-internal-pre.hxx"
24 
25 #include "pqxx/connection_base"
26 
27 
28 /* Methods tested in eg. self-test program test001 are marked with "//[t1]"
29  */
30 
31 namespace pqxx
32 {
34 
59 class PQXX_LIBEXPORT PQXX_NOVTABLE notify_listener :
60  public PGSTD::unary_function<int, void>
61 {
62 public:
64 
68  notify_listener(connection_base &C, const PGSTD::string &N); //[t4]
69 
70  virtual ~notify_listener() throw (); //[t4]
71 
72  const PGSTD::string &name() const { return m_Name; } //[t4]
73 
75 
80  virtual void operator()(int be_pid) =0; //[t4]
81 
82 
83 protected:
85  connection_base &Conn() const throw () { return conn(); } //[t23]
86 
88  connection_base &conn() const throw () { return m_conn; } //[t23]
89 
90 private:
94  notify_listener &operator=(const notify_listener &);
95 
96  connection_base &m_conn;
97  PGSTD::string m_Name;
98 };
99 
100 }
101 
102 
103 #include "pqxx/compiler-internal-post.hxx"
104 
105 #endif