os/persistentdata/persistentstorage/dbms/pcdbms/ustor/US_STD.INL
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include "D32Assert.h"
    17 
    18 // Class CDbStoreDatabase
    19 inline CStreamStore& CDbStoreDatabase::Store()
    20 	{
    21 	return *iStore;
    22 	}
    23 	
    24 inline MDbStreamFilter* CDbStoreDatabase::Filter()
    25 	{
    26 	return iFilter;
    27 	}
    28 
    29 // Class TDbStoreIndexStats
    30 inline TDbStoreIndexStats::TDbStoreIndexStats() :
    31 	iRefresh(EInvalid),
    32 	iFlags(0)
    33 	{
    34 	}
    35 	
    36 inline TBool TDbStoreIndexStats::IsValid() const
    37 	{
    38 	return iRefresh>=ERefresh;
    39 	}
    40 
    41 // Class CDbStoreIndexDef
    42 inline void CDbStoreIndexDef::SetTokenId(TStreamId anId)
    43 	{
    44 	iTokenId=anId;
    45 	}
    46 	
    47 inline TStreamId CDbStoreIndexDef::TokenId() const
    48 	{
    49 	return iTokenId;
    50 	}
    51 
    52 // Class TRecordSize
    53 inline TInt TRecordSize::Clustering() const
    54 	{
    55 	return iClustering;
    56 	}
    57 	
    58 inline TInt TRecordSize::InlineLimit() const
    59 	{
    60 	return iInlineLimit;
    61 	}
    62 	
    63 inline TInt TRecordSize::FixedFieldSize(TDbColType aType)
    64 	{
    65 	__ASSERT(aType>EDbColBit&&aType<EDbColText8);
    66 	return FieldSizes[aType];
    67 	}
    68 
    69 // Class CDbStoreDef
    70 inline void CDbStoreDef::SetTokenId(TStreamId anId)
    71 	{
    72 	iTokenId=anId;
    73 	}
    74 	
    75 inline TStreamId CDbStoreDef::TokenId() const
    76 	{
    77 	return iTokenId;
    78 	}
    79 	
    80 inline TInt CDbStoreDef::Clustering() const
    81 	{
    82 	return iInfo.Clustering();
    83 	}
    84 	
    85 inline TInt CDbStoreDef::InlineLimit() const
    86 	{
    87 	return iInfo.InlineLimit();
    88 	}
    89 	
    90 // Class TClusterId
    91 inline TClusterId ClusterId(TDbRecordId aRecordId)
    92 	{
    93 	return aRecordId.Value()>>4;
    94 	}
    95 	
    96 inline TInt RecordIndex(TDbRecordId aRecordId)
    97 	{
    98 	return aRecordId.Value()&0xfu;
    99 	}
   100 	
   101 inline TDbRecordId RecordId(TClusterId aId,TInt aIndex)
   102 	{
   103 	__ASSERT(TUint(aIndex)<16u);
   104 	return (aId<<4)+aIndex;
   105 	}
   106 	
   107 inline TClusterId ClusterId(TStreamId aStreamId)
   108 	{
   109 	return aStreamId.Value();
   110 	}
   111 	
   112 // Class RClusterMap
   113 inline RClusterMap::RClusterMap()
   114 	{
   115 	__ASSERT(iMap==0 && iAlloc==0);
   116 	}
   117 	
   118 inline void RClusterMap::Close()
   119 	{
   120 	User::Free(iMap);
   121 	}
   122 	
   123 inline TClusterId RClusterMap::LastBound() const
   124 	{
   125 	return iLastBound;
   126 	}
   127 	
   128 inline void RClusterMap::Complete(TClusterId aLastCluster)
   129 	{
   130 	if (aLastCluster==iLastBound) 
   131 		{
   132 		iComplete=ETrue;
   133 		}
   134 	}
   135 	
   136 inline TBool RClusterMap::IsComplete() const
   137 	{
   138 	return iComplete;
   139 	}
   140 	
   141 inline void RClusterMap::BindL(TClusterId aPrevious,TClusterId aCluster)
   142 	{
   143 	if (aPrevious==iLastBound) 
   144 		{
   145 		AddL(aCluster);
   146 		}
   147 	}
   148 		
   149 // Class TClusterLinkCache
   150 inline void TClusterLinkCache::Invalidate()
   151 	{
   152 	iEnd=NULL;
   153 	}
   154 	
   155 void TClusterLinkCache::Reset(TClusterId aBaseId)
   156 	{
   157 	*(iEnd=iMap)=aBaseId;
   158 	}
   159 	
   160 inline void TClusterLinkCache::Bind(TClusterId aPrevious,TClusterId aCluster,RClusterMap& aMap)
   161 	{
   162 	if (iEnd!=NULL && *iEnd==aPrevious) 
   163 		{
   164 		Add(aCluster,aMap);
   165 		}
   166 	}
   167 		
   168 // Class CCluster
   169 inline CCluster::CCluster(CDbStoreDatabase& aDatabase) : 
   170 	iDatabase(aDatabase)
   171 	{
   172 	}
   173 	
   174 inline TBool CCluster::IsFull() const
   175 	{
   176 	return iMap[KMaxClustering]-iMap[0]>=KClusterLimit;
   177 	}
   178 	
   179 inline TClusterId CCluster::Id() const
   180 	{
   181 	return iCluster;
   182 	}
   183 	
   184 inline const TClusterDes& CCluster::Des() const
   185 	{
   186 	return iDes;
   187 	}
   188 	
   189 // Class CClusterCache
   190 inline CDbStoreDatabase& CClusterCache::Database()
   191 	{
   192 	return iDatabase;
   193 	}
   194 	
   195 inline CStreamStore& CClusterCache::Store()
   196 	{
   197 	return Database().Store();
   198 	}
   199 
   200 // Class CDbStoreRecords
   201 inline TClusterId CDbStoreRecords::Head() const
   202 	{
   203 	return iToken.iHead;
   204 	}
   205 	
   206 inline TInt CDbStoreRecords::Count() const
   207 	{
   208 	return iToken.iCount;
   209 	}
   210 
   211 // Class CDbStoreTable
   212 inline const CDbStoreDef& CDbStoreTable::Def() const
   213 	{
   214 	return STATIC_CAST(const CDbStoreDef&,CDbTable::Def());
   215 	}
   216 	
   217 inline CDbStoreDatabase& CDbStoreTable::Database()
   218 	{
   219 	return STATIC_CAST(CDbStoreDatabase&,CDbTable::Database());
   220 	}
   221 	
   222 inline CDbStoreRecords& CDbStoreTable::StoreRecordsL()
   223 	{
   224 	return STATIC_CAST(CDbStoreRecords&,CDbTable::RecordsL());
   225 	}
   226 	
   227 
   228 // Class CDbStoreCompression
   229 inline void CDbStoreCompression::Inflate()
   230 	{
   231 	__ASSERT(iState==EDecoding);
   232 	iState=EInflating;
   233 	}
   234