equal
deleted
inserted
replaced
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
53 @panic SqlDb 7 In _DEBUG mode. Internal logic error. |
53 @panic SqlDb 7 In _DEBUG mode. Internal logic error. |
54 */ |
54 */ |
55 template <class T> |
55 template <class T> |
56 void RDbObjContainer<T>::AllocL() |
56 void RDbObjContainer<T>::AllocL() |
57 { |
57 { |
58 __SQLASSERT(iFree <= iSize, ESqlPanicInternalError); |
58 __ASSERT_DEBUG(iFree <= iSize, __SQLPANIC(ESqlPanicInternalError)); |
59 if(iFree == iSize) |
59 if(iFree == iSize) |
60 { |
60 { |
61 if(iSize >= KMaxSize) |
61 if(iSize >= KMaxSize) |
62 { |
62 { |
63 __SQLLEAVE(KErrNoMemory); |
63 __SQLLEAVE(KErrNoMemory); |
85 @panic SqlDb 7 In _DEBUG mode. Internal logic error. |
85 @panic SqlDb 7 In _DEBUG mode. Internal logic error. |
86 */ |
86 */ |
87 template <class T> |
87 template <class T> |
88 TInt RDbObjContainer<T>::Add(T* aObj) |
88 TInt RDbObjContainer<T>::Add(T* aObj) |
89 { |
89 { |
90 __SQLASSERT(aObj != NULL, ESqlPanicBadArgument); |
90 __ASSERT_DEBUG(aObj != NULL, __SQLPANIC(ESqlPanicBadArgument)); |
91 __SQLASSERT(iFree <= iSize, ESqlPanicInternalError); |
91 __ASSERT_DEBUG(iFree <= iSize, __SQLPANIC(ESqlPanicInternalError)); |
92 TInt idx = iFree; |
92 TInt idx = iFree; |
93 if(idx < iSize) |
93 if(idx < iSize) |
94 { |
94 { |
95 /*RDbObjContainer<T>::*/TEntry& entry = iEntries[idx]; |
95 /*RDbObjContainer<T>::*/TEntry& entry = iEntries[idx]; |
96 __SQLASSERT(!entry.iObj, ESqlPanicInternalError); |
96 __ASSERT_DEBUG(!entry.iObj, __SQLPANIC(ESqlPanicInternalError)); |
97 iFree = entry.iNext; |
97 iFree = entry.iNext; |
98 __SQLASSERT(iFree <= iSize, ESqlPanicInternalError); |
98 __ASSERT_DEBUG(iFree <= iSize, __SQLPANIC(ESqlPanicInternalError)); |
99 entry.iObj = aObj; |
99 entry.iObj = aObj; |
100 return MakeHandle(idx); |
100 return MakeHandle(idx); |
101 } |
101 } |
102 return 0; |
102 return 0; |
103 } |
103 } |
133 @panic SqlDb 7 In _DEBUG mode. Internal logic error or there is no such object in the container. |
133 @panic SqlDb 7 In _DEBUG mode. Internal logic error or there is no such object in the container. |
134 */ |
134 */ |
135 template <class T> |
135 template <class T> |
136 void RDbObjContainer<T>::Remove(TInt aHandle) |
136 void RDbObjContainer<T>::Remove(TInt aHandle) |
137 { |
137 { |
138 __SQLASSERT(iFree <= iSize, ESqlPanicInternalError); |
138 __ASSERT_DEBUG(iFree <= iSize, __SQLPANIC(ESqlPanicInternalError)); |
139 if(aHandle > 0) //It is a handle, sent by the client. It isn't a server's problem if the handle is <= 0. |
139 if(aHandle > 0) //It is a handle, sent by the client. It isn't a server's problem if the handle is <= 0. |
140 { |
140 { |
141 TInt idx = MakeIndex(aHandle); |
141 TInt idx = MakeIndex(aHandle); |
142 if(idx < iSize) |
142 if(idx < iSize) |
143 { |
143 { |
146 entry.iObj = NULL; |
146 entry.iObj = NULL; |
147 entry.iNext = iFree; |
147 entry.iNext = iFree; |
148 iFree = idx; |
148 iFree = idx; |
149 } |
149 } |
150 } |
150 } |
151 __SQLASSERT(iFree <= iSize, ESqlPanicInternalError); |
151 __ASSERT_DEBUG(iFree <= iSize, __SQLPANIC(ESqlPanicInternalError)); |
152 } |
152 } |
153 |
153 |
154 /** |
154 /** |
155 Looks up for an object in the container. |
155 Looks up for an object in the container. |
156 |
156 |