blob: 3bac8b64e62aa4c0521e0908133d574da891f356 [file] [log] [blame]
Jeff Thompsona04f23c2013-09-16 17:48:38 -07001/**
2 * Copyright (C) 2013 Regents of the University of California.
3 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
4 * See COPYING for copyright and distribution information.
5 */
6
7#ifndef NDN_CHANGED_EVENT_HPP
8#define NDN_CHANGED_EVENT_HPP
9
10#include <vector>
11#include "../common.hpp"
12
13namespace ndn {
14
15/**
16 * An OnChanged function object is called to notify a listener of a changed event.
17 */
18typedef func_lib::function<void()> OnChanged;
19
20class ChangedEvent {
21public:
22 /**
23 * Add onChanged to the listener list. This does not check if a duplicate is already in the list.
24 * @param onChanged The OnChanged function object.
25 */
26 void add(OnChanged onChanged)
27 {
28 listeners_.push_back(onChanged);
29 }
30
31 /**
32 * Call all the listeners.
33 */
34 void fire();
35
36#if 0
37private:
38#endif
39 std::vector<OnChanged> listeners_;
40};
41
42}
43
44#endif