xref: /haiku/headers/os/app/MessageRunner.h (revision 002f37b0cca92e4cf72857c72ac95db5a8b09615)
1 /*
2  * Copyright 2001-2010, Haiku, Inc.
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=(
45 									const BMessageRunner &);
46 
47 	static	int32				_RegisterRunner(BMessenger target,
48 									const BMessage* message, bigtime_t interval,
49 									int32 count, bool detach,
50 									BMessenger replyTo);
51 
52 			void				_InitData(BMessenger target,
53 									const BMessage* message, bigtime_t interval,
54 									int32 count, BMessenger replyTo);
55 			status_t			_SetParams(bool resetInterval,
56 									bigtime_t interval, bool resetCount,
57 									int32 count);
58 
59 	virtual	void				_ReservedMessageRunner1();
60 	virtual	void				_ReservedMessageRunner2();
61 	virtual	void				_ReservedMessageRunner3();
62 	virtual	void				_ReservedMessageRunner4();
63 	virtual	void				_ReservedMessageRunner5();
64 	virtual	void				_ReservedMessageRunner6();
65 
66 private:
67 			int32				fToken;
68 			uint32				_reserved[6];
69 };
70 
71 
72 #endif	// _MESSAGE_RUNNER_H
73