1.1 --- a/epoc32/include/s32btree.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/s32btree.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,504 @@
1.4 -s32btree.h
1.5 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +#if !defined(__S32BTREE_H__)
1.21 +#define __S32BTREE_H__
1.22 +#if !defined(__S32PAGE_H__)
1.23 +#include <s32page.h>
1.24 +#endif
1.25 +
1.26 +const TInt KMaxBtreeHeight=16;
1.27 +/** Maximum length for a B-tree key. */
1.28 +const TInt KMaxBtreeKeyLength=255;
1.29 +//
1.30 +typedef TInt TBtreeHeight;
1.31 +/** Buffer to store the result of MBtreeKey::Between(). */
1.32 +typedef TBuf8<KMaxBtreeKeyLength> TBtreePivot;
1.33 +//
1.34 +enum TBtreeMode {EBtreeSecure,EBtreeFast};
1.35 +
1.36 +/**
1.37 + * @publishedAll
1.38 + * @released
1.39 + * Encapsulates the persistent parameters for a TBtree.
1.40 +*/
1.41 +class TBtreeToken
1.42 + {
1.43 +public:
1.44 +/** Provides a TBtreeToken initialisation flag. */
1.45 + enum TEmpty {EEmpty};
1.46 +public:
1.47 + /** Default constuctor. */
1.48 + TBtreeToken() {}
1.49 + inline TBtreeToken(TEmpty);
1.50 + inline void Touch();
1.51 +//
1.52 + inline TBool IsBroken() const;
1.53 + inline TBool IsIntact() const;
1.54 + inline TBool IsEmpty() const;
1.55 +//
1.56 + IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
1.57 + IMPORT_C void InternalizeL(RReadStream& aStream);
1.58 +protected:
1.59 + IMPORT_C void Clear();
1.60 +private:
1.61 + inline TBtreeToken(TPageRef aFirst,TPageRef aRoot,TBtreeHeight aHeight);
1.62 +private:
1.63 + TPageRef iFirst;
1.64 + TPageRef iRoot;
1.65 + TBtreeHeight iHeight;
1.66 +private:
1.67 + friend class TBtree;
1.68 + };
1.69 +#define KEmptyBtreeToken TBtreeToken(TBtreeToken::EEmpty)
1.70 +
1.71 +/**
1.72 + * @publishedAll
1.73 + * @released
1.74 + */
1.75 +class TBtreePath
1.76 + {
1.77 +public:
1.78 + inline TBtreePath();
1.79 + inline TPageRef Node() const;
1.80 + inline TInt Entry() const;
1.81 + inline TBool IsLeaf() const;
1.82 + inline TBtreeHeight End() const;
1.83 + inline void SetEntry(TInt aEntry);
1.84 + void GotoRoot(TBtreeHeight aHeight,TPageRef aRoot);
1.85 + void Push(TPageRef aRef,TInt aEntry=0);
1.86 + inline void Pop();
1.87 +private:
1.88 + TBtreeHeight iEnd;
1.89 + TPageRef iNodes[KMaxBtreeHeight];
1.90 + TUint8 iEntries[KMaxBtreeHeight];
1.91 + TUint8 iLasts[KMaxBtreeHeight];
1.92 + };
1.93 +
1.94 +/**
1.95 + * @publishedAll
1.96 + * @released
1.97 + * Identifies a position in a B-tree.
1.98 +
1.99 +The class has no public members. Clients use it by getting TBtreePos objects
1.100 +from some TBtree functions, and passing them into others.
1.101 +*/
1.102 +class TBtreePos
1.103 + {
1.104 +private:
1.105 + TBtreePath iPath;
1.106 +private:
1.107 + friend class TBtree;
1.108 + };
1.109 +
1.110 +/**
1.111 + * @publishedAll
1.112 + * @released
1.113 + * An iterator for a B-tree.
1.114 +
1.115 +Functions that use a TBtreeMark are faster than those that use a TBtreePos,
1.116 +and can be used with a broken B-tree.
1.117 +
1.118 +The class has no public members. Clients use it by getting TBtreeMark objects
1.119 +from some TBtree functions, and passing them into others.
1.120 +*/
1.121 +class TBtreeMark
1.122 + {
1.123 +private:
1.124 + TPageRef iLeaf;
1.125 + TPageRef iLink;
1.126 + TUint8 iEntry;
1.127 + TUint8 iLast;
1.128 +private:
1.129 + friend class TBtree;
1.130 + };
1.131 +
1.132 +/**
1.133 + * @publishedAll
1.134 + * @released
1.135 + * Interface for ordering and creating keys for entries in a B-tree.
1.136 +
1.137 +Derived classes implement this interface for particular types of key.
1.138 +*/
1.139 +class MBtreeKey
1.140 + {
1.141 +public:
1.142 + virtual IMPORT_C const TAny* Key(const TAny* anEntry) const;
1.143 +
1.144 + /** Orders two keys.
1.145 +
1.146 + @param aLeft Pointer to first key
1.147 + @param aRight Pointer to second key
1.148 + @return Positive, if the first key is after the second key; negative, if
1.149 + the first key is before the second key; zero, if the keys are equal */
1.150 + virtual TInt Compare(const TAny* aLeft,const TAny* aRight) const=0;
1.151 +
1.152 + /** Gets the midpoint between two keys.
1.153 +
1.154 + The generated midpoint will be greater or equal to aLeft (by a comparison
1.155 + performed by the Compare() function), and less than aRight.
1.156 +
1.157 + @param aLeft First key
1.158 + @param aRight Second key
1.159 + @param aPivot On return, the midpoint between the two keys */
1.160 + virtual void Between(const TAny* aLeft,const TAny* aRight,TBtreePivot& aPivot) const=0;
1.161 + };
1.162 +
1.163 +class MBtreeNodeOrg;
1.164 +class MBtreeLeafOrg;
1.165 +class MBtreeIndexOrg;
1.166 +
1.167 +/**
1.168 + * @publishedAll
1.169 + * @released
1.170 + * Provides ordering of entries by key value in a B+-tree (balanced tree)
1.171 +structure.
1.172 +
1.173 +Entries and keys are handled as untyped TAny* parameters. You specify an entry
1.174 +in the tree to manipulate through a position (TBtreePos) variable. You can
1.175 +also use iterator functions, which take a TBtreeMark, to move through entries
1.176 +in the tree. The tree's settings can be persisted using a TBtreeToken.
1.177 +
1.178 +To use this class, you must provide a page pool, based on MPagePool, in which
1.179 +to store entries in the tree, and a key handler, based on MBtreeKey, to provide
1.180 +order and keys.
1.181 +
1.182 +@see MBtreeKey
1.183 +@see MPagePool
1.184 +@see TBtreeMark
1.185 +@see TBtreePos
1.186 +@see TBtreeToken
1.187 +*/
1.188 +class TBtree
1.189 + {
1.190 +public:
1.191 +/** Sets the condition for a successful match when calling TBtree::Find(). */
1.192 + enum TFind {
1.193 + /** Find the first entry greater than or equal to the search target. */
1.194 + EGreaterEqual,
1.195 + /** Find the first entry equal to the search target. */
1.196 + EEqualTo,
1.197 + /** Find the last entry less than the search target. */
1.198 + ELessThan,
1.199 + /** Find the first entry greater than the search target. */
1.200 + EGreaterThan,
1.201 + /** Find the last entry less than or equal to the search target. */
1.202 + ELessEqual};
1.203 +public:
1.204 + IMPORT_C TBtree(TBtreeMode aMode);
1.205 + IMPORT_C TBtree(const TBtreeToken& aToken,TBtreeMode aMode);
1.206 + IMPORT_C void Connect(MPagePool* aPool,const MBtreeKey* aKey,const MBtreeLeafOrg* aLeafOrg,const MBtreeIndexOrg* anIndexOrg);
1.207 + IMPORT_C void Set(const TBtreeToken& aToken,TBtreeMode aMode);
1.208 + IMPORT_C TBtreeToken Token() const;
1.209 +//
1.210 + inline TBool IsDirty() const;
1.211 + inline void MarkCurrent();
1.212 + inline void MarkDirty();
1.213 +//
1.214 + inline TBool IsBroken() const;
1.215 + inline TBool IsIntact() const;
1.216 + inline void MarkBroken();
1.217 + IMPORT_C TInt RepairL();
1.218 +//
1.219 + inline TBool IsEmpty() const;
1.220 + IMPORT_C void ClearL();
1.221 +//
1.222 + IMPORT_C TBool FirstL(TBtreePos& aPos) const;
1.223 + IMPORT_C TBool LastL(TBtreePos& aPos) const;
1.224 + IMPORT_C TBool NextL(TBtreePos& aPos) const;
1.225 + IMPORT_C TBool PreviousL(TBtreePos& aPos) const;
1.226 +//
1.227 + IMPORT_C TBool FindL(TBtreePos& aPos,const TAny* aKey,TFind aMode=EEqualTo) const;
1.228 + IMPORT_C TBool InsertL(TBtreePos& aPos,const TAny* anEntry,TInt aLength,TAllowDuplicates aDup=ENoDuplicates);
1.229 + IMPORT_C TBool DeleteL(const TAny* aKey);
1.230 + IMPORT_C void DeleteAtL(TBtreePos& aPos);
1.231 + IMPORT_C void ExtractAtL(const TBtreePos& aPos,TAny* anEntry,TInt aMaxLength) const;
1.232 +//
1.233 + IMPORT_C TBool ResetL(TBtreeMark& aMark) const;
1.234 + IMPORT_C TBool NextL(TBtreeMark& aMark) const;
1.235 + IMPORT_C void ExtractAtL(const TBtreeMark& aMark,TAny* anEntry,TInt aMaxLength) const;
1.236 +private:
1.237 + TBool AscendAtLastL(TBtreePath& aPath) const;
1.238 + TBool AscendAtFirstL(TBtreePath& aPath) const;
1.239 + void DescendFirstL(TBtreePath& aPath) const;
1.240 + void DescendLastL(TBtreePath& aPath) const;
1.241 +//
1.242 + TBool SearchL(TBtreePath& aPath,const TAny* aKey,TBool aAfter=EFalse) const;
1.243 + void NewPivot(const TAny* aLeftNode,const TAny* aRightNode,TBtreePivot& aPivot) const;
1.244 + void ReplacePivotL(TBtreePath& aPath,TAny* aNode,TBtreePivot& aPivot);
1.245 + void InsertAtL(TBtreePath& aPath,const TDesC8& anEntry);
1.246 + void InsertAtL(TBtreePath& aPath,TBtreePivot& aPivot,TPageRef aChild);
1.247 + TBool InsertAtL(TBtreePath& aPath,const TDesC8& anEntry,TPageRef aChild,TBtreePivot& aPivot,TPageRef& aPromote);
1.248 + void DeleteAtL(TBtreePath& aPath);
1.249 + void DeleteIndexSetL();
1.250 + void DeleteIndexNodesL(TBtreePath& aPath,TBool aLeadingEdge);
1.251 +//
1.252 + void NewTreeL();
1.253 + void NewRootL();
1.254 +//
1.255 + void BeginUpdateL();
1.256 + void EndUpdate();
1.257 + inline void MarkIntact();
1.258 + void CheckIntactL() const;
1.259 +//
1.260 + inline TBool IsRoot(const TBtreePath& aPath) const;
1.261 + inline const MBtreeNodeOrg* NodeOrg(TBool aLeaf) const;
1.262 + void GotoRoot(TBtreePath& aPath) const;
1.263 +//
1.264 + TAny* GetNodeL(const TBtreePath& aPath) const;
1.265 + void PutNode(TAny* aNode,TBool aLeaf) const;
1.266 +//
1.267 + TInt LastEntryL(const TBtreePath& aPath) const;
1.268 + TPageRef ChildNodeL(const TBtreePath& aPath) const;
1.269 + TPageRef LastChildNodeL(TBtreePath& aPath) const;
1.270 + TPageRef ChildNodeL(TBtreePath& aPath,TInt aChild) const;
1.271 +private:
1.272 + enum {ESecure=EBtreeSecure,EFast=EBtreeFast,EBroken=0x40000000,EDirty=0x80000000};
1.273 +private:
1.274 + MPagePool* iPages;
1.275 + const MBtreeKey* iKey;
1.276 + const MBtreeLeafOrg* iLeafOrg;
1.277 + const MBtreeIndexOrg* iIndexOrg;
1.278 + TPageRef iFirst;
1.279 + TPageRef iRoot;
1.280 + TBtreeHeight iHeight;
1.281 + TInt iStatus;
1.282 + };
1.283 +
1.284 +/**
1.285 + * @publishedAll
1.286 + * @released
1.287 + */
1.288 +class MBtreeNodeOrg
1.289 + {
1.290 +public:
1.291 + virtual IMPORT_C void Init(TAny* aNode) const;
1.292 + virtual TInt LastEntry(const TAny* aNode) const=0;
1.293 + virtual TPtrC8 Entry(const TAny* aNode,TInt aPos) const=0;
1.294 + virtual const TAny* EntryPtr(const TAny* aNode,TInt aPos) const=0;
1.295 + virtual TBool Search(const TAny* aNode,const TAny* aKey,const MBtreeKey& aComp,TBool aLast,TInt& aPos) const=0;
1.296 + virtual TBool Delete(TAny* aNode,TInt aPos) const=0;
1.297 + };
1.298 +
1.299 +/**
1.300 + * @publishedAll
1.301 + * @released
1.302 + */
1.303 +class MBtreeLeafOrg : public MBtreeNodeOrg
1.304 + {
1.305 +public:
1.306 + IMPORT_C TBool Search(const TAny* aNode,const TAny* aKey,const MBtreeKey& aComp,TBool aLast,TInt& aPos) const;
1.307 + virtual TBool Insert(TAny* aNode,TInt aPos,const TDesC8& anEntry) const=0;
1.308 + virtual IMPORT_C TBool InsertOverflow(TAny* aLeftNode,TAny* aRightNode,TInt aPos,TBool aInsertOnLeft,const TDesC8& anEntry) const;
1.309 + virtual void InsertSplit(TAny* aLeftNode,TAny* aRightNode,TInt aPos,const TDesC8& anEntry) const=0;
1.310 + virtual TBool Redistribute(TAny* aLeftNode,TAny* aRightNode) const=0;
1.311 + virtual void Concatenate(TAny* aLeftNode,const TAny* aRightNode) const=0;
1.312 + virtual TPageRef LinkNode(const TAny* aNode) const=0;
1.313 + virtual void SetLinkNode(TAny* aNode,TPageRef aNextNode) const=0;
1.314 + };
1.315 +
1.316 +/**
1.317 + * @publishedAll
1.318 + * @released
1.319 + */
1.320 +class MBtreeIndexOrg : public MBtreeNodeOrg
1.321 + {
1.322 +public:
1.323 + IMPORT_C TBool Search(const TAny* aNode,const TAny* aKey,const MBtreeKey& aComp,TBool aLast,TInt& aPos) const;
1.324 + virtual TBool Insert(TAny* aNode,TInt aPos,const TDesC8& anEntry,TPageRef aChild) const=0;
1.325 + virtual IMPORT_C TBool InsertOverflow(TAny* aLeftNode,TAny* aRightNode,TInt aPos,TBool aInsertOnLeft,const TDesC8& anEntry,TPageRef aChild,const TDesC8& aPivot,TBtreePivot& aNewPivot) const;
1.326 + virtual void InsertSplit(TAny* aLeftNode,TAny* aRightNode,TInt aPos,const TDesC8& anEntry,TPageRef aChild,TBtreePivot& aPromote) const=0;
1.327 + virtual IMPORT_C TBool Update(TAny* aNode,TInt aPos,const TDesC8& anEntry) const;
1.328 + virtual TBool Redistribute(TAny* aLeftNode,TAny* aRightNode,const TDesC8& aPivot,TBtreePivot& aNewPivot) const=0;
1.329 + virtual void Concatenate(TAny* aLeftNode,const TAny* aRightNode,const TDesC8& aPivot) const=0;
1.330 + virtual void MakeRoot(TAny* aNode,TPageRef aChild) const=0;
1.331 + virtual TPageRef ChildNode(const TAny* aNode,TInt aPos) const=0;
1.332 + };
1.333 +
1.334 +/**
1.335 + * @publishedAll
1.336 + * @released
1.337 + */
1.338 +class TBtreeInlineLeafOrg : public MBtreeLeafOrg
1.339 + {
1.340 +public:
1.341 + IMPORT_C TBtreeInlineLeafOrg();
1.342 + IMPORT_C void SetEntrySize(TInt aSize);
1.343 +//
1.344 + IMPORT_C TInt LastEntry(const TAny* aNode) const;
1.345 + IMPORT_C TPtrC8 Entry(const TAny* aNode,TInt aPos) const;
1.346 + IMPORT_C const TAny* EntryPtr(const TAny* aNode,TInt aPos) const;
1.347 + IMPORT_C TBool Insert(TAny* aNode,TInt aPos,const TDesC8& anEntry) const;
1.348 + IMPORT_C TBool InsertOverflow(TAny* aLeftNode,TAny* aRightNode,TInt aPos,TBool aInsertOnLeft,const TDesC8& anEntry) const;
1.349 + IMPORT_C void InsertSplit(TAny* aLeftNode,TAny* aRightNode,TInt aPos,const TDesC8& anEntry) const;
1.350 + IMPORT_C TBool Delete(TAny* aNode,TInt aPos) const;
1.351 + IMPORT_C TBool Redistribute(TAny* aLeftNode,TAny* aRightNode) const;
1.352 + IMPORT_C void Concatenate(TAny* aLeftNode,const TAny* aRightNode) const;
1.353 + IMPORT_C TPageRef LinkNode(const TAny* aNode) const;
1.354 + IMPORT_C void SetLinkNode(TAny* aNode,TPageRef aNextNode) const;
1.355 +private:
1.356 + TAny* DoRedistribute(TAny* aLeftNode,TAny* aRightNode,TInt aInsertPos=-1) const;
1.357 + struct SHeader
1.358 + {
1.359 + TInt32 iCount;
1.360 + TPageRef iLink;
1.361 + };
1.362 + struct SNode
1.363 + {
1.364 + SHeader iHead;
1.365 + TUint8 iEntries[KPoolPageSize-sizeof(SHeader)];
1.366 + };
1.367 +private:
1.368 + inline static const SNode* Node(const TAny* aNode);
1.369 + inline static SNode* Node(TAny* aNode);
1.370 + inline const TUint8* Entry(const SNode* aNode,TInt anEntry) const;
1.371 + inline TUint8* Entry(SNode* aNode,TInt anEntry) const;
1.372 +private:
1.373 + TInt iEntrySize;
1.374 + TInt iMaxEntries;
1.375 + };
1.376 +
1.377 +/**
1.378 + * @publishedAll
1.379 + * @released
1.380 + */
1.381 +class TBtreeInlineIndexOrg : public MBtreeIndexOrg
1.382 + {
1.383 +public:
1.384 + IMPORT_C TBtreeInlineIndexOrg();
1.385 + IMPORT_C void SetEntrySize(TInt aSize);
1.386 +//
1.387 + IMPORT_C TBool Insert(TAny* aNode,TInt aPos,const TDesC8& anEntry,TPageRef aChild) const;
1.388 + IMPORT_C TBool InsertOverflow(TAny* aLeftNode,TAny* aRightNode,TInt aPos,TBool aInsertOnLeft,const TDesC8& anEntry,TPageRef aChild,const TDesC8& aPivot,TBtreePivot& aNewPivot) const;
1.389 + IMPORT_C void InsertSplit(TAny* aLeftNode,TAny* aRightNode,TInt aPos,const TDesC8& anEntry,TPageRef aChild,TBtreePivot& aPromote) const;
1.390 + IMPORT_C TBool Update(TAny* aNode,TInt aPos,const TDesC8& anEntry) const;
1.391 + IMPORT_C TBool Delete(TAny* aNode,TInt aPos) const;
1.392 + IMPORT_C TBool Redistribute(TAny* aLeftNode,TAny* aRightNode,const TDesC8& aPivot,TBtreePivot& aNewPivot) const;
1.393 + IMPORT_C void Concatenate(TAny* aLeftNode,const TAny* aRightNode,const TDesC8& aPivot) const;
1.394 +
1.395 + IMPORT_C void MakeRoot(TAny* aNode,TPageRef aChild) const;
1.396 + IMPORT_C TInt LastEntry(const TAny* aNode) const;
1.397 + IMPORT_C TPtrC8 Entry(const TAny* aNode,TInt aPos) const;
1.398 + IMPORT_C const TAny* EntryPtr(const TAny* aNode,TInt aPos) const;
1.399 + IMPORT_C TPageRef ChildNode(const TAny* aNode,TInt aPos) const;
1.400 +private:
1.401 + struct SEntry
1.402 + {
1.403 + TPageRef iChild;
1.404 + TUint8 iKey[4]; // at least four bytes of key
1.405 + };
1.406 + struct SHeader
1.407 + {
1.408 + TInt32 iCount;
1.409 + };
1.410 + struct SNode
1.411 + {
1.412 + SHeader iHead;
1.413 + TUint8 iEntries[KPoolPageSize-sizeof(SHeader)];
1.414 + };
1.415 + SNode* DoRedistribute(TAny* aLeftNode,TAny* aRightNode,const TDesC8& aPivot,TBtreePivot& aNewPivot,TInt aInsertPos=-1) const;
1.416 +private:
1.417 + inline static const SNode* Node(const TAny* aNode);
1.418 + inline static SNode* Node(TAny* aNode);
1.419 + inline const SEntry* Entry(const SNode* aNode,TInt anEntry) const;
1.420 + inline SEntry* Entry(SNode* aNode,TInt anEntry) const;
1.421 + inline TInt KeySize() const;
1.422 +private:
1.423 + TInt iEntrySize;
1.424 + TInt iMaxEntries;
1.425 + };
1.426 +
1.427 +/**
1.428 + * @publishedAll
1.429 + * @released
1.430 + */
1.431 +class TBtreeKey : public MBtreeKey
1.432 + {
1.433 +public:
1.434 + IMPORT_C TBtreeKey();
1.435 + IMPORT_C TBtreeKey(TInt aLength);
1.436 + IMPORT_C TBtreeKey(TInt anOffset,TKeyCmpText aType);
1.437 + IMPORT_C TBtreeKey(TInt anOffset,TKeyCmpText aType,TInt aLength);
1.438 + IMPORT_C TBtreeKey(TInt anOffset,TKeyCmpNumeric aType);
1.439 +//
1.440 + IMPORT_C const TAny* Key(const TAny* anEntry) const;
1.441 + IMPORT_C TInt Compare(const TAny* aLeft,const TAny* aRight) const;
1.442 + IMPORT_C void Between(const TAny* aLeft,const TAny* aRight,TBtreePivot& aPivot) const;
1.443 +protected:
1.444 + TInt iKeyOffset;
1.445 + TInt iCmpType;
1.446 + TInt iKeyLength;
1.447 + };
1.448 +
1.449 +/**
1.450 + * @publishedAll
1.451 + * @released
1.452 + * Base class for TBtreeFix, which provides a B-tree for fixed sized entries.
1.453 +*/
1.454 +class TBtreeFixBase : public TBtree
1.455 + {
1.456 +public:
1.457 + IMPORT_C void Connect(MPagePool* aPool,const MBtreeKey* aKey);
1.458 + IMPORT_C TBool InsertL(TBtreePos& aPos,const TAny* anEntry,TAllowDuplicates aDup=ENoDuplicates);
1.459 + IMPORT_C void ExtractAtL(const TBtreePos& aPos,TAny* anEntry) const;
1.460 + IMPORT_C void ExtractAtL(const TBtreeMark& aMark,TAny* anEntry) const;
1.461 +protected:
1.462 + IMPORT_C TBtreeFixBase(TBtreeMode aMode,TInt anEntrySize,TInt aKeySize);
1.463 + IMPORT_C TBtreeFixBase(const TBtreeToken& aToken,TBtreeMode aMode,TInt anEntrySize,TInt aKeySize);
1.464 +private:
1.465 + TInt iEntrySize;
1.466 + TBtreeInlineLeafOrg iLeafOrgFix;
1.467 + TBtreeInlineIndexOrg iIndexOrgFix;
1.468 + };
1.469 +
1.470 +/**
1.471 + * @publishedAll
1.472 + * @released
1.473 + * A B-tree for fixed-sized keys and entries.
1.474 +
1.475 +Entry is the type of entry to store. Key defines how items should be ordered:
1.476 +there must be a member of this type in the Entry class.
1.477 +*/
1.478 +template <class Entry,class Key>
1.479 +class TBtreeFix : public TBtreeFixBase
1.480 + {
1.481 +public:
1.482 + inline TBtreeFix(TBtreeMode aMode);
1.483 + inline TBtreeFix(const TBtreeToken& aToken,TBtreeMode aMode);
1.484 +//
1.485 + inline TBool FindL(TBtreePos& aPos,const Key& aKey,TFind aMode=EEqualTo) const;
1.486 + inline TBool InsertL(TBtreePos& aPos,const Entry& anEntry,TAllowDuplicates aDup=ENoDuplicates);
1.487 + inline TBool DeleteL(const Key& aKey);
1.488 +//
1.489 + inline Entry AtL(const TBtreePos& aPos) const;
1.490 + inline Entry AtL(const TBtreeMark& aMark) const;
1.491 + inline void ExtractAtL(const TBtreePos& aPos,Entry& anEntry) const;
1.492 + inline void ExtractAtL(const TBtreeMark& aMark,Entry& anEntry) const;
1.493 + };
1.494 +
1.495 +/**
1.496 + * @publishedAll
1.497 + * @released
1.498 + * A specialisation of the B-tree for untyped fixed sized items.
1.499 +*/
1.500 +TEMPLATE_SPECIALIZATION class TBtreeFix<TAny,TAny> : public TBtreeFixBase
1.501 + {
1.502 +public:
1.503 + inline TBtreeFix(TBtreeMode aMode,TInt anEntrySize,TInt aKeySize);
1.504 + inline TBtreeFix(const TBtreeToken& aToken,TBtreeMode aMode,TInt anEntrySize,TInt aKeySize);
1.505 + };
1.506 +
1.507 +#include <s32btree.inl>
1.508 +#endif