filemanager/bkupengine/inc/CMMCScBkupArchiveDataManager.h
branchRCL_3
changeset 38 491b3ed49290
parent 36 95243422089a
child 39 65326cf895ed
equal deleted inserted replaced
36:95243422089a 38:491b3ed49290
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Declaration of CMMCScBkupArchiveDataManager
       
    15 *     
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __CMMCSCBKUPARCHIVEDATAMANAGER_H__
       
    20 #define __CMMCSCBKUPARCHIVEDATAMANAGER_H__
       
    21 
       
    22 // System includes
       
    23 #include <f32file.h>
       
    24 #include <s32strm.h>
       
    25 
       
    26 // User includes
       
    27 #include "CMMCScBkupBufferManagers.h"
       
    28 #include "MMMCScBkupArchiveDataInterface.h"
       
    29 #include "TMMCScBkupArchiveVector.h"
       
    30 #include "RMMCScBkupArchiveStreams.h"
       
    31 #include "MMCScBkupOperations.h"
       
    32 #include "MMCScBkupConfig.h"
       
    33 
       
    34 // Classes referenced
       
    35 class CEZCompressor;
       
    36 class CEZDecompressor;
       
    37 class RMMCScBkupArchiveBuf;
       
    38 class MMMCScBkupProgressObserver;
       
    39 
       
    40 
       
    41 /**
       
    42 *
       
    43 *
       
    44 * @since 3.0
       
    45 */
       
    46 NONSHARABLE_CLASS(CMMCScBkupArchiveDataManager) : public CActive, public MMMCScBkupArchiveDataInterface
       
    47     {
       
    48     public:
       
    49 
       
    50         /**
       
    51         * Static constructor
       
    52         */
       
    53         static CMMCScBkupArchiveDataManager* NewL( RFs& aFsSession, RFile64& aFile, MMMCScBkupProgressObserver& aProgressManager );
       
    54 
       
    55         /**
       
    56         * C++ destructor
       
    57         */
       
    58         ~CMMCScBkupArchiveDataManager();
       
    59 
       
    60     private:
       
    61 
       
    62         /**
       
    63         * C++ default constructor
       
    64         */
       
    65         CMMCScBkupArchiveDataManager( RFs& aFsSession, RFile64& aFile, MMMCScBkupProgressObserver& aProgressManager );
       
    66 
       
    67         /**
       
    68         *
       
    69         */
       
    70         void ConstructL();
       
    71 
       
    72     public: // API
       
    73 
       
    74         /**
       
    75         * Leaves on error, returns offset
       
    76         */
       
    77         TInt CurrentOffsetL() const;
       
    78 
       
    79         /**
       
    80         * Returns error or offset
       
    81         */
       
    82         TInt CurrentOffset() const;
       
    83 
       
    84     private: // For RMMCScBkupArchiveBuf only
       
    85    
       
    86         /**
       
    87         *
       
    88         */
       
    89         void SetCurrentVector(const TMMCScBkupArchiveVector& aInfo);
       
    90 
       
    91 
       
    92     private: // From MMMCScBkupArchiveDataInterface
       
    93         RFs& ADIFsSession() const;
       
    94         RFile64& ADIRawArchiveFile() const;
       
    95         //
       
    96         const TMMCScBkupArchiveVector& ADICurrentArchiveVectorInfo() const;
       
    97         const TMMCScBkupArchiveVector& ADIOverallArchiveVectorInfo() const;
       
    98         //
       
    99         RWriteStream& ADIWriteStreamUncompressedLC( TInt aPos );
       
   100         RReadStream& ADIReadStreamUncompressedLC( TInt aPos );
       
   101         //
       
   102         const TMMCScBkupArchiveVector& ADIWriteL( const TDesC8& aData );
       
   103         const TMMCScBkupArchiveVector& ADIReadL( TDes8& aSink, const TMMCScBkupArchiveVector& aInfo );
       
   104         //
       
   105         void ADIWriteFileL( const TDesC& aSourceFileName, TRequestStatus& aObserver );
       
   106         void ADIReadFileL( const TDesC& aDestinationFileName, const TMMCScBkupArchiveVector& aInfo, TRequestStatus& aStatus );
       
   107         //
       
   108         void ADIWriteCompressedL( const TDesC8& aData, TRequestStatus& aObserver );
       
   109         void ADIReadDecompressedL( TDes8& aSink, const TMMCScBkupArchiveVector& aInfo, TRequestStatus& aStatus ) ;
       
   110         //
       
   111         void ADIAsynchronousCancel();
       
   112         void ADIResetResources(TMMCScBkupOperationType aType);
       
   113 #ifdef RD_FILE_MANAGER_BACKUP
       
   114         void ADIActivateCrcCalculation(TBool aType) { iCrcCalcActivated = aType; }
       
   115         TUint32 ADIArchiveCrc() { return iCrc; }
       
   116 #endif
       
   117 
       
   118 
       
   119     private: // Internal enumerations
       
   120 
       
   121         /**
       
   122         *
       
   123         */
       
   124         enum TOperation
       
   125             {
       
   126             EOperationIdle = 0,
       
   127             EOperationCompressing,
       
   128             EOperationDecompressing
       
   129             };
       
   130     
       
   131     private: // Internal methods
       
   132 
       
   133         /**
       
   134         *
       
   135         */
       
   136         void EnsureCompressorExistsL(MEZBufferManager& aBufferManager);
       
   137 
       
   138         /**
       
   139         *
       
   140         */
       
   141         void EnsureDecompressorExistsL(MEZBufferManager& aBufferManager);
       
   142 
       
   143         /**
       
   144         *
       
   145         */
       
   146         void SetObserver(TRequestStatus& aStatus);
       
   147 
       
   148         /**
       
   149         *
       
   150         */
       
   151         void CompleteSelf(TInt aCompletionCode = KErrNone);
       
   152 
       
   153         /**
       
   154         *
       
   155         */
       
   156         void CompleteObserver(TInt aCompletionCode = KErrNone);
       
   157 
       
   158         /**
       
   159         *
       
   160         */
       
   161         void SetOperation(TOperation aOperation);
       
   162         
       
   163 #ifdef RD_FILE_MANAGER_BACKUP
       
   164         /**
       
   165         *
       
   166         */
       
   167         void CalculateCrc( const TAny* aPtr,TInt aLength );
       
   168 #endif
       
   169 
       
   170 
       
   171     private: // From CActive
       
   172         void RunL();
       
   173         void DoCancel();
       
   174         TInt RunError(TInt aError);
       
   175 
       
   176     private: // Member data
       
   177 
       
   178         // Owned externally:
       
   179         // 
       
   180         RFs& iFsSession;
       
   181         //
       
   182         RFile64& iFile;
       
   183         //
       
   184         MMMCScBkupProgressObserver& iProgressManager;
       
   185         //
       
   186         TRequestStatus* iObserverStatus;
       
   187 
       
   188         // Owned by this object
       
   189         //
       
   190         TOperation iOperation;
       
   191         //
       
   192         CMMCScBkupBufferManagerBase* iBufferManager;
       
   193         //
       
   194         CEZCompressor* iCompressor;
       
   195         //
       
   196         CEZDecompressor* iDecompressor;
       
   197         //
       
   198         TMMCScBkupArchiveVector iCurrentVectorInfo;
       
   199         //
       
   200         TMMCScBkupArchiveVector iOverallArchiveVectorInfo;
       
   201         //
       
   202         RMMCScBkupArchiveWriteStream iWriteStream;
       
   203         //
       
   204         RMMCScBkupArchiveReadStream iReadStream;
       
   205 #ifdef RD_FILE_MANAGER_BACKUP
       
   206         //
       
   207         TBool iCrcCalcActivated;
       
   208         //
       
   209         TUint32 iCrc;
       
   210 #if defined(__MMCSCBKUPLOGGING_ENABLED__)
       
   211         TUint32 iTotalTickCount;
       
   212 #endif
       
   213 #endif // RD_FILE_MANAGER_BACKUP
       
   214 
       
   215         friend class RMMCScBkupArchiveBuf;
       
   216     };
       
   217 
       
   218 
       
   219 
       
   220 
       
   221 #endif // __CMMCSCBKUPARCHIVEDATAMANAGER_H__
       
   222 
       
   223 //End of File