diff -r f92a4f87e424 -r 012cc2ee6408 usbdrv/peripheral/public/usbcque.h --- a/usbdrv/peripheral/public/usbcque.h Tue Aug 31 17:01:47 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// e32\include\drivers\usbcque.h -// Simple singly linked list + its iterator for the USB Device driver. -// -// - -/** - @file usbcque.h - @internalTechnology -*/ - -#ifndef __USBCQUE_H__ -#define __USBCQUE_H__ - -#include - - -// -// --- Class definitions --- -// - -class TSglQueLink - { -private: - void Enque(TSglQueLink* aLink); -public: - TSglQueLink* iNext; - friend class TSglQueBase; - }; - - -class TSglQueBase - { -protected: - TSglQueBase(TInt aOffset); - void DoAddLast(TAny* aPtr); - void DoRemove(TAny* aPtr); -protected: - TSglQueLink* iHead; - TSglQueLink* iLast; - TInt iOffset; - TInt iElements; -private: - friend class TSglQueIterBase; - }; - - -template -class TSglQue : public TSglQueBase - { -public: - inline TSglQue(TInt aOffset); - inline void AddLast(T& aRef); - inline void Remove(T& aRef); - inline TInt Elements() const; - }; - - -class TSglQueIterBase - { -public: - void SetToFirst(); -protected: - TSglQueIterBase(TSglQueBase& aQue); - TAny* DoPostInc(); - TAny* DoCurrent(); -protected: - TInt iOffset; - TSglQueLink*& iHead; - TSglQueLink* iNext; - }; - - -template -class TSglQueIter : public TSglQueIterBase - { -public: - inline TSglQueIter(TSglQueBase& aQue); - inline operator T*(); - inline T* operator++(TInt); - }; - -// -// --- Inline implementations --- -// - -// Class TSglQue -template -inline TSglQue::TSglQue(TInt aOffset) - : TSglQueBase(aOffset) - {} - - -template -inline void TSglQue::AddLast(T& aRef) - { - DoAddLast(&aRef); - } - - -template -inline void TSglQue::Remove(T& aRef) - { - DoRemove(&aRef); - } - - -template -inline TInt TSglQue::Elements() const - { - return iElements; - } - - -// Class TSglQueIter -template -inline TSglQueIter::TSglQueIter(TSglQueBase& aQue) - : TSglQueIterBase(aQue) - {} - - -template -inline TSglQueIter::operator T*() - { - return ((T*)DoCurrent()); - } - -template -inline T* TSglQueIter::operator++(TInt) - { - return ((T*)DoPostInc()); - } - - -#endif // __USBCQUE_H__