1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/test/tefshareddata.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,61 @@
1.4 +/*
1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* 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
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 + @file TEFSharedData.h
1.24 +*/
1.25 +#if !(defined __TEF_SHARED_DATA_H__)
1.26 +#define __TEF_SHARED_DATA_H__
1.27 +#include <e32std.h>
1.28 +
1.29 +const TInt KMaxSharedObjectNameSize=30;
1.30 +
1.31 +template <class T>
1.32 +class CTEFSharedData : public CBase
1.33 +/**
1.34 +* @internalComponent
1.35 +* @test
1.36 +*/
1.37 + {
1.38 +public:
1.39 + inline CTEFSharedData();
1.40 + inline ~CTEFSharedData();
1.41 + inline static CTEFSharedData<T>* NewL(T*& aPtr, const TInt aLength, const TDesC& aName);
1.42 + inline static CTEFSharedData<T>* NewLC(T*& aPtr, const TInt aLength, const TDesC& aName);
1.43 + inline static CTEFSharedData<T>* NewL(T*& aPtr, const TDesC& aName);
1.44 + inline static CTEFSharedData<T>* NewLC(T*& aPtr, const TDesC& aName);
1.45 +
1.46 + inline T* Ptr();
1.47 + inline void EnterCriticalSection();
1.48 + inline void ExitCriticalSection();
1.49 +
1.50 +private:
1.51 + inline void ConstructL(T*& aPtr, const TInt aLength, const TDesC& aName);
1.52 + inline void ConstructL(T*& aPtr, const TDesC& aName);
1.53 + inline void SetNameL( const TDesC& aName );
1.54 +
1.55 +private:
1.56 + T* iPtr;
1.57 + RChunk iSharedDataChunk;
1.58 + RMutex iMutex;
1.59 + TBuf<KMaxSharedObjectNameSize> iSharedChunkName;
1.60 + TBuf<KMaxSharedObjectNameSize> iSharedMutexName;
1.61 + };
1.62 +
1.63 +#include <test/tefshareddata.inl>
1.64 +#endif