xref: /haiku/src/add-ons/kernel/file_systems/packagefs/indices/LastModifiedIndex.h (revision 002f37b0cca92e4cf72857c72ac95db5a8b09615)
1 /*
2  * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef LAST_MODIFIED_INDEX_H
6 #define LAST_MODIFIED_INDEX_H
7 
8 
9 #include "Index.h"
10 #include "NodeListener.h"
11 
12 
13 class LastModifiedIndex : public Index, private NodeListener {
14 public:
15 								LastModifiedIndex();
16 	virtual						~LastModifiedIndex();
17 
18 	status_t					Init(Volume* volume);
19 
20 	virtual	int32				CountEntries() const;
21 
22 private:
23 	virtual	void				NodeAdded(Node* node);
24 	virtual	void				NodeRemoved(Node* node);
25 	virtual	void				NodeChanged(Node* node, uint32 statFields,
26 									const OldNodeAttributes& oldAttributes);
27 
28 protected:
29 	virtual	AbstractIndexIterator* InternalGetIterator();
30 	virtual	AbstractIndexIterator* InternalFind(const void* key,
31 									size_t length);
32 
33 private:
34 			struct IteratorPolicy;
35 			class Iterator;
36 			class IteratorList;
37 			class NodeTree;
38 			friend class Iterator;
39 			friend struct IteratorPolicy;
40 
41 private:
42 			void				_AddIteratorToUpdate(Iterator* iterator);
43 
44 private:
45 			NodeTree*			fNodes;
46 			IteratorList*		fIteratorsToUpdate;
47 };
48 
49 
50 #endif	// LAST_MODIFIED_INDEX_H
51