imgtools/imglib/filesystem/include/cluster.h
changeset 617 3a747a240983
parent 616 24e4ef208cca
child 620 ad8ffc8e1982
equal deleted inserted replaced
616:24e4ef208cca 617:3a747a240983
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * Cluster class for FileSystem component
       
    16 * @internalComponent
       
    17 * @released
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef CLUSTER_H
       
    23 #define CLUSTER_H
       
    24 
       
    25 #include "errorhandler.h"
       
    26 #include "directory.h"
       
    27 
       
    28 typedef multimap <unsigned int,unsigned int> TClustersPerEntryMap;
       
    29 
       
    30 /*
       
    31  * This class is used by classes CDirRegion and CLongName. This class describes 
       
    32  * the basic Data members and Member functions related to cluster number 
       
    33  * allocation and FAT input map creation.
       
    34  *
       
    35  * @internalComponent
       
    36  * @released
       
    37  */
       
    38 
       
    39 class CCluster
       
    40 {
       
    41 	public:
       
    42 		static CCluster* Instance (unsigned int aClusterSize, 
       
    43 								   unsigned int aTotalNumberOfClusters);
       
    44 
       
    45 		unsigned int GetCurrentClusterNumber() const;
       
    46 		void DecrementCurrentClusterNumber();
       
    47 		unsigned short int GetHighWordClusterNumber() const;
       
    48 		unsigned short int GetLowWordClusterNumber() const;
       
    49 		void CreateMap(unsigned int aStartingClusterNumber,unsigned int aPairClusterNumber);
       
    50 		TClustersPerEntryMap* GetClustersPerEntryMap();
       
    51 		void UpdateNextAvailableClusterNumber();
       
    52 		unsigned int GetClusterSize() const;
       
    53 		~CCluster ();
       
    54 
       
    55 	private:
       
    56 		CCluster(unsigned int aClusterSize,
       
    57 				 unsigned int aTotalNumberOfClusters);
       
    58 		static CCluster* iClusterInstance;
       
    59 
       
    60 		unsigned long int iClusterSize;
       
    61 		unsigned int iRootClusterNumber;
       
    62 		unsigned int iCurrentClusterNumber;
       
    63 		unsigned int iTotalNumberOfClusters;
       
    64 
       
    65 		
       
    66 		/* used to store the mapping of Starting cluster and Number's of
       
    67 		 * clusters occupied by the specific entry
       
    68 		 */
       
    69 		TClustersPerEntryMap iClustersPerEntry;
       
    70 };
       
    71 
       
    72 #endif //CLUSTER_H