1 /* 2 * Copyright 2001-2010 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _MESSAGE_RUNNER_H 6 #define _MESSAGE_RUNNER_H 7 8 9 #include <Messenger.h> 10 11 12 class BMessageRunner { 13 public: 14 BMessageRunner(BMessenger target, 15 const BMessage* message, bigtime_t interval, 16 int32 count = -1); 17 BMessageRunner(BMessenger target, 18 const BMessage& message, bigtime_t interval, 19 int32 count = -1); 20 BMessageRunner(BMessenger target, 21 const BMessage* message, bigtime_t interval, 22 int32 count, BMessenger replyTo); 23 BMessageRunner(BMessenger target, 24 const BMessage& message, bigtime_t interval, 25 int32 count, BMessenger replyTo); 26 virtual ~BMessageRunner(); 27 28 status_t InitCheck() const; 29 30 status_t SetInterval(bigtime_t interval); 31 status_t SetCount(int32 count); 32 status_t GetInfo(bigtime_t* interval, 33 int32* count) const; 34 35 static status_t StartSending(BMessenger target, 36 const BMessage* message, bigtime_t interval, 37 int32 count); 38 static status_t StartSending(BMessenger target, 39 const BMessage* message, bigtime_t interval, 40 int32 count, BMessenger replyTo); 41 42 private: 43 BMessageRunner(const BMessageRunner &); 44 BMessageRunner& operator=(const BMessageRunner&); 45 46 static int32 _RegisterRunner(BMessenger target, 47 const BMessage* message, bigtime_t interval, 48 int32 count, bool detach, 49 BMessenger replyTo); 50 51 void _InitData(BMessenger target, 52 const BMessage* message, bigtime_t interval, 53 int32 count, BMessenger replyTo); 54 status_t _SetParams(bool resetInterval, 55 bigtime_t interval, bool resetCount, 56 int32 count); 57 58 virtual void _ReservedMessageRunner1(); 59 virtual void _ReservedMessageRunner2(); 60 virtual void _ReservedMessageRunner3(); 61 virtual void _ReservedMessageRunner4(); 62 virtual void _ReservedMessageRunner5(); 63 virtual void _ReservedMessageRunner6(); 64 65 private: 66 int32 fToken; 67 uint32 _reserved[6]; 68 }; 69 70 71 #endif // _MESSAGE_RUNNER_H 72