epoc32/include/test/tefshareddata.h
branchSymbian3
changeset 4 837f303aceeb
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
       
     1 /*
       
     2 * Copyright (c) 2005-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /**
       
    20  @file TEFSharedData.h
       
    21 */
       
    22 #if !(defined __TEF_SHARED_DATA_H__)
       
    23 #define __TEF_SHARED_DATA_H__
       
    24 #include <e32std.h>
       
    25 
       
    26 const TInt KMaxSharedObjectNameSize=30;
       
    27 
       
    28 template <class T>
       
    29 class CTEFSharedData : public CBase
       
    30 /**
       
    31 * @internalComponent
       
    32 * @test
       
    33 */
       
    34 	{
       
    35 public:
       
    36 	inline CTEFSharedData();
       
    37 	inline ~CTEFSharedData();
       
    38 	inline static CTEFSharedData<T>* NewL(T*& aPtr, const TInt aLength, const TDesC& aName);
       
    39 	inline static CTEFSharedData<T>* NewLC(T*& aPtr, const TInt aLength, const TDesC& aName);
       
    40 	inline static CTEFSharedData<T>* NewL(T*& aPtr, const TDesC& aName);
       
    41 	inline static CTEFSharedData<T>* NewLC(T*& aPtr, const TDesC& aName);
       
    42 
       
    43 	inline T* Ptr();
       
    44 	inline void EnterCriticalSection();
       
    45 	inline void ExitCriticalSection();
       
    46 
       
    47 private:
       
    48 	inline void ConstructL(T*& aPtr, const TInt aLength, const TDesC& aName);
       
    49 	inline void ConstructL(T*& aPtr, const TDesC& aName);
       
    50 	inline void SetNameL( const TDesC& aName );
       
    51 
       
    52 private:
       
    53 	T* iPtr;
       
    54 	RChunk iSharedDataChunk;
       
    55 	RMutex iMutex;
       
    56 	TBuf<KMaxSharedObjectNameSize> iSharedChunkName;
       
    57 	TBuf<KMaxSharedObjectNameSize> iSharedMutexName;
       
    58 	};
       
    59 
       
    60 #include <test/tefshareddata.inl>
       
    61 #endif