1b9795fafSAugustin Cavalier/*
2b9795fafSAugustin Cavalier * Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
3b9795fafSAugustin Cavalier * All rights reserved. Distributed under the terms of the MIT license.
4b9795fafSAugustin Cavalier */
5224e7c42SIngo Weinhold#ifndef LAST_MODIFIED_INDEX_H
6224e7c42SIngo Weinhold#define LAST_MODIFIED_INDEX_H
7224e7c42SIngo Weinhold
8224e7c42SIngo Weinhold#include "Index.h"
9224e7c42SIngo Weinhold#include "NodeListener.h"
10224e7c42SIngo Weinhold#include "TwoKeyAVLTree.h"
11224e7c42SIngo Weinhold
12224e7c42SIngo Weinhold// LastModifiedIndex
13224e7c42SIngo Weinholdclass LastModifiedIndex : public Index, private NodeListener {
14224e7c42SIngo Weinholdpublic:
15224e7c42SIngo Weinhold	LastModifiedIndex(Volume *volume);
16224e7c42SIngo Weinhold	virtual ~LastModifiedIndex();
17224e7c42SIngo Weinhold
18224e7c42SIngo Weinhold	virtual int32 CountEntries() const;
19224e7c42SIngo Weinhold
20224e7c42SIngo Weinhold	virtual status_t Changed(Node *node, time_t oldModified);
21224e7c42SIngo Weinhold
22224e7c42SIngo Weinholdprivate:
23224e7c42SIngo Weinhold	virtual void NodeAdded(Node *node);
24224e7c42SIngo Weinhold	virtual void NodeRemoved(Node *node);
25224e7c42SIngo Weinhold
26224e7c42SIngo Weinholdprotected:
27224e7c42SIngo Weinhold	virtual AbstractIndexEntryIterator *InternalGetIterator();
28224e7c42SIngo Weinhold	virtual AbstractIndexEntryIterator *InternalFind(const uint8 *key,
29224e7c42SIngo Weinhold													 size_t length);
30224e7c42SIngo Weinhold
31224e7c42SIngo Weinholdprivate:
32224e7c42SIngo Weinhold	class Iterator;
33224e7c42SIngo Weinhold	class IteratorList;
34224e7c42SIngo Weinhold	class NodeTree;
35224e7c42SIngo Weinhold	friend class Iterator;
36224e7c42SIngo Weinhold
37224e7c42SIngo Weinholdprivate:
38224e7c42SIngo Weinhold	void _AddIterator(Iterator *iterator);
39224e7c42SIngo Weinhold	void _RemoveIterator(Iterator *iterator);
40224e7c42SIngo Weinhold
41224e7c42SIngo Weinholdprivate:
42224e7c42SIngo Weinhold	NodeTree		*fNodes;
43224e7c42SIngo Weinhold	IteratorList	*fIterators;
44224e7c42SIngo Weinhold};
45224e7c42SIngo Weinhold
46224e7c42SIngo Weinhold#endif	// LAST_MODIFIED_INDEX_H
47