xref: /haiku/src/add-ons/kernel/file_systems/packagefs/indices/NameIndex.h (revision 7c234361eb70458273aba20f16643d7514536f1c)
11e7416d9SIngo Weinhold /*
21e7416d9SIngo Weinhold  * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
31e7416d9SIngo Weinhold  * Distributed under the terms of the MIT License.
41e7416d9SIngo Weinhold  */
51e7416d9SIngo Weinhold #ifndef NAME_INDEX_H
61e7416d9SIngo Weinhold #define NAME_INDEX_H
71e7416d9SIngo Weinhold 
81e7416d9SIngo Weinhold 
91e7416d9SIngo Weinhold #include "Index.h"
101e7416d9SIngo Weinhold #include "NodeListener.h"
111e7416d9SIngo Weinhold 
121e7416d9SIngo Weinhold 
131e7416d9SIngo Weinhold template<typename Policy> class GenericIndexIterator;
141e7416d9SIngo Weinhold 
151e7416d9SIngo Weinhold 
161e7416d9SIngo Weinhold class NameIndex : public Index, private NodeListener {
171e7416d9SIngo Weinhold public:
181e7416d9SIngo Weinhold 								NameIndex();
191e7416d9SIngo Weinhold 	virtual						~NameIndex();
201e7416d9SIngo Weinhold 
211e7416d9SIngo Weinhold 			status_t			Init(Volume* volume);
221e7416d9SIngo Weinhold 
231e7416d9SIngo Weinhold 	virtual	int32				CountEntries() const;
241e7416d9SIngo Weinhold 
251e7416d9SIngo Weinhold private:
261e7416d9SIngo Weinhold 	virtual	void				NodeAdded(Node* node);
271e7416d9SIngo Weinhold 	virtual	void				NodeRemoved(Node* node);
281e7416d9SIngo Weinhold 	virtual	void				NodeChanged(Node* node, uint32 statFields,
291e7416d9SIngo Weinhold 									const OldNodeAttributes& oldAttributes);
301e7416d9SIngo Weinhold 
311e7416d9SIngo Weinhold protected:
321e7416d9SIngo Weinhold 	virtual	AbstractIndexIterator* InternalGetIterator();
331e7416d9SIngo Weinhold 	virtual	AbstractIndexIterator* InternalFind(const void* key,
341e7416d9SIngo Weinhold 									size_t length);
351e7416d9SIngo Weinhold 
361e7416d9SIngo Weinhold private:
371e7416d9SIngo Weinhold 			class EntryTree;
381e7416d9SIngo Weinhold 			struct IteratorPolicy;
391e7416d9SIngo Weinhold 			struct Iterator;
401e7416d9SIngo Weinhold 
41*7c234361SAugustin Cavalier 			friend struct IteratorPolicy;
421e7416d9SIngo Weinhold 
431e7416d9SIngo Weinhold 			void				_UpdateLiveQueries(Node* entry,
441e7416d9SIngo Weinhold 									const char* oldName, const char* newName);
451e7416d9SIngo Weinhold 
461e7416d9SIngo Weinhold private:
471e7416d9SIngo Weinhold 			EntryTree*			fEntries;
481e7416d9SIngo Weinhold };
491e7416d9SIngo Weinhold 
501e7416d9SIngo Weinhold 
511e7416d9SIngo Weinhold #endif	// NAME_INDEX_H
52