backupandrestore/backupengine/inc/absessionmap.h
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 /**
       
     2 * Copyright (c) 2004-2009 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:
       
    15 * Declaration of CABSession class.
       
    16 * 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file
       
    24 */
       
    25 #ifndef __ABSESSIONMAP_H__
       
    26 #define __ABSESSIONMAP_H__
       
    27 
       
    28 #include <e32std.h>
       
    29 
       
    30 namespace conn
       
    31 	{
       
    32 	class CABSession;
       
    33 	
       
    34 	class CABSessionElement : public CBase
       
    35 	/**
       
    36 	@internalComponent
       
    37 	@ingroup Server
       
    38 	
       
    39 	The elements hold the TSecureId (key) and own the CABSession (value)
       
    40 	*/
       
    41 		{
       
    42 		public:
       
    43 			static CABSessionElement* NewL(TSecureId aSecureId);
       
    44 			TSecureId Key() const;
       
    45 			CABSession& Value() const;
       
    46 			~CABSessionElement();
       
    47 		private:
       
    48 			CABSessionElement(TSecureId aSecureId);
       
    49 			void ConstructL();
       
    50 			
       
    51 		private:
       
    52 			TSecureId iKey;
       
    53 			CABSession* iValue;
       
    54 		};
       
    55 		
       
    56 	inline TSecureId CABSessionElement::Key() const
       
    57 	/**
       
    58 	Return the key of this element
       
    59 	
       
    60 	@return The key
       
    61 	*/
       
    62 		{
       
    63 		return iKey;
       
    64 		}
       
    65 
       
    66 	inline CABSession& CABSessionElement::Value() const
       
    67 	/**
       
    68 	Return a reference to the session
       
    69 	
       
    70 	@return Reference to the session object that this element owns
       
    71 	*/
       
    72 		{
       
    73 		return *iValue;
       
    74 		}
       
    75 	
       
    76 
       
    77 
       
    78 
       
    79 
       
    80 	class CABSessionMap : public CBase
       
    81 	/**
       
    82     @internalComponent
       
    83 	@ingroup Server
       
    84 
       
    85 	An AB client Session map for holding key-value records to map between SID's and their sessions
       
    86 	*/
       
    87 		{
       
    88 		public:
       
    89 			static CABSessionMap* NewL();
       
    90 			CABSession& CreateL(TSecureId aSecureId);
       
    91 			void Delete(TSecureId aSecureId);
       
    92 			CABSession& SessionL(TSecureId aSecureId);
       
    93 
       
    94 			~CABSessionMap();
       
    95 			void InvalidateABSessions();
       
    96 			
       
    97 		private:
       
    98 			CABSessionMap();
       
    99 
       
   100 		private:
       
   101 			RPointerArray<CABSessionElement> iMapElements;
       
   102 		};
       
   103 
       
   104 	}
       
   105 
       
   106 #endif //__ABSESSIONMAP_H__