SimpleTimer.h 1014 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. ============================================================================
  3. Name : SimpleTimer.h
  4. Author : Den Grigorenko
  5. Copyright : Copyright (c) 2008 Den123
  6. Description : Simple timer with the help of the active object
  7. ============================================================================
  8. */
  9. #ifndef __SIMPLETIMER_H__
  10. #define __SIMPLETIMER_H__
  11. #include <e32base.h>
  12. class MSimpleTimerNotify
  13. {
  14. public:
  15. virtual void TimerExpired( TAny* aTimer,TInt aError ) = 0;
  16. };
  17. class CSimpleTimer: public CActive
  18. {
  19. public:
  20. static CSimpleTimer* NewL(const TInt aPriority, MSimpleTimerNotify& aNotify);
  21. ~CSimpleTimer();
  22. void After(TTimeIntervalMicroSeconds32 aInterval);
  23. protected:
  24. void RunL();
  25. void DoCancel();
  26. private:
  27. CSimpleTimer(const TInt aPriority,MSimpleTimerNotify& aNotify);
  28. void ConstructL(void);
  29. private:
  30. RTimer iTimer;
  31. MSimpleTimerNotify& iNotify;
  32. };
  33. #endif