PECengine/StorageManager2/ClientSrc/CPEngStorageManager.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2002 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:  See class description below.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __CPENGSTORAGEMANAGER_H__
       
    20 #define __CPENGSTORAGEMANAGER_H__
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <s32strm.h>
       
    25 
       
    26 #include "MPEngStorageManager.h" // base class
       
    27 #include "RPEngStorageSubFolderClient.h"
       
    28 
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CPEngStoreEntry;
       
    32 
       
    33 
       
    34 enum TPEngPermanentStorageType
       
    35     {
       
    36     EPEngNormal,
       
    37     EPEngTemp,
       
    38     EPEngGlobal
       
    39     };
       
    40 
       
    41 /**
       
    42  *  Implementation of Presence Storage Manager.
       
    43  *  CPEngStorageManager implements the Storage Manager presented at
       
    44  *  MPEngStorageManager. This version supports two different saving
       
    45  *  methods: to memory cache and disc drive.
       
    46  *  Usage:   1. construct
       
    47  *           2. set store base (SetStorageBase()) if not set before use, raises panic.
       
    48  *           3. Store/Retrieve
       
    49  *
       
    50  *	See MPEngStorageManager class for method descriptions.
       
    51  */
       
    52 NONSHARABLE_CLASS( CPEngStorageManager ) :
       
    53         public CBase,
       
    54         public MPEngStorageManager
       
    55     {
       
    56 public:  // Constructors and destructor
       
    57 
       
    58     /**
       
    59      *	Two-phased constructor.
       
    60      */
       
    61     static CPEngStorageManager* NewL(
       
    62         MPEngStorageManagerWatcher& aWatcher,
       
    63         RPEngStorageClient& aStorageMainClient );
       
    64 
       
    65     /**
       
    66       *	Two-phased constructor.
       
    67       */
       
    68     static CPEngStorageManager* NewLC(
       
    69         MPEngStorageManagerWatcher& aWatcher,
       
    70         RPEngStorageClient& aStorageMainClient );
       
    71 
       
    72     /**
       
    73      *	Destructor.
       
    74      */
       
    75     virtual ~CPEngStorageManager();
       
    76 
       
    77 protected: // Protected contructors
       
    78 
       
    79     /**
       
    80      *	C++ default constructor.
       
    81      */
       
    82     CPEngStorageManager( MPEngStorageManagerWatcher& aWatcher );
       
    83 
       
    84     /**
       
    85      *	Symbian 2nd phase constructor
       
    86      */
       
    87     void ConstructL( RPEngStorageClient& aStorageMainClient );
       
    88 
       
    89 public: // Functions from the MPEngStorageManager base classes
       
    90 
       
    91     /**
       
    92     *	Opens one more reference to this storage Manager
       
    93     *	@see <MPEngStorageManager.h>
       
    94     *	@since 3.0
       
    95     */
       
    96     void Open();
       
    97 
       
    98     /**
       
    99     *	Closes one reference to this storage manager
       
   100     *	@see <MPEngStorageManager.h>
       
   101     *	@since 3.0
       
   102     */
       
   103     void Close();
       
   104 
       
   105     /**
       
   106      *	Stores Storeable Entry given as an argument.
       
   107      *	@see <MPEngStorageManager.h>
       
   108      *	@since 3.0
       
   109      */
       
   110     void StoreL( const CPEngStoreEntry& aStoreEntry );
       
   111 
       
   112     /**
       
   113      *	Stores Exclusively StoreEntry given as an argument.
       
   114      *	@see <MPEngStorageManager.h>
       
   115      *	@since 3.0
       
   116      */
       
   117     void StoreExclusiveL( const CPEngStoreEntry& aStoreEntry );
       
   118 
       
   119     /**
       
   120      *	Retrieves the state of Storeable Entry given as an argument.
       
   121      *	@see <MPEngStorageManager.h>
       
   122      *	@since 3.0
       
   123      */
       
   124     TInt RetrieveL( CPEngStoreEntry& aStoreEntry,
       
   125                     TBool aObeyVersion );
       
   126 
       
   127     /**
       
   128      *	Deletes Storeable Entry from store.
       
   129      *	@see <MPEngStorageManager.h>
       
   130      *	@since 3.0
       
   131      */
       
   132     TInt Delete( const CPEngStoreEntry& aStoreEntry );
       
   133     TInt Delete( const TDesC& aStoreEntryId );
       
   134 
       
   135 
       
   136     /**
       
   137      *	Used to check if certain storage entry is locked
       
   138      *	@see <MPEngStorageManager.h>
       
   139      *	@since 3.0
       
   140      */
       
   141     TBool LockedL( const CPEngStoreEntry& aStoreEntry,
       
   142                    TPengStorageLockPriority aPriority ) const;
       
   143 
       
   144     TBool Locked( const CPEngStoreEntry& aStoreEntry,
       
   145                   TPengStorageLockPriority aPriority ) const;
       
   146 
       
   147 
       
   148     /**
       
   149      *	Used to lock certain storage entry
       
   150      *	@see <MPEngStorageManager.h>
       
   151      *	@since 3.0
       
   152      */
       
   153     TInt Lock( const CPEngStoreEntry& aStoreEntry,
       
   154                TPengStorageLockPriority aPriority,
       
   155                TBool aCreateEntry ) const;
       
   156 
       
   157     /**
       
   158      *	Used to unlock certain storage entry
       
   159      *	@see <MPEngStorageManager.h>
       
   160      *	@since 3.0
       
   161      */
       
   162     TInt Unlock( const CPEngStoreEntry& aStoreEntry ) const;
       
   163 
       
   164 
       
   165     /**
       
   166      *	Blind call to notify about storage IDs change
       
   167      *  @see <MPEngStorageManagerWatcher.h>
       
   168      *	@since 3.0
       
   169      */
       
   170     TInt NotifyChangedSId( const TDesC& aChangedSId,
       
   171                            TPEngStorageType aSidStorageType );
       
   172 
       
   173 
       
   174     /**
       
   175      * 	Stops sending of SID changes done through this Storage Manager
       
   176      *	@see <MPEngStorageManager.h>
       
   177      *	@since 3.0
       
   178      */
       
   179     TInt BufferServerSideNotifications( TInt aCount );
       
   180 
       
   181     /**
       
   182      *	Decreases counter of the Server Side Notification buffering,
       
   183      *	@see <MPEngStorageManager.h>
       
   184      *	@since 3.0
       
   185      */
       
   186     TInt ReleaseServerSideBuffering( TInt aCount );
       
   187 
       
   188     /**
       
   189      *	Used to unlock certain storage entry
       
   190      *	@see <MPEngStorageManager.h>
       
   191      *	@since 3.0
       
   192      */
       
   193     MPEngStorageManagerWatcher& StorageManagerWatcher();
       
   194 
       
   195     /**
       
   196      *	Get Session slot Id class
       
   197      *	@see <MPEngStorageManager.h>
       
   198      *	@since 3.0
       
   199      */
       
   200     const CPEngSessionSlotId& SessionSlotId() const;
       
   201 
       
   202 
       
   203 private:	// Ne private functions
       
   204 
       
   205     /**
       
   206       *	Stores Store Entry
       
   207       *
       
   208       *	@since 3.0
       
   209       *	@param aStoreEntry Store entry to store.
       
   210       *	@param aExlusiveLock if ETrue, lock is obeyed
       
   211       */
       
   212     void StoreEntryL( const CPEngStoreEntry& aStoreEntry,
       
   213                       TBool aObeyLock  );
       
   214 
       
   215 private:    // Data
       
   216 
       
   217     /// Access counter
       
   218     TInt									iAccessCount;
       
   219 
       
   220     /// OWN: Storage Manager Watcher, reference owned
       
   221     MPEngStorageManagerWatcher&				iStorageManagerWatcher;
       
   222 
       
   223     /// OWN: Sub Session client to Storage Server
       
   224     RPEngStorageSubFolderClient				iSubFolderClient;
       
   225 
       
   226     ///	REF: Session Slot Id class
       
   227     const CPEngSessionSlotId&				iSessionSlot;
       
   228 
       
   229     };
       
   230 
       
   231 #endif      // __CPENGSTORAGEMANAGER_H__