monotone

monotone Mtn Source Tree

Root/outdated_indicator.hh

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
21class outdated_indicator_factory_impl;
22
23class outdated_indicator
24{
25 boost::shared_ptr<outdated_indicator_factory_impl> parent;
26 unsigned int when;
27public:
28 outdated_indicator();
29 explicit outdated_indicator(boost::shared_ptr<outdated_indicator_factory_impl> p);
30 bool outdated();
31};
32
33
34class outdated_indicator_factory
35{
36 boost::shared_ptr<outdated_indicator_factory_impl> impl;
37public:
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

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status