equal
deleted
inserted
replaced
|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // SqlSrvObjContainer.h |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __INETSRVSTREAMOBJCONTAINER_H__ |
|
19 #define __INETSRVSTREAMOBJCONTAINER_H__ |
|
20 |
|
21 #include <e32std.h> |
|
22 |
|
23 /** |
|
24 Indexed storage for server side URI stream objects. |
|
25 |
|
26 |
|
27 @internalComponent |
|
28 */ |
|
29 |
|
30 template <class T> class RStreamObjContainer |
|
31 { |
|
32 public: |
|
33 RStreamObjContainer(); |
|
34 void Close(); |
|
35 void AllocL(); |
|
36 TInt Add(T* aObj); |
|
37 void Remove(TInt aHandle); |
|
38 T* Find(TInt aHandle) const; |
|
39 TInt Count() const; |
|
40 |
|
41 private: |
|
42 TInt MakeHandle(TInt aIndex) const; |
|
43 TInt MakeIndex(TInt aHandle) const; |
|
44 |
|
45 private: |
|
46 struct TEntry |
|
47 { |
|
48 T* iObj; |
|
49 TInt iNext; |
|
50 }; |
|
51 enum {KGranularity = 16}; |
|
52 //KMaxSize value depends on how many bits are used for handles - see |
|
53 //KStmtHandleMask and KStreamHandleMask in SqlUtil.h file. |
|
54 enum {KMaxSize = 0x7FF}; |
|
55 TEntry* iEntries; |
|
56 TInt iSize; |
|
57 TInt iFree; |
|
58 }; |
|
59 |
|
60 #include "StreamObjContainer.inl" |
|
61 |
|
62 #endif//__INETSRVSTREAMOBJCONTAINER_H__ |