ximpfw/core/srcutils/ximpsrvsessionadapter.h
changeset 0 e6b17d312c8b
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Server session adapter base class.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef XIMPSRVSESSIONADAPTER_H
       
    20 #define XIMPSRVSESSIONADAPTER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class MXIMPSrv;
       
    25 class MXIMPSrvSession;
       
    26 class MXIMPSrvMessage;
       
    27 class CXIMPSrvMessageImp;
       
    28 
       
    29 
       
    30 /**
       
    31  * Server session adapter base class.
       
    32  *
       
    33  * @lib ximputils.dll
       
    34  * @since S60 v3.2
       
    35  */
       
    36 class CXIMPSrvSessionAdapter : public CSession2
       
    37     {
       
    38 public:     // Constructor and destructor
       
    39 
       
    40     IMPORT_C CXIMPSrvSessionAdapter( MXIMPSrv& aServer );
       
    41     IMPORT_C ~CXIMPSrvSessionAdapter();
       
    42 
       
    43 
       
    44 public:     // Methods derived from CSession2
       
    45     
       
    46     IMPORT_C void ServiceL( const RMessage2& aMessage );
       
    47     IMPORT_C void ServiceError( const RMessage2& aMessage,
       
    48                                 TInt aError );
       
    49 
       
    50 
       
    51 public:     // New template methods 
       
    52 
       
    53     /**
       
    54      * Session instantiation template method for
       
    55      * derived implementations.
       
    56      *
       
    57      * @param aMessage The session instantiation message.
       
    58      *
       
    59      * @return Session implementation object or NULL if the message
       
    60      *         isn't valid session instantiation request.
       
    61      */
       
    62     virtual MXIMPSrvSession* DoInstantiateSessionL( const MXIMPSrvMessage& aMessage ) = 0;    
       
    63     
       
    64 protected:
       
    65     
       
    66     /**
       
    67      * Access to server for derived implementations.
       
    68      * @return Access to server object.
       
    69      */
       
    70     IMPORT_C MXIMPSrv& Server();
       
    71 
       
    72 private:    // Helpers 
       
    73 
       
    74     TBool IsCurrentMessageValid();
       
    75 
       
    76 private:    // Data
       
    77 
       
    78     /**
       
    79      * Owning server.
       
    80      * Referenced.
       
    81      */
       
    82     MXIMPSrv& iServer;
       
    83 
       
    84     /**
       
    85      * Real session implementation.
       
    86      * Owned.
       
    87      */
       
    88     MXIMPSrvSession* iSessionImp;
       
    89 
       
    90     /**
       
    91      * Currently handled message.
       
    92      * Does not own.
       
    93      */
       
    94     CXIMPSrvMessageImp* iCurrentMsg;
       
    95     
       
    96     /**
       
    97      * Owned.
       
    98      */
       
    99     CXIMPSrvMessageImp* iMessage;    
       
   100     };
       
   101 
       
   102 #endif      //  XIMPSERVERSESSIONADAPTER_H
       
   103