1/*
2 * Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * All rights reserved. Distributed under the terms of the MIT license.
4 */
5#ifndef ATTRIBUTE_INDEX_IMPL_H
6#define ATTRIBUTE_INDEX_IMPL_H
7
8#include "AttributeIndex.h"
9
10// AttributeIndexImpl
11class AttributeIndexImpl : public AttributeIndex {
12public:
13	AttributeIndexImpl(Volume *volume, const char *name, uint32 type,
14					   size_t keyLength);
15	virtual ~AttributeIndexImpl();
16
17	virtual int32 CountEntries() const;
18
19	virtual status_t Changed(Attribute *attribute,
20							 const uint8 *oldKey, size_t oldLength);
21
22private:
23	virtual status_t Added(Attribute *attribute);
24	virtual bool Removed(Attribute *attribute);
25
26protected:
27	virtual AbstractIndexEntryIterator *InternalGetIterator();
28	virtual AbstractIndexEntryIterator *InternalFind(const uint8 *key,
29													 size_t length);
30
31private:
32	class Iterator;
33	class IteratorList;
34	class AttributeTree;
35
36	class PrimaryKey;
37	class GetPrimaryKey;
38	class PrimaryKeyCompare;
39
40	friend class Iterator;
41
42private:
43	void _AddIterator(Iterator *iterator);
44	void _RemoveIterator(Iterator *iterator);
45
46private:
47	AttributeTree	*fAttributes;
48	IteratorList	*fIterators;
49};
50
51#endif	// ATTRIBUTE_INDEX_IMPL_H
52