1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/store/UBTREE/UB_FIX.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,70 @@
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 "UB_STD.H"
1.20 +
1.21 +EXPORT_C TBtreeFixBase::TBtreeFixBase(TBtreeMode aMode,TInt anEntrySize,TInt aKeySize)
1.22 + : TBtree(aMode),iEntrySize(anEntrySize)
1.23 + {
1.24 + iLeafOrgFix.SetEntrySize(anEntrySize);
1.25 + iIndexOrgFix.SetEntrySize(aKeySize);
1.26 + }
1.27 +
1.28 +EXPORT_C TBtreeFixBase::TBtreeFixBase(const TBtreeToken& aToken,TBtreeMode aMode,TInt anEntrySize,TInt aKeySize)
1.29 + : TBtree(aToken,aMode),iEntrySize(anEntrySize)
1.30 + {
1.31 + iLeafOrgFix.SetEntrySize(anEntrySize);
1.32 + iIndexOrgFix.SetEntrySize(aKeySize);
1.33 + }
1.34 +
1.35 +EXPORT_C void TBtreeFixBase::Connect(MPagePool *aPool,const MBtreeKey *aKey)
1.36 +/** Initalises the B-tree with a page pool and key handler.
1.37 +
1.38 +@param aPool Page pool to provide storage for the B-tree
1.39 +@param aKey Key handler for the B-tree */
1.40 + {
1.41 + TBtree::Connect(aPool,aKey,&iLeafOrgFix,&iIndexOrgFix);
1.42 + }
1.43 +
1.44 +EXPORT_C TBool TBtreeFixBase::InsertL(TBtreePos& aPos,const TAny* anEntry,TAllowDuplicates aDup)
1.45 +/** Inserts an entry into the tree.
1.46 +
1.47 +@param aPos On return, the position of the entry inserted
1.48 +@param anEntry Pointer to the entry to insert
1.49 +@param aDup Flag to indicate whether duplicate entries are allowed in the tree
1.50 +@return True if successful, false if the entry was a duplicate and aDup was
1.51 +set to ENoDuplicates */
1.52 + {
1.53 + return TBtree::InsertL(aPos,anEntry,iEntrySize,aDup);
1.54 + }
1.55 +
1.56 +EXPORT_C void TBtreeFixBase::ExtractAtL(const TBtreePos& aPos,TAny* anEntry) const
1.57 +/** Gets the entry at the specified position.
1.58 +
1.59 +@param aPos Position of the entry to get
1.60 +@param anEntry Buffer into which to copy the entry. */
1.61 + {
1.62 + TBtree::ExtractAtL(aPos,anEntry,iEntrySize);
1.63 + }
1.64 +
1.65 +EXPORT_C void TBtreeFixBase::ExtractAtL(const TBtreeMark& aMark,TAny* anEntry) const
1.66 +/** Gets the entry at the specified iterator position.
1.67 +
1.68 +@param aMark Position of the entry to get
1.69 +@param anEntry Buffer into which to copy the entry. */
1.70 + {
1.71 + TBtree::ExtractAtL(aMark,anEntry,iEntrySize);
1.72 + }
1.73 +