g4tools  5.4.0
dispatcher
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_X11_dispatcher
5 #define tools_X11_dispatcher
6 
7 #include <X11/Xlib.h>
8 
9 #ifdef TOOLS_MEM
10 #include <tools/mem>
11 #endif
12 
13 namespace tools {
14 namespace X11 {
15 
16 class dispatcher {
17 protected:
18 #ifdef TOOLS_MEM
19  static const std::string& s_class() {
20  static const std::string s_v("tools::X11::dispatcher");
21  return s_v;
22  }
23 #endif
24 public:
25  virtual bool dispatch(XEvent&) = 0;
26  virtual Window window() const = 0;
27  virtual dispatcher* copy() const = 0;
28 public:
30 #ifdef TOOLS_MEM
31  tools::mem::increment(s_class().c_str());
32 #endif
33  }
34  virtual ~dispatcher(){
35 #ifdef TOOLS_MEM
36  tools::mem::decrement(s_class().c_str());
37 #endif
38  }
39 public:
40  dispatcher(const dispatcher& a_from):m_is_valid(a_from.m_is_valid){
41 #ifdef TOOLS_MEM
42  tools::mem::increment(s_class().c_str());
43 #endif
44  }
45  dispatcher& operator=(const dispatcher& a_from) { m_is_valid = a_from.m_is_valid;return *this;}
46 public:
47  bool is_valid() const {return m_is_valid;}
48  void invalidate() {m_is_valid = false;}
49 protected:
50  bool m_is_valid;
51 };
52 
53 }}
54 
55 
56 #endif
tools::X11::dispatcher::copy
virtual dispatcher * copy() const =0
tools::X11::dispatcher::operator=
dispatcher & operator=(const dispatcher &a_from)
Definition: dispatcher:45
tools::X11::dispatcher::m_is_valid
bool m_is_valid
Definition: dispatcher:50
tools::X11::dispatcher::dispatcher
dispatcher()
Definition: dispatcher:29
mem
tools::X11::dispatcher::dispatcher
dispatcher(const dispatcher &a_from)
Definition: dispatcher:40
tools::X11::dispatcher::window
virtual Window window() const =0
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::X11::dispatcher::dispatch
virtual bool dispatch(XEvent &)=0
tools::X11::dispatcher::is_valid
bool is_valid() const
Definition: dispatcher:47
tools::X11::dispatcher
Definition: dispatcher:16
tools::X11::dispatcher::invalidate
void invalidate()
Definition: dispatcher:48
tools::X11::dispatcher::~dispatcher
virtual ~dispatcher()
Definition: dispatcher:34