diff -r 000000000000 -r 08ec8eefde2f persistentstorage/dbms/Inc2/D32Map.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/dbms/Inc2/D32Map.h Fri Jan 22 11:06:30 2010 +0200 @@ -0,0 +1,86 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// RMap template class declaration. +// +// + +#ifndef __D32MAP_H__ +#define __D32MAP_H__ + +#include "D32Assert.h" + +/** +(KEY, DATA) template pair class used by RMap template class. +@internalComponent +*/ +template +struct TPair + { + TPair(const KEY& aKey, const DATA& aData); + TPair(const KEY& aKey); + TPair(); + KEY iKey; + DATA iData; + }; + +//Forward declaration +template class RMap; + +/** +TMapIterator class. It describes an object which can be used as a +forward read-only iterator for sequence of type RMap. +@internalComponent +*/ +template +class TMapIterator + { +public: + TMapIterator(const RMap& aMap); + void Reset(); + TBool Next(TPair& aPair) const; +private: + const RMap& iMap; + mutable TInt iIndex; + }; + +/** +RMap template class describes an object that controls an ordered sequence of entries. +Each entry has a key of type KEY and an associated with it data of type DATA. +No entries with duplicated keys are allowed. +The algorithm for determining the order of two entries is provided by a TLinearOrder +object, supplied by the client of RMap during RMap instance construction. +@internalComponent +*/ +template +class RMap + { + friend class TMapIterator; +public: + RMap(const TLinearOrder< TPair >& aOrder); + void Close(); + TInt Insert(const KEY& aKey, const DATA& aData); + void Remove(const KEY& aKey); + const DATA& operator[](const KEY& aKey) const; + TInt Find(const KEY& aKey, DATA& aData) const; + TInt Count() const; + +private: + TLinearOrder< TPair > iOrder; + RArray< TPair > iCol; + + }; + +#include "D32Map.inl" + +#endif//__D32MAP_H__