landmarks/locationlandmarks/localaccess/inc/EPos_CPosLmLocalGetSortedIdsOp.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 01:06:48 +0200
changeset 0 667063e416a2
permissions -rw-r--r--
Revision: 201003 Kit: 201005

/*
* Copyright (c) 2007 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: Operation for reading partial landmarks.
*
*
*/

#ifndef EPOS_CPOSLMLOCALGETSORTEDIDSOP_H_
#define EPOS_CPOSLMLOCALGETSORTEDIDSOP_H_

#include "EPos_CPosLmLocalOperation.h"
#include <EPos_Landmarks.h>

class CPosLandmark;
class CPosLmLocalDatabase;
class CPosLmPartialReadParameters;

/**
* Operation for reading partial landmarks. This operation can be
* either synchronous or asynchronous.
*/
NONSHARABLE_CLASS(CPosLmLocalGetSortedIdsOp) : public CPosLmLocalOperation
    {

    public:  // Constructors and destructor

        /**
        * Two-phased constructor.
        * @param aDb A landmark database.
        * @param aSortPref Sorting preference
        */
        static CPosLmLocalGetSortedIdsOp* NewL(
            CPosLmLocalDatabase& aDb,
            TPosLmSortPref aSortPref );

        virtual ~CPosLmLocalGetSortedIdsOp();

    public: // From CPosLmLocalOperation

        /** Synchronous incremental execution of the operation. Performs a single
        * step of the operation synchronously.
        *
        * Leaves with an error code if something goes wrong.
        *
        * @param[out] aProgress Will be set to the progress of the operation when
        * the step has finished.
        * @return @p KPosLmOperationNotComplete if the step has completed but
        *   more steps are needed before the operation has finished,
        *   @p KErrNone if the operation has finished successfully.
        */
        TInt NextStepL( TReal32& aProgress );

        /** Handles any error generated by NextStepL. Will be called when
        * NextStepL leaves. The error code is allowed to be changed, if
        * necessary.
        *
        * @param[in,out] aError An error code generated by NextStepL.
        */
        void HandleError( TInt& aError );

    public:     // New functions

        /** Fills given array with landmark IDs. */
        void GetResultL( RArray<TPosLmItemId>& aIdArray );

    private:

        /**
        * C++ default constructor.
        * @param aDb A landmark db.
        */
        CPosLmLocalGetSortedIdsOp( CPosLmLocalDatabase& aDb, TPosLmSortPref aSortPref );

        void ConstructL();

        void ReadInfoFromResourceFileL();

        // Prohibit copy constructor if not deriving from CBase.
        CPosLmLocalGetSortedIdsOp(
            const CPosLmLocalGetSortedIdsOp&);
        // Prohibit assigment operator if not deriving from CBase.
        CPosLmLocalGetSortedIdsOp& operator=(
            const CPosLmLocalGetSortedIdsOp&);


    private:    // Data

        TPosLmSortPref iSortPref;
        CArrayFixSeg<TPosLmItemId>* iIdArray;

        TInt iStatusFlag;
        TInt iCurrent;
        TInt iIdBatchSize;
    };

#endif /*EPOS_CPOSLMLOCALGETSORTEDIDSOP_H_*/