persistentstorage/dbms/ustor/US_STD.INL
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     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 // Class CDbStoreDatabase
       
    17 inline CStreamStore& CDbStoreDatabase::Store()
       
    18 	{
       
    19 	return *iStore;
       
    20 	}
       
    21 	
       
    22 inline MDbStreamFilter* CDbStoreDatabase::Filter()
       
    23 	{
       
    24 	return iFilter;
       
    25 	}
       
    26 
       
    27 // Class TDbStoreIndexStats
       
    28 inline TDbStoreIndexStats::TDbStoreIndexStats() :
       
    29 	iRefresh(EInvalid),
       
    30 	iFlags(0)
       
    31 	{
       
    32 	}
       
    33 	
       
    34 inline TBool TDbStoreIndexStats::IsValid() const
       
    35 	{
       
    36 	return iRefresh>=ERefresh;
       
    37 	}
       
    38 
       
    39 // Class CDbStoreIndexDef
       
    40 inline void CDbStoreIndexDef::SetTokenId(TStreamId anId)
       
    41 	{
       
    42 	iTokenId=anId;
       
    43 	}
       
    44 	
       
    45 inline TStreamId CDbStoreIndexDef::TokenId() const
       
    46 	{
       
    47 	return iTokenId;
       
    48 	}
       
    49 
       
    50 // Class TRecordSize
       
    51 inline TInt TRecordSize::Clustering() const
       
    52 	{
       
    53 	return iClustering;
       
    54 	}
       
    55 	
       
    56 inline TInt TRecordSize::InlineLimit() const
       
    57 	{
       
    58 	return iInlineLimit;
       
    59 	}
       
    60 	
       
    61 inline TInt TRecordSize::FixedFieldSize(TDbColType aType)
       
    62 	{
       
    63 	__ASSERT(aType>EDbColBit&&aType<EDbColText8);
       
    64 	return FieldSizes[aType];
       
    65 	}
       
    66 
       
    67 // Class CDbStoreDef
       
    68 inline void CDbStoreDef::SetTokenId(TStreamId anId)
       
    69 	{
       
    70 	iTokenId=anId;
       
    71 	}
       
    72 	
       
    73 inline TStreamId CDbStoreDef::TokenId() const
       
    74 	{
       
    75 	return iTokenId;
       
    76 	}
       
    77 	
       
    78 inline TInt CDbStoreDef::Clustering() const
       
    79 	{
       
    80 	return iInfo.Clustering();
       
    81 	}
       
    82 	
       
    83 inline TInt CDbStoreDef::InlineLimit() const
       
    84 	{
       
    85 	return iInfo.InlineLimit();
       
    86 	}
       
    87 	
       
    88 // Class TClusterId
       
    89 inline TClusterId ClusterId(TDbRecordId aRecordId)
       
    90 	{
       
    91 	return aRecordId.Value()>>4;
       
    92 	}
       
    93 	
       
    94 inline TInt RecordIndex(TDbRecordId aRecordId)
       
    95 	{
       
    96 	return aRecordId.Value()&0xfu;
       
    97 	}
       
    98 	
       
    99 inline TDbRecordId RecordId(TClusterId aId,TInt aIndex)
       
   100 	{
       
   101 	__ASSERT(TUint(aIndex)<16u);
       
   102 	return (aId<<4)+aIndex;
       
   103 	}
       
   104 	
       
   105 inline TClusterId ClusterId(TStreamId aStreamId)
       
   106 	{
       
   107 	return aStreamId.Value();
       
   108 	}
       
   109 	
       
   110 // Class RClusterMap
       
   111 inline RClusterMap::RClusterMap()
       
   112 	{
       
   113 	__ASSERT(iMap==0 && iAlloc==0);
       
   114 	}
       
   115 	
       
   116 inline void RClusterMap::Close()
       
   117 	{
       
   118 	User::Free(iMap);
       
   119 	}
       
   120 	
       
   121 inline TClusterId RClusterMap::LastBound() const
       
   122 	{
       
   123 	return iLastBound;
       
   124 	}
       
   125 	
       
   126 inline void RClusterMap::Complete(TClusterId aLastCluster)
       
   127 	{
       
   128 	if (aLastCluster==iLastBound) 
       
   129 		{
       
   130 		iComplete=ETrue;
       
   131 		}
       
   132 	}
       
   133 	
       
   134 inline TBool RClusterMap::IsComplete() const
       
   135 	{
       
   136 	return iComplete;
       
   137 	}
       
   138 	
       
   139 inline void RClusterMap::BindL(TClusterId aPrevious,TClusterId aCluster)
       
   140 	{
       
   141 	if (aPrevious==iLastBound) 
       
   142 		{
       
   143 		AddL(aCluster);
       
   144 		}
       
   145 	}
       
   146 		
       
   147 // Class TClusterLinkCache
       
   148 inline void TClusterLinkCache::Invalidate()
       
   149 	{
       
   150 	iEnd=NULL;
       
   151 	}
       
   152 	
       
   153 void TClusterLinkCache::Reset(TClusterId aBaseId)
       
   154 	{
       
   155 	*(iEnd=iMap)=aBaseId;
       
   156 	}
       
   157 	
       
   158 inline void TClusterLinkCache::Bind(TClusterId aPrevious,TClusterId aCluster,RClusterMap& aMap)
       
   159 	{
       
   160 	if (iEnd!=NULL && *iEnd==aPrevious) 
       
   161 		{
       
   162 		Add(aCluster,aMap);
       
   163 		}
       
   164 	}
       
   165 		
       
   166 // Class CCluster
       
   167 inline CCluster::CCluster(CDbStoreDatabase& aDatabase) : 
       
   168 	iDatabase(aDatabase)
       
   169 	{
       
   170 	}
       
   171 	
       
   172 inline TBool CCluster::IsFull() const
       
   173 	{
       
   174 	return iMap[KMaxClustering]-iMap[0]>=KClusterLimit;
       
   175 	}
       
   176 	
       
   177 inline TClusterId CCluster::Id() const
       
   178 	{
       
   179 	return iCluster;
       
   180 	}
       
   181 	
       
   182 inline const TClusterDes& CCluster::Des() const
       
   183 	{
       
   184 	return iDes;
       
   185 	}
       
   186 	
       
   187 // Class CClusterCache
       
   188 inline CDbStoreDatabase& CClusterCache::Database()
       
   189 	{
       
   190 	return iDatabase;
       
   191 	}
       
   192 	
       
   193 inline CStreamStore& CClusterCache::Store()
       
   194 	{
       
   195 	return Database().Store();
       
   196 	}
       
   197 
       
   198 // Class CDbStoreRecords
       
   199 inline TClusterId CDbStoreRecords::Head() const
       
   200 	{
       
   201 	return iToken.iHead;
       
   202 	}
       
   203 	
       
   204 inline TInt CDbStoreRecords::Count() const
       
   205 	{
       
   206 	return iToken.iCount;
       
   207 	}
       
   208 
       
   209 // Class CDbStoreTable
       
   210 inline const CDbStoreDef& CDbStoreTable::Def() const
       
   211 	{
       
   212 	return STATIC_CAST(const CDbStoreDef&,CDbTable::Def());
       
   213 	}
       
   214 	
       
   215 inline CDbStoreDatabase& CDbStoreTable::Database()
       
   216 	{
       
   217 	return STATIC_CAST(CDbStoreDatabase&,CDbTable::Database());
       
   218 	}
       
   219 	
       
   220 inline CDbStoreRecords& CDbStoreTable::StoreRecordsL()
       
   221 	{
       
   222 	return STATIC_CAST(CDbStoreRecords&,CDbTable::RecordsL());
       
   223 	}
       
   224 	
       
   225 
       
   226 // Class CDbStoreCompression
       
   227 inline void CDbStoreCompression::Inflate()
       
   228 	{
       
   229 	__ASSERT(iState==EDecoding);
       
   230 	iState=EInflating;
       
   231 	}
       
   232