sl@0: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: // Class CStreamStore sl@0: inline TStreamId CStreamStore::ExtendL() sl@0: /** Generates a new stream within this store, and returns its id. This function sl@0: can be used to create a new stream in advance of being written to. sl@0: sl@0: This function is not supported by the direct file store, CDirectFileStore. sl@0: sl@0: @return The stream id for the newly generated stream. sl@0: @see CDirectFileStore */ sl@0: {return DoExtendL();} sl@0: inline void CStreamStore::CommitL() sl@0: /** Commit changes and leaves if unsuccessful. sl@0: sl@0: @see CStreamStore::Commit() */ sl@0: {DoCommitL();} sl@0: inline void CStreamStore::RevertL() sl@0: /** Rolls back the store to its state at the last commit point and leaves if unsuccessful. sl@0: sl@0: The function is not supported by the direct file store CDirectFileStore and sl@0: the non-persistent in-memory store CBufStore. sl@0: sl@0: @see CDirectFileStore sl@0: @see CBufStore */ sl@0: {DoRevertL();} sl@0: sl@0: // Class CPersistentStore sl@0: inline CPersistentStore::CPersistentStore() sl@0: // : iRoot(KNullStreamId) sl@0: {} sl@0: inline TStreamId CPersistentStore::Root() const sl@0: /** Returns the stream id of the root stream. sl@0: sl@0: @return The id of the root stream. */ sl@0: {return iRoot;} sl@0: inline void CPersistentStore::SetRootL(TStreamId anId) sl@0: /** Sets the specified stream as the root stream. sl@0: sl@0: @param anId The id of the stream which is to be the root stream of this store. */ sl@0: {DoSetRootL(anId);} sl@0: sl@0: // Class RStoreReclaim sl@0: inline RStoreReclaim::RStoreReclaim() sl@0: : iCol(NULL) sl@0: {} sl@0: inline void RStoreReclaim::Close() sl@0: /** Stops space reclamation or compaction. All allocated resources are freed. sl@0: sl@0: Notes: sl@0: sl@0: If a cleanup item was placed on the cleanup stack when the RStoreReclaim object sl@0: was prepared for space reclamation or compaction (i.e. by a call to OpenLC() sl@0: or CompactLC()), then this function need not be called explicitly; clean up sl@0: is implicitly done by CleanupStack::PopAndDestroy(). sl@0: sl@0: The ResetL() member function can be used to restart abandoned space reclamation sl@0: or compaction activity. */ sl@0: {Release();} sl@0: inline TInt RStoreReclaim::Available() const sl@0: /** Returns the amount of free space currently available within the store. The sl@0: function may be called at any time during space reclamation or compaction. sl@0: sl@0: @return The amount of free space currently available within the store. */ sl@0: {return CONST_CAST(TPckgBuf&,iAvail)();} sl@0: sl@0: // Class CEmbeddedStore sl@0: inline TStreamPos CEmbeddedStore::Position(TStreamId anId) sl@0: /** Returns the position of the specified stream, within the host stream. sl@0: sl@0: @param anId The stream id of the stream in the embedded store whose position sl@0: within the host stream is to be returned. sl@0: @return The position of the stream with id anId within the host stream. */ sl@0: {return TStreamPos(anId.Value());} sl@0: inline void CEmbeddedStore::Reattach(MStreamBuf* aHost) sl@0: /** Takes ownership of the specified stream buffer. On return from this function, sl@0: the embedded store assumes this to be the host stream buffer. sl@0: sl@0: @param aHost A pointer to the stream buffer over which the embedded store sl@0: is to take ownership. */ sl@0: {iHost.Share(aHost);} sl@0: inline MStreamBuf* CEmbeddedStore::Host() const sl@0: /** Returns a pointer to the stream buffer which is acting as host to this embedded sl@0: store. The embedded store retains ownership of the host stream buffer. sl@0: sl@0: @return A pointer to the stream buffer which is host to this embedded store. */ sl@0: {return MUTABLE_CAST(TStreamExchange&,iHost).Host();} sl@0: inline TStreamPos CEmbeddedStore::Start() const sl@0: /** Returns the start position of this embedded store within the host stream. sl@0: sl@0: @return The position of the this embedded store within the host stream. */ sl@0: {return iStart;} sl@0: sl@0: // Class RDictionaryWriteStream sl@0: inline RDictionaryWriteStream::RDictionaryWriteStream(const MExternalizer& anExter) sl@0: : RWriteStream(anExter) sl@0: /** Constructs the object with an externaliser. The store map CStoreMap is an example sl@0: of an externaliser. sl@0: sl@0: @param anExter Specifies an externaliser. sl@0: @see CStoreMap */ sl@0: {} sl@0: sl@0: // Class TStorePagePoolToken sl@0: inline TStorePagePoolToken::TStorePagePoolToken(TEmpty) sl@0: : iHead(KNullStreamId),iAvail(KNullPageRef) sl@0: /** Constructor that intialises the TStorePagePoolToken for an empty page pool. sl@0: sl@0: @param Intialises for an empty page pool */ sl@0: {} sl@0: inline void TStorePagePoolToken::Touch() sl@0: /** Sets the available pages to 0. */ sl@0: {iAvail=KNullPageRef;} sl@0: inline TBool TStorePagePoolToken::HasAvailable() const sl@0: /** Tests if there is a free page in the pool. sl@0: sl@0: @return True if there is a free page in the pool, otherwise false */ sl@0: {return iAvail!=KNullPageRef;} sl@0: inline TBool TStorePagePoolToken::IsEmpty() const sl@0: /** Tests if the page pool is empty. sl@0: sl@0: @return True if the page pool is empty, otherwise false. */ sl@0: {return iHead==KNullStreamId;} sl@0: sl@0: // Class RStorePagePool sl@0: inline void RStorePagePool::Release() sl@0: /** Purges the page cache and stops using the stream store. */ sl@0: {Purge();iStore=NULL;} sl@0: inline TBool RStorePagePool::IsDirty() const sl@0: /** Tests if the dirty flag has been set on the page pool. sl@0: sl@0: @return True if the dirty flag has been set, otherwise false */ sl@0: {return iDirty;} sl@0: inline void RStorePagePool::MarkCurrent() sl@0: /** Clears the dirty flag. */ sl@0: {iDirty=EFalse;} sl@0: inline void RStorePagePool::MarkDirty() sl@0: /** Sets the dirty flag on the pool. */ sl@0: {iDirty=ETrue;} sl@0: inline TBool RStorePagePool::HasAvailable() const sl@0: /** Tests if there is a free page in the pool. sl@0: sl@0: @return True if there is a free page in the pool, otherwise false */ sl@0: {return iAvail!=KNullPageRef;} sl@0: inline void RStorePagePool::Discard() sl@0: /** Invalidates the list of free pages in the reclaimable set. sl@0: sl@0: This should be done if there has been a failure in updating the BTree, as sl@0: this list is possibly corrupt now. The reclaimable set can be deleted using sl@0: ReclaimAllL(), and the BTree then repaired. */ sl@0: {iAvail=KNullPageRef;} sl@0: inline TBool RStorePagePool::IsEmpty() const sl@0: /** Tests if the page pool is empty. sl@0: sl@0: @return True if the page pool is empty, otherwise false */ sl@0: {return iHead==KNullStreamId;} sl@0: sl@0: // Class MIncrementalCollector sl@0: inline void MIncrementalCollector::Close() sl@0: /** Closes the collector after it is no longer required. The object should not sl@0: be referenced after calling this function. The semantics for this function sl@0: and Release() are effectively the same. */ sl@0: {DoRelease();} sl@0: inline void MIncrementalCollector::Release() sl@0: /** Releases the collector after it is no longer required. The object should not sl@0: be referenced after calling this function. The semantics for this function sl@0: and Close() are effectively the same. sl@0: sl@0: @see DoRelease() */ sl@0: {DoRelease();} sl@0: inline void MIncrementalCollector::ResetL(TInt& aCount) sl@0: /** Resets the collector. This leaves the collector in a state ready to start or sl@0: restart reclaiming/compacting. On return aCount contains a value that can sl@0: be used to determine the progress of the operation the same value should sl@0: be passed in to subsequent calls to NextL() until it reaches 0. sl@0: sl@0: @param aCount A progress count for the reclamation/compaction process. sl@0: @see DoResetL() */ sl@0: {DoResetL(aCount);} sl@0: inline void MIncrementalCollector::NextL(TInt& aStep,TInt& aTotal) sl@0: /** Does the next step in the reclaim synchronously. sl@0: sl@0: aStep contains a progress value, which decreases every time the function is sl@0: called. aTotal contains the running total of free-space that remains in the sl@0: store. sl@0: sl@0: @param aStep The progress value from either the last NextL() increment of sl@0: from ResetL() if the reclamation/compaction was restarted. On return, sl@0: contains the new progress value, which can be used in subsequent calls to sl@0: NextL(). This will be equal to, or less than, the previous value a zero sl@0: value indicates that the operation is complete. sl@0: @param aTotal On return, contains the total amount of free space in the store. sl@0: This should increase every time the function is called. sl@0: @see DoNextL() */ sl@0: {DoNextL(aStep,aTotal);} sl@0: inline void MIncrementalCollector::NextL(TPckgBuf& aStep,TRequestStatus& aStatus,TPckgBuf& aTotal) sl@0: /** Does the next step in the reclaim asynchronously. sl@0: sl@0: aStep contains a progress value, which decreases every time the function is sl@0: called. aTotal contains the running total of free-space that remains in the sl@0: store. These parameters are asynchronous equivalents of the other NextL() sl@0: overload. sl@0: sl@0: @param aStep The progress value from either the last NextL() increment of sl@0: from ResetL() if the reclamation/compaction was restarted. On return, sl@0: contains the new progress value, which can be used in subsequent calls to sl@0: NextL(). This will be equal to, or less than, the previous value a zero sl@0: value indicates that the operation is complete. sl@0: @param aStatus A status variable. KErrNone on successful completion, otherwise sl@0: another of the system-wide error codes. sl@0: @param aTotal On return, contains the total amount of free space in the store. sl@0: This should increase every time the function is called. sl@0: @see DoNextL() */ sl@0: {DoNextL(aStep,aStatus,aTotal);} sl@0: