/* * Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de. * All rights reserved. Distributed under the terms of the MIT license. */ #ifndef ENTRY_H #define ENTRY_H #include #include #include #include "String.h" class AllocationInfo; class Directory; class EntryIterator; class Node; class Entry : public DoublyLinkedListLinkImpl { public: Entry(const char *name, Node *node = NULL, Directory *parent = NULL); ~Entry(); status_t InitCheck() const; Entry*& HashLink() { return fHashLink; } inline void SetParent(Directory *parent) { fParent = parent; } Directory *GetParent() const { return fParent; } // inline void SetNode(Node *node) { fNode = node; } status_t Link(Node *node); status_t Unlink(); Node *GetNode() const { return fNode; } status_t SetName(const char *newName); inline const char *GetName() const { return fName.GetString(); } // inline Volume *GetVolume() const { return fVolume; } inline DoublyLinkedListLink *GetReferrerLink() { return &fReferrerLink; } // entry iterator management void AttachEntryIterator(EntryIterator *iterator); void DetachEntryIterator(EntryIterator *iterator); inline DoublyLinkedList *GetEntryIteratorList() { return &fIterators; } // debugging void GetAllocationInfo(AllocationInfo &info); private: Entry *fHashLink; Directory *fParent; Node *fNode; String fName; DoublyLinkedListLink fReferrerLink; // iterator management DoublyLinkedList fIterators; }; // GetNodeReferrerLink class GetNodeReferrerLink { private: typedef DoublyLinkedListLink Link; public: inline Link *operator()(Entry *entry) const { return entry->GetReferrerLink(); } }; #endif // ENTRY_H