1 // Tree.h 2 // 3 // Copyright (c) 2003, Ingo Weinhold (bonefish@cs.tu-berlin.de) 4 // 5 // This program is free software; you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation; either version 2 of the License, or 8 // (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with this program; if not, write to the Free Software 17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 // 19 // You can alternatively use *this file* under the terms of the the MIT 20 // license included in this package. 21 22 #ifndef TREE_H 23 #define TREE_H 24 25 #include <SupportDefs.h> 26 27 class Block; 28 class BlockCache; 29 class DirItem; 30 class Node; 31 class StatItem; 32 class TreeIterator; 33 class TreePath; 34 class Volume; 35 36 // Tree 37 class Tree { 38 public: 39 Tree(); 40 ~Tree(); 41 42 status_t Init(Volume *volume, Node *rootNode, uint32 treeHeight); 43 status_t InitCheck() const; 44 45 Volume *GetVolume() const { return fVolume; } 46 47 uint32 GetTreeHeight() const; 48 uint32 GetBlockSize() const; 49 50 BlockCache *GetBlockCache() const; 51 Node *GetRootNode() const; 52 53 status_t GetBlock(uint64 blockNumber, Block **block); 54 status_t GetNode(uint64 blockNumber, Node **node); 55 56 status_t FindDirEntry(uint32 dirID, uint32 objectID, const char *name, 57 DirItem *foundItem, int32 *entryIndex); 58 status_t FindDirEntry(uint32 dirID, uint32 objectID, const char *name, 59 size_t nameLen, DirItem *foundItem, 60 int32 *entryIndex); 61 62 status_t FindStatItem(uint32 dirID, uint32 objectID, StatItem *item); 63 64 private: 65 Volume *fVolume; 66 BlockCache *fBlockCache; 67 Node *fRootNode; 68 uint32 fTreeHeight; 69 }; 70 71 #endif // TREE_H 72