PECengine/PresenceServer2/ServerSrc/CPEngAppAccessContainer.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:  CSP session access container
       
    15 *  				 This class maintain reference counted access to the CSP session
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __CPENGAPPACCESSCONTAINER_H__
       
    22 #define __CPENGAPPACCESSCONTAINER_H__
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <badesca.h>
       
    27 
       
    28 
       
    29 /**
       
    30  *  CSP session access container
       
    31  *  This class maintain reference counted access to the CSP session
       
    32  *
       
    33  *  @lib PEngServer2
       
    34  *  @since 3.0
       
    35  */
       
    36 NONSHARABLE_CLASS( CPEngAppAccessContainer ) :
       
    37         public CObject
       
    38     {
       
    39 public:  // Constructors and destructor
       
    40 
       
    41     /**
       
    42      * Two-phased constructor.
       
    43      */
       
    44     static CPEngAppAccessContainer* NewLC( const TDesC& aAppId );
       
    45 
       
    46     /**
       
    47      * Destructor.
       
    48      */
       
    49     virtual ~CPEngAppAccessContainer();
       
    50 
       
    51 public: // Function from the base class
       
    52 
       
    53     /**
       
    54      *  Application Id
       
    55      *
       
    56      *  @since 3.0
       
    57      *  @return application id
       
    58      */
       
    59     const TDesC& AppId() const;
       
    60 
       
    61     /**
       
    62      *  Access count
       
    63      *  Return access count of the container
       
    64      *
       
    65      *  @since 3.0
       
    66      *  @return access count
       
    67      */
       
    68     TInt ActiveAccessCount();
       
    69 
       
    70     /**
       
    71      *	Close access
       
    72      *	Returns ETrue is this object is being destroyed
       
    73      *
       
    74      *  @since 3.0
       
    75      *  @return ETrue if object is being destroyed
       
    76      */
       
    77     TBool CloseAccess();
       
    78 
       
    79     /**
       
    80      *	Reserve Process Id
       
    81      *
       
    82      *  @since 3.0
       
    83      *  @param aProcessId process Id
       
    84      */
       
    85     void ReserveProcessL( const TDesC& aProcessId );
       
    86 
       
    87     /**
       
    88      *	Activate Process Id
       
    89      *
       
    90      *	Process Id is removed from list of reserved Ids and
       
    91      *	reference count is increased by one, to signal process
       
    92      *	is again active
       
    93      *	Function leaves with KErrNotFound if Process Id is not found
       
    94      *
       
    95      *  @since 3.0
       
    96      *  @param aProcessId process Id
       
    97      */
       
    98     void ActivateProcessIdL( const TDesC& aProcessId );
       
    99 
       
   100     /**
       
   101      *	Closes container and let framework deletes it
       
   102      *
       
   103      *  Sets access count to zero and resets array of registeres
       
   104      *	process ids, so container is deleted by the CObject framework
       
   105      *
       
   106      *  @since 3.0
       
   107      */
       
   108     void CloseContainer();
       
   109 
       
   110 private:
       
   111 
       
   112     /**
       
   113      * C++ default constructor.
       
   114      */
       
   115     CPEngAppAccessContainer( );
       
   116 
       
   117     /**
       
   118      * By default Symbian 2nd phase constructor is private.
       
   119      */
       
   120     void ConstructL( const TDesC& aAppId );
       
   121 
       
   122 
       
   123 private:    // Data
       
   124 
       
   125     /// OWN: Reserved Process Names
       
   126     CDesC16ArrayFlat	iReserved;
       
   127 
       
   128     /// OWN: Application Id
       
   129     HBufC* 				iAppId;
       
   130     };
       
   131 
       
   132 #endif      // __CPENGAPPACCESSCONTAINER_H__
       
   133 
       
   134 // End of File