1*1e7416d9SIngo Weinhold /* 2*1e7416d9SIngo Weinhold * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de. 3*1e7416d9SIngo Weinhold * Distributed under the terms of the MIT License. 4*1e7416d9SIngo Weinhold */ 5*1e7416d9SIngo Weinhold #ifndef LAST_MODIFIED_INDEX_H 6*1e7416d9SIngo Weinhold #define LAST_MODIFIED_INDEX_H 7*1e7416d9SIngo Weinhold 8*1e7416d9SIngo Weinhold 9*1e7416d9SIngo Weinhold #include "Index.h" 10*1e7416d9SIngo Weinhold #include "NodeListener.h" 11*1e7416d9SIngo Weinhold 12*1e7416d9SIngo Weinhold 13*1e7416d9SIngo Weinhold class LastModifiedIndex : public Index, private NodeListener { 14*1e7416d9SIngo Weinhold public: 15*1e7416d9SIngo Weinhold LastModifiedIndex(); 16*1e7416d9SIngo Weinhold virtual ~LastModifiedIndex(); 17*1e7416d9SIngo Weinhold 18*1e7416d9SIngo Weinhold status_t Init(Volume* volume); 19*1e7416d9SIngo Weinhold 20*1e7416d9SIngo Weinhold virtual int32 CountEntries() const; 21*1e7416d9SIngo Weinhold 22*1e7416d9SIngo Weinhold private: 23*1e7416d9SIngo Weinhold virtual void NodeAdded(Node* node); 24*1e7416d9SIngo Weinhold virtual void NodeRemoved(Node* node); 25*1e7416d9SIngo Weinhold virtual void NodeChanged(Node* node, uint32 statFields, 26*1e7416d9SIngo Weinhold const OldNodeAttributes& oldAttributes); 27*1e7416d9SIngo Weinhold 28*1e7416d9SIngo Weinhold protected: 29*1e7416d9SIngo Weinhold virtual AbstractIndexIterator* InternalGetIterator(); 30*1e7416d9SIngo Weinhold virtual AbstractIndexIterator* InternalFind(const void* key, 31*1e7416d9SIngo Weinhold size_t length); 32*1e7416d9SIngo Weinhold 33*1e7416d9SIngo Weinhold private: 34*1e7416d9SIngo Weinhold struct IteratorPolicy; 35*1e7416d9SIngo Weinhold class Iterator; 36*1e7416d9SIngo Weinhold class IteratorList; 37*1e7416d9SIngo Weinhold class NodeTree; 38*1e7416d9SIngo Weinhold friend class Iterator; 39*1e7416d9SIngo Weinhold friend struct IteratorPolicy; 40*1e7416d9SIngo Weinhold 41*1e7416d9SIngo Weinhold private: 42*1e7416d9SIngo Weinhold void _AddIteratorToUpdate(Iterator* iterator); 43*1e7416d9SIngo Weinhold 44*1e7416d9SIngo Weinhold private: 45*1e7416d9SIngo Weinhold NodeTree* fNodes; 46*1e7416d9SIngo Weinhold IteratorList* fIteratorsToUpdate; 47*1e7416d9SIngo Weinhold }; 48*1e7416d9SIngo Weinhold 49*1e7416d9SIngo Weinhold 50*1e7416d9SIngo Weinhold #endif // LAST_MODIFIED_INDEX_H 51