phonebookengines/VirtualPhonebook/VPbkSimServer/inc/CVPbkSimServer.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  The main class of the server.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CVPBKSIMSERVER_H
       
    21 #define CVPBKSIMSERVER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <VPbkSimStoreCommon.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CVPbkSimStoreManager;
       
    29 class CVPbkSimCommandStore;
       
    30 class MVPbkSimCommand;
       
    31 class MVPbkSimCntStore;
       
    32 class MVPbkSimPhone;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37  * The main class of the server.
       
    38  *
       
    39  */
       
    40 NONSHARABLE_CLASS(CVPbkSimServer) : 
       
    41         public CPolicyServer
       
    42     {
       
    43     public:  // Constructors and destructor
       
    44         
       
    45         /**
       
    46         * Two-phased constructor.
       
    47         */
       
    48         static CVPbkSimServer* NewLC();
       
    49         
       
    50         /**
       
    51         * Destructor.
       
    52         */
       
    53         virtual ~CVPbkSimServer();
       
    54 
       
    55     public: // New functions
       
    56         
       
    57         /**
       
    58         * Creates a new object container from the container index.
       
    59         * Use RemoveContainer() to delete it.
       
    60         * @return a reference to the new container
       
    61         */
       
    62         CObjectCon* NewContainerL();
       
    63 
       
    64         /**
       
    65         * Removes the container from the index.
       
    66         * @param aContainer the container that is removed.
       
    67         */
       
    68         void RemoveContainer( CObjectCon& aContainer );
       
    69         
       
    70         /**
       
    71         * Returns the store manager
       
    72         * @return the store manager
       
    73         */
       
    74         inline CVPbkSimStoreManager& StoreManager();
       
    75         
       
    76         /**
       
    77         * Appends a delete/save command to the execution queue.
       
    78         * One command runs at a time.
       
    79         * @param aCommand a new command. Ownership is taken immediately.
       
    80         */
       
    81         void AppendModificationCmdL( MVPbkSimCommand* aCommand );
       
    82 
       
    83         /**
       
    84         * Cancels the command.
       
    85         * @param aCommand the command to cancel
       
    86         */
       
    87         void CancelCommand( MVPbkSimCommand& aCommand );
       
    88 
       
    89         /**
       
    90         * Increases the session count in the server
       
    91         */
       
    92         void IncreaseNumberOfSessions();
       
    93 
       
    94         /**
       
    95         * Decreases the session count and start asynchronous
       
    96         * shutdown if no sessions left
       
    97         */
       
    98         void DecreaseNumberOfSessions();
       
    99 
       
   100     public: // Functions from base classes
       
   101 
       
   102         /**
       
   103         * From CServer2
       
   104         */
       
   105         CSession2* NewSessionL( const TVersion& aVersion, 
       
   106             const RMessage2& aMessage ) const;
       
   107 
       
   108         /**
       
   109         * From CServer2
       
   110         */                    
       
   111         TCustomResult CustomSecurityCheckL( const RMessage2& aMsg, 
       
   112                                             TInt& aAction, 
       
   113                                             TSecurityInfo& aMissing );
       
   114         
       
   115     private: // Construction
       
   116 
       
   117         /**
       
   118         * C++ default constructor.
       
   119         */
       
   120         CVPbkSimServer();
       
   121 
       
   122         /**
       
   123         * By default Symbian 2nd phase constructor is private.
       
   124         */
       
   125         void ConstructL();
       
   126      
       
   127     private:    // Data
       
   128         /// An index for object containers of the sessions
       
   129         CObjectConIx* iObjectContainerIndex;
       
   130         /// Own: store manager owns sim stores
       
   131         CVPbkSimStoreManager* iStoreManager;
       
   132         /// Own: a shared phone for the stores
       
   133         MVPbkSimPhone* iPhone;
       
   134         /// Own: a command store for the delete/save commands
       
   135         CVPbkSimCommandStore* iModificationCmdStore;
       
   136         /// Asynchronous shutdown of the server
       
   137         CPeriodic* iAsyncShutDown;
       
   138         /// number of sessions
       
   139         TInt iNumOfSessions;
       
   140     };
       
   141 
       
   142 // INLINE FUNCTIONS
       
   143 inline CVPbkSimStoreManager& CVPbkSimServer::StoreManager()
       
   144     {
       
   145     return *iStoreManager;
       
   146     }
       
   147 
       
   148 #endif      // CVPBKSIMSERVER_H
       
   149             
       
   150 // End of File