diff -r a41df078684a -r 4122176ea935 userlibandfileserver/fileserver/sfat/sl_leafdir_cache.h --- a/userlibandfileserver/fileserver/sfat/sl_leafdir_cache.h Mon Oct 19 15:55:17 2009 +0100 +++ b/userlibandfileserver/fileserver/sfat/sl_leafdir_cache.h Mon Dec 21 16:14:42 2009 +0000 @@ -20,6 +20,15 @@ @internalTechnology */ +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +//!! +//!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it +//!! +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + #ifndef SL_LEAFDIR_CACHE_H #define SL_LEAFDIR_CACHE_H @@ -31,17 +40,17 @@ A data structure to define the location of a direcotry */ class TLeafDirData - { + { public: - TLeafDirData(); - TLeafDirData(TUint aClusterNum); - TLeafDirData(TUint aClusterNum, const TEntryPos& aMRUPos); - inline TBool operator==(const TLeafDirData &aDirPos) const; - inline TBool operator!=(const TLeafDirData &aDirPos) const; + TLeafDirData(); + TLeafDirData(TUint aClusterNum); + TLeafDirData(TUint aClusterNum, const TEntryPos& aMRUPos); + inline TBool operator==(const TLeafDirData &aDirPos) const; + inline TBool operator!=(const TLeafDirData &aDirPos) const; public: - TUint iClusterNum; - TEntryPos iMRUPos; - }; + TUint iClusterNum; + TEntryPos iMRUPos; + }; /* Class definition for the nodes of the leaf dir cache @@ -49,49 +58,49 @@ */ class CLeafDirTreeNode : public CBase - { + { public: - // Types of the nodes + // Types of the nodes enum TLeafDirTreeNodeType { - ERoot, // Represents the root node, i.e. the root path - ELeaf, // Represents a pure 'leaf' nodes, no child - ELeafIntermediary, // Represents a 'leaf' node, but has at least one child - EPureIntermediary, // Represents a pure 'intermediary' node, which only exists to share the common path of other nodes + ERoot, // Represents the root node, i.e. the root path + ELeaf, // Represents a pure 'leaf' nodes, no child + ELeafIntermediary, // Represents a 'leaf' node, but has at least one child + EPureIntermediary, // Represents a pure 'intermediary' node, which only exists to share the common path of other nodes }; static CLeafDirTreeNode* NewL(CLeafDirTree* aOwnerTree, const TDesC& aPathName, const TLeafDirData& aDirPos, TLeafDirTreeNodeType aType); - ~CLeafDirTreeNode(); - inline CLeafDirTreeNode* Parent(); - inline void SetParent(CLeafDirTreeNode* aNode); - inline RPointerArray& Children(); - void MakeItChildL(CLeafDirTreeNode* aNode); - TInt RemoveChild(CLeafDirTreeNode* aNode); - inline const TLeafDirData& LeafDirData() const; - inline TUint32 StartClusterNum() const; - inline void SetLeafDirData(const TLeafDirData& aLeafDirData); - inline const TDesC& Path() const; - void SetPathL(const TDesC& aPathData); - void SetType(const CLeafDirTreeNode::TLeafDirTreeNodeType aType); - inline TBool IsRoot() const; - inline TBool IsLeaf(); - inline TBool IsLeafIntermediary(); - inline TBool IsPureIntermediary(); + ~CLeafDirTreeNode(); + inline CLeafDirTreeNode* Parent(); + inline void SetParent(CLeafDirTreeNode* aNode); + inline RPointerArray& Children(); + void MakeItChildL(CLeafDirTreeNode* aNode); + TInt RemoveChild(CLeafDirTreeNode* aNode); + inline const TLeafDirData& LeafDirData() const; + inline TUint32 StartClusterNum() const; + inline void SetLeafDirData(const TLeafDirData& aLeafDirData); + inline const TDesC& Path() const; + void SetPathL(const TDesC& aPathData); + void SetType(const CLeafDirTreeNode::TLeafDirTreeNodeType aType); + inline TBool IsRoot() const; + inline TBool IsLeaf(); + inline TBool IsLeafIntermediary(); + inline TBool IsPureIntermediary(); private: - void ConstructL(CLeafDirTree* aOwnerTree, const TDesC& aPathName); - CLeafDirTreeNode(const TLeafDirData& aDirPos , TLeafDirTreeNodeType aType); - CLeafDirTreeNode(const CLeafDirTreeNode& aLeafDirTreeNode); - CLeafDirTreeNode* operator=(CLeafDirTreeNode& aLeafDirTreeNode); + void ConstructL(CLeafDirTree* aOwnerTree, const TDesC& aPathName); + CLeafDirTreeNode(const TLeafDirData& aDirPos , TLeafDirTreeNodeType aType); + CLeafDirTreeNode(const CLeafDirTreeNode& aLeafDirTreeNode); + CLeafDirTreeNode* operator=(CLeafDirTreeNode& aLeafDirTreeNode); private: - CLeafDirTree* iOwnerTree; // A pointer to the owner of this node. - CLeafDirTreeNode* iParent; // The parent of this node - RPointerArray iChildren; // The children of this node - RBuf iPath; // The path of the direcotry this node represents - TLeafDirData iLeafDirData; // The position of the direcotry this node represents - TLeafDirTreeNodeType iNodeType; // The type of the node - }; + CLeafDirTree* iOwnerTree; // A pointer to the owner of this node. + CLeafDirTreeNode* iParent; // The parent of this node + RPointerArray iChildren; // The children of this node + RBuf iPath; // The path of the direcotry this node represents + TLeafDirData iLeafDirData; // The position of the direcotry this node represents + TLeafDirTreeNodeType iNodeType; // The type of the node + }; /* Class definition for the tree structure of the leaf dir cache @@ -99,51 +108,51 @@ */ class CLeafDirTree : public CBase - { + { public: - static CLeafDirTree* NewL(TUint32 aSize); - ~CLeafDirTree(); + static CLeafDirTree* NewL(TUint32 aSize); + ~CLeafDirTree(); public: - TInt Search(const TDesC& aPath, CLeafDirTreeNode*& aNodeFound, TLeafDirData& aDirPos); - TInt DoSearch(const TDesC& aPath, CLeafDirTreeNode* aNodeToStart, CLeafDirTreeNode*& aNodeFound, TLeafDirData& aDirPos); - void InsertL(const TDesC& aPath, const TLeafDirData& aDirPos, CLeafDirTreeNode*& aNodeInserted); - void DoInsertL(CLeafDirTreeNode* aNodeToStart, const TDesC& aPath, const TLeafDirData& aDirPos, CLeafDirTreeNode*& aNodeInserted); - void RemoveDirL(const TLeafDirData& aDirPos); - void UpdateMRUPos(const TLeafDirData& aLeafDirData); - void RemoveFromCacheL(CLeafDirTreeNode* aNodeToDelete); - CLeafDirTreeNode* FindLeftestLeafNode(CLeafDirTreeNode* aNodeToStart) const; - void DeleteSubTreeL(CLeafDirTreeNode* aNodeToStart); - void Reset(); - CLeafDirTreeNode* LruNode(); - void AddOntoLruL(CLeafDirTreeNode* aNodeToAdd); - TInt RemoveFromLru(CLeafDirTreeNode* aNodeToRemove); - TInt MakeMostRecentlyUsed(CLeafDirTreeNode* aNodeUsed); - inline TInt LruCount() const; - void CheckLimitL(); - - // For debugging & testing only - #ifdef _DEBUG - TInt ObjectCount() const {return iContainer.Count();}; - void AddToObjectContainerL(CLeafDirTreeNode* aNode); - void RemoveFromObjectContainerL(CLeafDirTreeNode* aNode); - void DumpTreeContentL() const; - #endif //_DEBUG + TInt Search(const TDesC& aPath, CLeafDirTreeNode*& aNodeFound, TLeafDirData& aDirPos); + TInt DoSearch(const TDesC& aPath, CLeafDirTreeNode* aNodeToStart, CLeafDirTreeNode*& aNodeFound, TLeafDirData& aDirPos); + void InsertL(const TDesC& aPath, const TLeafDirData& aDirPos, CLeafDirTreeNode*& aNodeInserted); + void DoInsertL(CLeafDirTreeNode* aNodeToStart, const TDesC& aPath, const TLeafDirData& aDirPos, CLeafDirTreeNode*& aNodeInserted); + void RemoveDirL(const TLeafDirData& aDirPos); + void UpdateMRUPos(const TLeafDirData& aLeafDirData); + void RemoveFromCacheL(CLeafDirTreeNode* aNodeToDelete); + CLeafDirTreeNode* FindLeftestLeafNode(CLeafDirTreeNode* aNodeToStart) const; + void DeleteSubTreeL(CLeafDirTreeNode* aNodeToStart); + void Reset(); + CLeafDirTreeNode* LruNode(); + void AddOntoLruL(CLeafDirTreeNode* aNodeToAdd); + TInt RemoveFromLru(CLeafDirTreeNode* aNodeToRemove); + TInt MakeMostRecentlyUsed(CLeafDirTreeNode* aNodeUsed); + inline TInt LruCount() const; + void CheckLimitL(); + + // For debugging & testing only + #ifdef _DEBUG + TInt ObjectCount() const {return iContainer.Count();}; + void AddToObjectContainerL(CLeafDirTreeNode* aNode); + void RemoveFromObjectContainerL(CLeafDirTreeNode* aNode); + void DumpTreeContentL() const; + #endif //_DEBUG private: - void ConstructL(); - CLeafDirTree(TUint32 aSize); + void ConstructL(); + CLeafDirTree(TUint32 aSize); private: - CLeafDirTreeNode* iRoot; // The root node - RPointerArray iLruList; // The list containing all the LRU cached nodes - TUint32 iSize; // The maximum number of items allowed to cache + CLeafDirTreeNode* iRoot; // The root node + RPointerArray iLruList; // The list containing all the LRU cached nodes + TUint32 iSize; // The maximum number of items allowed to cache - // For debugging & testing only - #ifdef _DEBUG - RPointerArray iContainer; // The container containing all nodes - #endif //_DEBUG - }; + // For debugging & testing only + #ifdef _DEBUG + RPointerArray iContainer; // The container containing all nodes + #endif //_DEBUG + }; /* Class definition for leaf directory cache. @@ -151,31 +160,31 @@ */ class CLeafDirCache : public CBase - { -public: - static CLeafDirCache* NewL(TUint32 aLimit); - ~CLeafDirCache(); - void Reset(); - TInt FindInCache(const TDesC& aLeafDirName, TLeafDirData& aDirPos) const; - void AddToCacheL(const TDesC& aLeafDirName, const TLeafDirData& aDirPos); - void RemoveDirL(const TLeafDirData& aDirPos); - void UpdateMRUPos(const TLeafDirData& aLeafDirData); - TInt CacheCount() const; + { +public: + static CLeafDirCache* NewL(TUint32 aLimit); + ~CLeafDirCache(); + void Reset(); + TInt FindInCache(const TDesC& aLeafDirName, TLeafDirData& aDirPos) const; + void AddToCacheL(const TDesC& aLeafDirName, const TLeafDirData& aDirPos); + void RemoveDirL(const TLeafDirData& aDirPos); + void UpdateMRUPos(const TLeafDirData& aLeafDirData); + TInt CacheCount() const; - // For debugging & testing only - #ifdef _DEBUG - void DumpCacheContentL() const; - TInt NodeCount() const; - #endif //_DEBUG + // For debugging & testing only + #ifdef _DEBUG + void DumpCacheContentL() const; + TInt NodeCount() const; + #endif //_DEBUG private: - CLeafDirCache(TUint32 aLimit); - void ConstructL(); + CLeafDirCache(TUint32 aLimit); + void ConstructL(); private: - TUint32 iSize; // The cache size - CLeafDirTree* iTree; // The cache content, represented as a tree structure - }; + TUint32 iSize; // The cache size + CLeafDirTree* iTree; // The cache content, represented as a tree structure + }; //---------------------------------------------------------------------------------------------------------------------------------