predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsCache.h
branchRCL_3
changeset 6 e8e3147d53eb
parent 0 e686773b3f54
child 7 b3431bff8c19
equal deleted inserted replaced
5:81f8547efd4f 6:e8e3147d53eb
    35 	public:
    35 	public:
    36 
    36 
    37 		/**
    37 		/**
    38 		* Two phase construction
    38 		* Two phase construction
    39 		*/
    39 		*/
    40 		static CPcsCache* NewL(TDesC& aURI, CPcsKeyMap& aKeyMap, TUint8 aUriId);
    40 		static CPcsCache* NewL(const TDesC& aURI, CPcsKeyMap& aKeyMap, TUint8 aUriId);
    41 
    41 
    42 		/**
    42 		/**
    43 		* Virtual destructor
    43 		* Virtual destructor
    44 		*/
    44 		*/
    45 		virtual ~CPcsCache();
    45 		virtual ~CPcsCache();
    70 		void RemoveFromCacheL(TInt aItemId);	    
    70 		void RemoveFromCacheL(TInt aItemId);	    
    71 
    71 
    72 		/**
    72 		/**
    73 		* Removes all data elements from the cache
    73 		* Removes all data elements from the cache
    74 		*/
    74 		*/
    75 		void RemoveAllFromCacheL();
    75 		void RemoveAllFromCache();
    76 
    76 
    77 		/**
    77 		/**
    78 		* Sets data fields to the cache
    78 		* Sets data fields to the cache
    79 		*/
    79 		*/
    80 		void SetDataFields(RArray<TInt>& aDataFields);
    80 		void SetDataFields(RArray<TInt>& aDataFields);
   131 		CPcsCache();
   131 		CPcsCache();
   132 
   132 
   133 		/**
   133 		/**
   134 		* Second phase constructor
   134 		* Second phase constructor
   135 		*/
   135 		*/
   136 		void ConstructL(TDesC& aURI, CPcsKeyMap& aKeyMap, TUint8 aUriId);
   136 		void ConstructL(const TDesC& aURI, CPcsKeyMap& aKeyMap, TUint8 aUriId);
   137 
   137 
   138 		/**
   138 		/**
   139 		* Utility function to add a contact to the pool
   139 		* Utility function to add a contact to the pool
   140 		*/
   140 		*/
   141 		void AddToPoolL(TInt& aInfo, CPsData& data);
   141 		void AddToPoolL(TUint64& aPoolMap, CPsData& aData);
   142 
   142 
   143 		/**
   143 		/**
   144 		* Utility function 
   144 		* Utility function 
   145 		*/
   145 		*/
   146 		void SetPoolMap(TInt& aPoolMap, TInt aPoolId);
   146 		void SetPoolMap(TUint64& aPoolMap, TInt aArrayIndex);
   147 
   147 
   148 		/**
   148 		/**
   149 		* Utility function 
   149 		* Utility function 
   150 		*/
   150 		*/
   151 		TBool GetPoolMap(TInt& aPoolMap, TInt arrayIndex);
   151 		TBool GetPoolMap(TUint64& aPoolMap, TInt aArrayIndex);
   152 
   152 
   153         /**
   153         /**
   154          * Utility function
   154          * Utility function
   155          */
   155          */
   156         void ComputeIndexOrder();
   156         void ComputeIndexOrder();
       
   157         
   157 	private:    
   158 	private:    
   158 
   159 
   159 
       
   160 		/*
   160 		/*
   161 		* Array of key maps
   161 		* Array of key maps
   162 		*/
   162 		*/
   163 		typedef RPointerArray<CPcsPoolElement> R_PTR_ARRAY;
   163 		typedef RPointerArray<CPcsPoolElement> R_PTR_ARRAY;
   164 		RPointerArray<R_PTR_ARRAY> keyArr;     
   164 		RPointerArray<R_PTR_ARRAY> iKeyArr;
   165 
   165 
   166 		/*
   166 		/*
   167 		* Hashmaps to remember the location of a contact in the pools
   167 		* Hashmaps to remember the location of a contact in the pools
   168 		*/
   168 		*/
   169 		RHashMap<TInt, TInt> cacheInfo;			
   169 		RHashMap<TInt, TUint64> iCacheInfo;
   170 
   170 
   171 		/*
   171 		/*
   172 		* Master pool of all contacts in this cache
   172 		* Master pool of all contacts in this cache
   173 		*/
   173 		*/
   174 		RPointerArray<CPsData> masterPool;	
   174 		RPointerArray<CPsData> iMasterPool;	
   175 		
   175 		
   176 	    /*
   176 	    /*
   177 	    * Master pool backup of all contacts in this cache when sortorder changed
   177 	    * Master pool backup of all contacts in this cache when sortorder changed
   178 	    */
   178 	    */
   179 	    RPointerArray<CPsData> masterPoolBackup;  
   179 	    RPointerArray<CPsData> iMasterPoolBackup;
   180 
   180 
   181 		/*
   181 		/*
   182 		* Not owned
   182 		* Not owned
   183 		*/
   183 		*/
   184 		CPcsKeyMap* keyMap;		
   184 		CPcsKeyMap* iKeyMap;
   185 
   185 
   186 		/**
   186 		/**
   187 		* Owned. Refer to the database URI this cache is for.
   187 		* Owned. Refer to the database URI this cache is for.
   188 		*/
   188 		*/
   189 		HBufC* iURI;	
   189 		HBufC* iURI;
   190 
   190 
   191 		/**
   191 		/**
   192 		* Internal URI id for this cache
   192 		* Internal URI id for this cache
   193 		*/
   193 		*/
   194 		TInt8 iUriId;
   194 		TInt8 iUriId;