xref: /haiku/src/add-ons/kernel/file_systems/ramfs/AttributeIndexImpl.h (revision b9795faf5d27edaf49acb9f884ba181c0f0ae66b)
1*b9795fafSAugustin Cavalier /*
2*b9795fafSAugustin Cavalier  * Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
3*b9795fafSAugustin Cavalier  * All rights reserved. Distributed under the terms of the MIT license.
4*b9795fafSAugustin Cavalier  */
5224e7c42SIngo Weinhold #ifndef ATTRIBUTE_INDEX_IMPL_H
6224e7c42SIngo Weinhold #define ATTRIBUTE_INDEX_IMPL_H
7224e7c42SIngo Weinhold 
8224e7c42SIngo Weinhold #include "AttributeIndex.h"
9224e7c42SIngo Weinhold 
10224e7c42SIngo Weinhold // AttributeIndexImpl
11224e7c42SIngo Weinhold class AttributeIndexImpl : public AttributeIndex {
12224e7c42SIngo Weinhold public:
13224e7c42SIngo Weinhold 	AttributeIndexImpl(Volume *volume, const char *name, uint32 type,
14224e7c42SIngo Weinhold 					   size_t keyLength);
15224e7c42SIngo Weinhold 	virtual ~AttributeIndexImpl();
16224e7c42SIngo Weinhold 
17224e7c42SIngo Weinhold 	virtual int32 CountEntries() const;
18224e7c42SIngo Weinhold 
19224e7c42SIngo Weinhold 	virtual status_t Changed(Attribute *attribute,
20224e7c42SIngo Weinhold 							 const uint8 *oldKey, size_t oldLength);
21224e7c42SIngo Weinhold 
22224e7c42SIngo Weinhold private:
23224e7c42SIngo Weinhold 	virtual status_t Added(Attribute *attribute);
24224e7c42SIngo Weinhold 	virtual bool Removed(Attribute *attribute);
25224e7c42SIngo Weinhold 
26224e7c42SIngo Weinhold protected:
27224e7c42SIngo Weinhold 	virtual AbstractIndexEntryIterator *InternalGetIterator();
28224e7c42SIngo Weinhold 	virtual AbstractIndexEntryIterator *InternalFind(const uint8 *key,
29224e7c42SIngo Weinhold 													 size_t length);
30224e7c42SIngo Weinhold 
31224e7c42SIngo Weinhold private:
32224e7c42SIngo Weinhold 	class Iterator;
33224e7c42SIngo Weinhold 	class IteratorList;
34224e7c42SIngo Weinhold 	class AttributeTree;
35224e7c42SIngo Weinhold 
36224e7c42SIngo Weinhold 	class PrimaryKey;
37224e7c42SIngo Weinhold 	class GetPrimaryKey;
38224e7c42SIngo Weinhold 	class PrimaryKeyCompare;
39224e7c42SIngo Weinhold 
40224e7c42SIngo Weinhold 	friend class Iterator;
41224e7c42SIngo Weinhold 
42224e7c42SIngo Weinhold private:
43224e7c42SIngo Weinhold 	void _AddIterator(Iterator *iterator);
44224e7c42SIngo Weinhold 	void _RemoveIterator(Iterator *iterator);
45224e7c42SIngo Weinhold 
46224e7c42SIngo Weinhold private:
47224e7c42SIngo Weinhold 	AttributeTree	*fAttributes;
48224e7c42SIngo Weinhold 	IteratorList	*fIterators;
49224e7c42SIngo Weinhold };
50224e7c42SIngo Weinhold 
51224e7c42SIngo Weinhold #endif	// ATTRIBUTE_INDEX_IMPL_H
52