1 | #ifndef __OUTDATED_NOTIFIER_HH__␊ |
2 | #define __OUTDATED_NOTIFIER_HH__␊ |
3 | ␊ |
4 | // 2007 Timothy Brownawell <tbrownaw@gmail.com>␊ |
5 | // GNU GPL V2 or later␊ |
6 | ␊ |
7 | // Allow clients to find out when something changes.␊ |
8 | // The 'something' has an outdated_indicator_factory,␊ |
9 | // and calls note_change() when changes are made.␊ |
10 | // The client is provided with an outdated_indicator made␊ |
11 | // from that factory, which will become outdated after␊ |
12 | // further changes are made to the something.␊ |
13 | ␊ |
14 | // The default indicator is always outdated.␊ |
15 | ␊ |
16 | // When a factory is destroyed, all indicators made from␊ |
17 | // that factory become outdated.␊ |
18 | ␊ |
19 | #include <boost/shared_ptr.hpp>␊ |
20 | ␊ |
21 | class outdated_indicator_factory_impl;␊ |
22 | ␊ |
23 | class outdated_indicator␊ |
24 | {␊ |
25 | boost::shared_ptr<outdated_indicator_factory_impl> parent;␊ |
26 | unsigned int when;␊ |
27 | public:␊ |
28 | outdated_indicator();␊ |
29 | explicit outdated_indicator(boost::shared_ptr<outdated_indicator_factory_impl> p);␊ |
30 | bool outdated();␊ |
31 | };␊ |
32 | ␊ |
33 | ␊ |
34 | class outdated_indicator_factory␊ |
35 | {␊ |
36 | boost::shared_ptr<outdated_indicator_factory_impl> impl;␊ |
37 | public:␊ |
38 | outdated_indicator_factory();␊ |
39 | ~outdated_indicator_factory();␊ |
40 | outdated_indicator get_indicator();␊ |
41 | void note_change();␊ |
42 | };␊ |
43 | ␊ |
44 | #endif␊ |
45 | ␊ |
46 | ␊ |
47 | // Local Variables:␊ |
48 | // mode: C++␊ |
49 | // fill-column: 76␊ |
50 | // c-file-style: "gnu"␊ |
51 | // indent-tabs-mode: nil␊ |
52 | // End:␊ |
53 | // vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:␊ |
54 | ␊ |