xref: /haiku/src/add-ons/kernel/file_systems/ramfs/AttributeIndexImpl.h (revision b9795faf5d27edaf49acb9f884ba181c0f0ae66b)
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
11 class AttributeIndexImpl : public AttributeIndex {
12 public:
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 
22 private:
23 	virtual status_t Added(Attribute *attribute);
24 	virtual bool Removed(Attribute *attribute);
25 
26 protected:
27 	virtual AbstractIndexEntryIterator *InternalGetIterator();
28 	virtual AbstractIndexEntryIterator *InternalFind(const uint8 *key,
29 													 size_t length);
30 
31 private:
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 
42 private:
43 	void _AddIterator(Iterator *iterator);
44 	void _RemoveIterator(Iterator *iterator);
45 
46 private:
47 	AttributeTree	*fAttributes;
48 	IteratorList	*fIterators;
49 };
50 
51 #endif	// ATTRIBUTE_INDEX_IMPL_H
52