os/persistentdata/persistentstorage/dbms/pcdbms/ustor/US_STD.INL
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/dbms/pcdbms/ustor/US_STD.INL	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,234 @@
     1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include "D32Assert.h"
    1.20 +
    1.21 +// Class CDbStoreDatabase
    1.22 +inline CStreamStore& CDbStoreDatabase::Store()
    1.23 +	{
    1.24 +	return *iStore;
    1.25 +	}
    1.26 +	
    1.27 +inline MDbStreamFilter* CDbStoreDatabase::Filter()
    1.28 +	{
    1.29 +	return iFilter;
    1.30 +	}
    1.31 +
    1.32 +// Class TDbStoreIndexStats
    1.33 +inline TDbStoreIndexStats::TDbStoreIndexStats() :
    1.34 +	iRefresh(EInvalid),
    1.35 +	iFlags(0)
    1.36 +	{
    1.37 +	}
    1.38 +	
    1.39 +inline TBool TDbStoreIndexStats::IsValid() const
    1.40 +	{
    1.41 +	return iRefresh>=ERefresh;
    1.42 +	}
    1.43 +
    1.44 +// Class CDbStoreIndexDef
    1.45 +inline void CDbStoreIndexDef::SetTokenId(TStreamId anId)
    1.46 +	{
    1.47 +	iTokenId=anId;
    1.48 +	}
    1.49 +	
    1.50 +inline TStreamId CDbStoreIndexDef::TokenId() const
    1.51 +	{
    1.52 +	return iTokenId;
    1.53 +	}
    1.54 +
    1.55 +// Class TRecordSize
    1.56 +inline TInt TRecordSize::Clustering() const
    1.57 +	{
    1.58 +	return iClustering;
    1.59 +	}
    1.60 +	
    1.61 +inline TInt TRecordSize::InlineLimit() const
    1.62 +	{
    1.63 +	return iInlineLimit;
    1.64 +	}
    1.65 +	
    1.66 +inline TInt TRecordSize::FixedFieldSize(TDbColType aType)
    1.67 +	{
    1.68 +	__ASSERT(aType>EDbColBit&&aType<EDbColText8);
    1.69 +	return FieldSizes[aType];
    1.70 +	}
    1.71 +
    1.72 +// Class CDbStoreDef
    1.73 +inline void CDbStoreDef::SetTokenId(TStreamId anId)
    1.74 +	{
    1.75 +	iTokenId=anId;
    1.76 +	}
    1.77 +	
    1.78 +inline TStreamId CDbStoreDef::TokenId() const
    1.79 +	{
    1.80 +	return iTokenId;
    1.81 +	}
    1.82 +	
    1.83 +inline TInt CDbStoreDef::Clustering() const
    1.84 +	{
    1.85 +	return iInfo.Clustering();
    1.86 +	}
    1.87 +	
    1.88 +inline TInt CDbStoreDef::InlineLimit() const
    1.89 +	{
    1.90 +	return iInfo.InlineLimit();
    1.91 +	}
    1.92 +	
    1.93 +// Class TClusterId
    1.94 +inline TClusterId ClusterId(TDbRecordId aRecordId)
    1.95 +	{
    1.96 +	return aRecordId.Value()>>4;
    1.97 +	}
    1.98 +	
    1.99 +inline TInt RecordIndex(TDbRecordId aRecordId)
   1.100 +	{
   1.101 +	return aRecordId.Value()&0xfu;
   1.102 +	}
   1.103 +	
   1.104 +inline TDbRecordId RecordId(TClusterId aId,TInt aIndex)
   1.105 +	{
   1.106 +	__ASSERT(TUint(aIndex)<16u);
   1.107 +	return (aId<<4)+aIndex;
   1.108 +	}
   1.109 +	
   1.110 +inline TClusterId ClusterId(TStreamId aStreamId)
   1.111 +	{
   1.112 +	return aStreamId.Value();
   1.113 +	}
   1.114 +	
   1.115 +// Class RClusterMap
   1.116 +inline RClusterMap::RClusterMap()
   1.117 +	{
   1.118 +	__ASSERT(iMap==0 && iAlloc==0);
   1.119 +	}
   1.120 +	
   1.121 +inline void RClusterMap::Close()
   1.122 +	{
   1.123 +	User::Free(iMap);
   1.124 +	}
   1.125 +	
   1.126 +inline TClusterId RClusterMap::LastBound() const
   1.127 +	{
   1.128 +	return iLastBound;
   1.129 +	}
   1.130 +	
   1.131 +inline void RClusterMap::Complete(TClusterId aLastCluster)
   1.132 +	{
   1.133 +	if (aLastCluster==iLastBound) 
   1.134 +		{
   1.135 +		iComplete=ETrue;
   1.136 +		}
   1.137 +	}
   1.138 +	
   1.139 +inline TBool RClusterMap::IsComplete() const
   1.140 +	{
   1.141 +	return iComplete;
   1.142 +	}
   1.143 +	
   1.144 +inline void RClusterMap::BindL(TClusterId aPrevious,TClusterId aCluster)
   1.145 +	{
   1.146 +	if (aPrevious==iLastBound) 
   1.147 +		{
   1.148 +		AddL(aCluster);
   1.149 +		}
   1.150 +	}
   1.151 +		
   1.152 +// Class TClusterLinkCache
   1.153 +inline void TClusterLinkCache::Invalidate()
   1.154 +	{
   1.155 +	iEnd=NULL;
   1.156 +	}
   1.157 +	
   1.158 +void TClusterLinkCache::Reset(TClusterId aBaseId)
   1.159 +	{
   1.160 +	*(iEnd=iMap)=aBaseId;
   1.161 +	}
   1.162 +	
   1.163 +inline void TClusterLinkCache::Bind(TClusterId aPrevious,TClusterId aCluster,RClusterMap& aMap)
   1.164 +	{
   1.165 +	if (iEnd!=NULL && *iEnd==aPrevious) 
   1.166 +		{
   1.167 +		Add(aCluster,aMap);
   1.168 +		}
   1.169 +	}
   1.170 +		
   1.171 +// Class CCluster
   1.172 +inline CCluster::CCluster(CDbStoreDatabase& aDatabase) : 
   1.173 +	iDatabase(aDatabase)
   1.174 +	{
   1.175 +	}
   1.176 +	
   1.177 +inline TBool CCluster::IsFull() const
   1.178 +	{
   1.179 +	return iMap[KMaxClustering]-iMap[0]>=KClusterLimit;
   1.180 +	}
   1.181 +	
   1.182 +inline TClusterId CCluster::Id() const
   1.183 +	{
   1.184 +	return iCluster;
   1.185 +	}
   1.186 +	
   1.187 +inline const TClusterDes& CCluster::Des() const
   1.188 +	{
   1.189 +	return iDes;
   1.190 +	}
   1.191 +	
   1.192 +// Class CClusterCache
   1.193 +inline CDbStoreDatabase& CClusterCache::Database()
   1.194 +	{
   1.195 +	return iDatabase;
   1.196 +	}
   1.197 +	
   1.198 +inline CStreamStore& CClusterCache::Store()
   1.199 +	{
   1.200 +	return Database().Store();
   1.201 +	}
   1.202 +
   1.203 +// Class CDbStoreRecords
   1.204 +inline TClusterId CDbStoreRecords::Head() const
   1.205 +	{
   1.206 +	return iToken.iHead;
   1.207 +	}
   1.208 +	
   1.209 +inline TInt CDbStoreRecords::Count() const
   1.210 +	{
   1.211 +	return iToken.iCount;
   1.212 +	}
   1.213 +
   1.214 +// Class CDbStoreTable
   1.215 +inline const CDbStoreDef& CDbStoreTable::Def() const
   1.216 +	{
   1.217 +	return STATIC_CAST(const CDbStoreDef&,CDbTable::Def());
   1.218 +	}
   1.219 +	
   1.220 +inline CDbStoreDatabase& CDbStoreTable::Database()
   1.221 +	{
   1.222 +	return STATIC_CAST(CDbStoreDatabase&,CDbTable::Database());
   1.223 +	}
   1.224 +	
   1.225 +inline CDbStoreRecords& CDbStoreTable::StoreRecordsL()
   1.226 +	{
   1.227 +	return STATIC_CAST(CDbStoreRecords&,CDbTable::RecordsL());
   1.228 +	}
   1.229 +	
   1.230 +
   1.231 +// Class CDbStoreCompression
   1.232 +inline void CDbStoreCompression::Inflate()
   1.233 +	{
   1.234 +	__ASSERT(iState==EDecoding);
   1.235 +	iState=EInflating;
   1.236 +	}
   1.237 +