Update contrib.
2 * Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #ifndef UNIQUEINSTANCEIMPL_H_
20 #define UNIQUEINSTANCEIMPL_H_
22 #include "UniqueInstance.h"
24 namespace UniqueInstance
30 void DestroyRUniqueInstance(void* runique);
32 * Reference-counted object.
35 * @since App-frameworks6.1
44 * Skip list holding sorted, reference counted objects
47 * @since App-frameworks6.1
58 RSkipList& operator=(const RSkipList&);
59 RSkipList(const RSkipList&);
61 void TestLinks(TSection* aStart, TSection* aEnd, TInt aLink) const;
63 RSkipList() : iSentinel(0), iCompare(0) {}
65 void Open(TCompareFn* aCompare, TInt aMaxLinks);
69 * Adds an element only if it already exists, otherwise returns 0
71 SElement* AddExisting(void* aElt);
73 * Adds a new element. aNewElt must not already have an equivalent in this
76 SElement* AddNewL(void* aNewElt);
78 * Removes the element, no matter what its reference count is. Return a pointer
79 * to the object, which is now no longer owned.
81 void* Remove(void* aNoLongerNeeded);
83 * Returns true iff skip list has no elements.
85 TBool IsEmpty() const;
87 * Runs tests on the integrity of the skip list.
88 * Returns the number of elements in the list.
97 TSection** FirstLink() const;
99 TInt GenerateNumLinks() const;
104 * Implements the unique instance repository behaviour
107 * @since App-frameworks6.1
109 NONSHARABLE_CLASS(UniqueInstance::CRepositoryImpl) : public CBase
112 CRepositoryImpl(TCompareFn* aCompare, TDeleteFn* aDelete, TCopyFnL* aCopyL,
115 void ConstructL(TInt aMaxLinks);
118 * Adds aElt to the list, passing ownership.
120 SElement* InsertOrIncL(void* aElt);
122 * Adds aElt to the list with the caller retaining ownership.
124 SElement* IncOrCopyL(void* aElt);
126 * Deletes from the list. aNoLongerNeeded points to an element of the list.
128 void DeleteOrDec(UniqueInstance::SElement* aNoLongerNeeded);
130 * Removes from the list, passing ownership back to the caller.
132 void* DetatchOrCopyL(UniqueInstance::SElement* aWritableCopyNeeded);
134 * Returns a prototype null element. Ownership is retained.
136 SElement* NullElement();
138 * Compares the element pointer passed against the prototype null element.
140 TBool IsNull(SElement* a) const;
142 * Runs an integrity check. Panics on failure.
147 TCompareFn* iCompare;
152 SElement iNullElement;
156 #endif // UNIQUEINSTANCEIMPL_H_