sysstatemgmt/systemstarter/sysmonsrc/timerlist.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-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 /**
       
    17  @file
       
    18  @internalComponent 
       
    19 */
       
    20 
       
    21 #ifndef __TIMERLIST_H__
       
    22 #define __TIMERLIST_H__
       
    23 
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 
       
    27 /**
       
    28 This class is an active object that holds a list of timers. 
       
    29 When a new timer item is added, this class compare the newly added timer with the other timers 
       
    30 in the the list and find out the timer that will expire the earliest. It then start the timer 
       
    31 that will expire the earliest (if applicable). After the first one expire, it will run a timer 
       
    32 for the next timer, and so on.
       
    33 
       
    34 @internalComponent
       
    35 */
       
    36 class CTimerList : public CTimer
       
    37 	{
       
    38 public:
       
    39 	static CTimerList* NewL(TInt aPriority = EPriorityStandard);
       
    40 	~CTimerList();
       
    41 
       
    42 	TInt32 AddL(const TTimeIntervalMicroSeconds32& aInterval, const TCallBack& aCallBack);
       
    43 	TInt32 AddL(const TTime& aTime, const TCallBack& aCallBack);
       
    44 	void Remove(TInt32 aTimer);
       
    45 
       
    46 protected:
       
    47 	class TTimerInfo
       
    48 		{
       
    49 	public:
       
    50 		TTime iTime;
       
    51 		TCallBack iCallBack;
       
    52 		};
       
    53 
       
    54 	void RunL();
       
    55 	void ConstructL();
       
    56 	TInt RunError(TInt aError);
       
    57 		
       
    58 private:
       
    59 	CTimerList(TInt aPriority); 	
       
    60 
       
    61 	void AddL(const TTimerInfo* aInfo);
       
    62 	
       
    63 	static TInt TimerSortOrder(const TTimerInfo &aInfo1, const TTimerInfo &aInfo2);
       
    64 	
       
    65 private:
       
    66 	RPointerArray<TTimerInfo> iTimerList;
       
    67 	};
       
    68 
       
    69 #endif