1/*
2 * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef SIZE_INDEX_H
6#define SIZE_INDEX_H
7
8
9#include "Index.h"
10#include "NodeListener.h"
11
12
13class SizeIndex : public Index, private NodeListener {
14public:
15								SizeIndex();
16	virtual						~SizeIndex();
17
18			status_t			Init(Volume* volume);
19
20	virtual	int32				CountEntries() const;
21
22private:
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
28protected:
29	virtual	AbstractIndexIterator* InternalGetIterator();
30	virtual	AbstractIndexIterator* InternalFind(const void* key,
31									size_t length);
32
33private:
34			struct IteratorPolicy;
35			class Iterator;
36			class IteratorList;
37			class NodeTree;
38			friend class Iterator;
39			friend struct IteratorPolicy;
40
41private:
42			void				_AddIteratorToUpdate(Iterator* iterator);
43
44private:
45			NodeTree*			fNodes;
46			IteratorList*		fIteratorsToUpdate;
47};
48
49
50#endif	// SIZE_INDEX_H
51