xref: /haiku/headers/os/app/MessageRunner.h (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
1 /*
2  * Copyright 2001-2006, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Ingo Weinhold (bonefish@users.sf.net)
7  */
8 #ifndef _MESSAGE_RUNNER_H
9 #define _MESSAGE_RUNNER_H
10 
11 
12 #include <Messenger.h>
13 
14 
15 class BMessageRunner {
16 	public:
17 		BMessageRunner(BMessenger target, const BMessage *message,
18 					   bigtime_t interval, int32 count = -1);
19 		BMessageRunner(BMessenger target, const BMessage *message,
20 					   bigtime_t interval, int32 count, BMessenger replyTo);
21 		virtual ~BMessageRunner();
22 
23 		status_t InitCheck() const;
24 
25 		status_t SetInterval(bigtime_t interval);
26 		status_t SetCount(int32 count);
27 		status_t GetInfo(bigtime_t *interval, int32 *count) const;
28 
29 		static status_t StartSending(BMessenger target, const BMessage *message,
30 					bigtime_t interval, int32 count);
31 		static status_t StartSending(BMessenger target, const BMessage *message,
32 					bigtime_t interval, int32 count, BMessenger replyTo);
33 
34 	private:
35 		BMessageRunner(const BMessageRunner &);
36 		BMessageRunner &operator=(const BMessageRunner &);
37 
38 		static int32 _RegisterRunner(BMessenger target, const BMessage *message,
39 					bigtime_t interval, int32 count, bool detach, BMessenger replyTo);
40 
41 		void _InitData(BMessenger target, const BMessage *message, bigtime_t interval,
42 					int32 count, BMessenger replyTo);
43 		status_t _SetParams(bool resetInterval, bigtime_t interval, bool resetCount,
44 					int32 count);
45 
46 		virtual void _ReservedMessageRunner1();
47 		virtual void _ReservedMessageRunner2();
48 		virtual void _ReservedMessageRunner3();
49 		virtual void _ReservedMessageRunner4();
50 		virtual void _ReservedMessageRunner5();
51 		virtual void _ReservedMessageRunner6();
52 
53 		int32	fToken;
54 		uint32	_reserved[6];
55 };
56 
57 #endif	// _MESSAGE_RUNNER_H
58