|
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 "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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file TEFSharedData.h |
|
22 */ |
|
23 #if !(defined __TEF_SHARED_DATA_H__) |
|
24 #define __TEF_SHARED_DATA_H__ |
|
25 #include <e32std.h> |
|
26 |
|
27 const TInt KMaxSharedObjectNameSize=30; |
|
28 |
|
29 template <class T> |
|
30 class CTEFSharedData : public CBase |
|
31 /** |
|
32 * @internalComponent |
|
33 * @test |
|
34 */ |
|
35 { |
|
36 public: |
|
37 inline CTEFSharedData(); |
|
38 inline ~CTEFSharedData(); |
|
39 inline static CTEFSharedData<T>* NewL(T*& aPtr, const TInt aLength, const TDesC& aName); |
|
40 inline static CTEFSharedData<T>* NewLC(T*& aPtr, const TInt aLength, const TDesC& aName); |
|
41 inline static CTEFSharedData<T>* NewL(T*& aPtr, const TDesC& aName); |
|
42 inline static CTEFSharedData<T>* NewLC(T*& aPtr, const TDesC& aName); |
|
43 |
|
44 inline T* Ptr(); |
|
45 inline void EnterCriticalSection(); |
|
46 inline void ExitCriticalSection(); |
|
47 |
|
48 private: |
|
49 inline void ConstructL(T*& aPtr, const TInt aLength, const TDesC& aName); |
|
50 inline void ConstructL(T*& aPtr, const TDesC& aName); |
|
51 inline void SetNameL( const TDesC& aName ); |
|
52 |
|
53 private: |
|
54 T* iPtr; |
|
55 RChunk iSharedDataChunk; |
|
56 RMutex iMutex; |
|
57 TBuf<KMaxSharedObjectNameSize> iSharedChunkName; |
|
58 TBuf<KMaxSharedObjectNameSize> iSharedMutexName; |
|
59 }; |
|
60 |
|
61 #include <test/tefshareddata.inl> |
|
62 #endif |