os/mm/mmlibs/mmfw/src/Client/Audio/MmfFifo.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2001-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 //
    15 
    16 #include "MmfFifo.h"
    17 
    18 const TInt TMMFFifoItemBase::iOffset = _FOFF(TMMFFifoItemBase, iSlink);
    19 
    20 
    21 /**
    22  *
    23  * Construct
    24  *
    25  */
    26 CMMFFifoBase::CMMFFifoBase() : iFifo(TMMFFifoItemBase::iOffset), iFifoIter(iFifo)
    27 	{
    28 	}
    29 
    30 
    31 /**
    32  *
    33  *	Destructor
    34  *
    35  */
    36 CMMFFifoBase::~CMMFFifoBase()
    37 	{
    38 	TMMFFifoItemBase* item;
    39 	iFifoIter.SetToFirst();
    40 	while((item = iFifoIter++)!=NULL)
    41 		{
    42 		iFifo.Remove(*item);
    43 		delete item;
    44 		};
    45 	}
    46 
    47 
    48 /**
    49  *
    50  *  To remove the first stream data from queue	
    51  *
    52  */
    53 void CMMFFifoBase::RemoveFirstItemBase()
    54 	{
    55 	if(!iFifo.IsEmpty())
    56 		{
    57 		iFifo.Remove(*iFifo.First());
    58 		}
    59 	}
    60 
    61 /**
    62  *
    63  *  To get the first stream data from queue	
    64  *
    65  *	@return	"CMMFFifoItem*"	
    66  *			a pointer point to the stream data
    67  *
    68  */
    69 TMMFFifoItemBase* CMMFFifoBase::GetBase()
    70 	{
    71 	TMMFFifoItemBase* firstItem;
    72 	if(iFifo.IsEmpty())
    73 		return NULL;
    74 	firstItem = iFifo.First();
    75 	return firstItem;
    76 	}
    77 
    78 /**
    79  *
    80  *  To add a stream data to the queue, the data will be added at end of queue
    81  *
    82  *	@param	"TMMFFifoItemBase& aItem"	
    83  *			a reference to data
    84  *
    85  */
    86 void CMMFFifoBase::AddToFifo(TMMFFifoItemBase& aItem)
    87 	{
    88 	iFifo.AddLast(aItem);
    89 	}
    90 
    91 /**
    92  *
    93  *  To check stream data queue empty or not	
    94  *
    95  *	@return	"TBool"	
    96  *			a boolean value to indicate the queue is empty or not (ETrue is empty)
    97  *
    98  */
    99 TBool CMMFFifoBase::IsEmpty()
   100 	{
   101 	return iFifo.IsEmpty();
   102 	}
   103 
   104 
   105 
   106 
   107 
   108