@@ -81,31 +81,6 @@ class EventQueue {
8181 * @return A positive id representing the event in the queue,
8282 * or 0 on failure
8383 */
84- template <typename F, typename A0, typename A1, typename A2, typename A3, typename A4>
85- int post (F f, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
86- return post (Context5<F,A0,A1,A2,A3,A4>(f,a0,a1,a2,a3,a4));
87- }
88-
89- template <typename F, typename A0, typename A1, typename A2, typename A3>
90- int post (F f, A0 a0, A1 a1, A2 a2, A3 a3) {
91- return post (Context4<F,A0,A1,A2,A3>(f,a0,a1,a2,a3));
92- }
93-
94- template <typename F, typename A0, typename A1, typename A2>
95- int post (F f, A0 a0, A1 a1, A2 a2) {
96- return post (Context3<F,A0,A1,A2>(f,a0,a1,a2));
97- }
98-
99- template <typename F, typename A0, typename A1>
100- int post (F f, A0 a0, A1 a1) {
101- return post (Context2<F,A0,A1>(f,a0,a1));
102- }
103-
104- template <typename F, typename A0>
105- int post (F f, A0 a0) {
106- return post (Context1<F,A0>(f,a0));
107- }
108-
10984 template <typename F>
11085 int post (F f) {
11186 void *p = event_alloc (&_equeue, sizeof (F));
@@ -118,41 +93,41 @@ class EventQueue {
11893 return event_post (&_equeue, &EventQueue::call<F>, e);
11994 }
12095
121- /* * Post an event to the queue after a specified delay
122- *
123- * @param f Function to call on event dispatch
124- * @param a0..a4 Arguments to pass to the callback
125- * @param ms Time to delay in milliseconds
126- * @return A positive id representing the event in the queue,
127- * or 0 on failure
128- */
129- template <typename F, typename A0, typename A1, typename A2, typename A3, typename A4>
130- int post_in (F f, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, int ms) {
131- return post_in (Context5<F,A0,A1,A2,A3,A4>(f,a0,a1,a2,a3,a4), ms);
96+ template <typename F, typename A0>
97+ int post (F f, A0 a0) {
98+ return post (Context1<F,A0>(f,a0));
13299 }
133100
134- template <typename F, typename A0, typename A1, typename A2, typename A3 >
135- int post_in (F f, A0 a0, A1 a1, A2 a2, A3 a3, int ms ) {
136- return post_in (Context4 <F,A0,A1,A2,A3 >(f,a0,a1,a2,a3), ms );
101+ template <typename F, typename A0, typename A1>
102+ int post (F f, A0 a0, A1 a1) {
103+ return post (Context2 <F,A0,A1>(f,a0,a1) );
137104 }
138105
139106 template <typename F, typename A0, typename A1, typename A2>
140- int post_in (F f, A0 a0, A1 a1, A2 a2, int ms ) {
141- return post_in (Context3<F,A0,A1,A2>(f,a0,a1,a2), ms );
107+ int post (F f, A0 a0, A1 a1, A2 a2) {
108+ return post (Context3<F,A0,A1,A2>(f,a0,a1,a2));
142109 }
143110
144- template <typename F, typename A0, typename A1>
145- int post_in (F f, A0 a0, A1 a1, int ms ) {
146- return post_in (Context2 <F,A0,A1>(f,a0,a1), ms );
111+ template <typename F, typename A0, typename A1, typename A2, typename A3 >
112+ int post (F f, A0 a0, A1 a1, A2 a2, A3 a3 ) {
113+ return post (Context4 <F,A0,A1,A2,A3 >(f,a0,a1,a2,a3) );
147114 }
148115
149- template <typename F, typename A0>
150- int post_in (F f, A0 a0, int ms ) {
151- return post_in (Context1 <F,A0>(f,a0), ms );
116+ template <typename F, typename A0, typename A1, typename A2, typename A3, typename A4 >
117+ int post (F f, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4 ) {
118+ return post (Context5 <F,A0,A1,A2,A3,A4 >(f,a0,a1,a2,a3,a4) );
152119 }
153120
121+ /* * Post an event to the queue after a specified delay
122+ *
123+ * @param f Function to call on event dispatch
124+ * @param a0..a4 Arguments to pass to the callback
125+ * @param ms Time to delay in milliseconds
126+ * @return A positive id representing the event in the queue,
127+ * or 0 on failure
128+ */
154129 template <typename F>
155- int post_in (F f, int ms ) {
130+ int post_in (int ms, F f ) {
156131 void *p = event_alloc (&_equeue, sizeof (F));
157132 if (!p) {
158133 return 0 ;
@@ -164,41 +139,41 @@ class EventQueue {
164139 return event_post (&_equeue, &EventQueue::call<F>, e);
165140 }
166141
167- /* * Post an event to the queue periodically
168- *
169- * @param f Function to call on event dispatch
170- * @param a0..a4 Arguments to pass to the callback
171- * @param ms Period of the event in milliseconds
172- * @return A positive id representing the event in the queue,
173- * or 0 on failure
174- */
175- template <typename F, typename A0, typename A1, typename A2, typename A3, typename A4>
176- int post_every (F f, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, int ms) {
177- return post_every (Context5<F,A0,A1,A2,A3,A4>(f,a0,a1,a2,a3,a4), ms);
142+ template <typename F, typename A0>
143+ int post_in (int ms, F f, A0 a0) {
144+ return post_in (ms, Context1<F,A0>(f,a0));
178145 }
179146
180- template <typename F, typename A0, typename A1, typename A2, typename A3 >
181- int post_every ( F f, A0 a0, A1 a1, A2 a2, A3 a3, int ms ) {
182- return post_every (Context4 <F,A0,A1,A2,A3 >(f,a0,a1,a2,a3), ms );
147+ template <typename F, typename A0, typename A1>
148+ int post_in ( int ms, F f, A0 a0, A1 a1) {
149+ return post_in (ms, Context2 <F,A0,A1>(f,a0,a1) );
183150 }
184151
185152 template <typename F, typename A0, typename A1, typename A2>
186- int post_every ( F f, A0 a0, A1 a1, A2 a2, int ms ) {
187- return post_every ( Context3<F,A0,A1,A2>(f,a0,a1,a2), ms );
153+ int post_in ( int ms, F f, A0 a0, A1 a1, A2 a2) {
154+ return post_in (ms, Context3<F,A0,A1,A2>(f,a0,a1,a2));
188155 }
189156
190- template <typename F, typename A0, typename A1>
191- int post_every ( F f, A0 a0, A1 a1, int ms ) {
192- return post_every (Context2 <F,A0,A1>(f,a0,a1), ms );
157+ template <typename F, typename A0, typename A1, typename A2, typename A3 >
158+ int post_in ( int ms, F f, A0 a0, A1 a1, A2 a2, A3 a3 ) {
159+ return post_in (ms, Context4 <F,A0,A1,A2,A3 >(f,a0,a1,a2,a3) );
193160 }
194161
195- template <typename F, typename A0>
196- int post_every ( F f, A0 a0, int ms ) {
197- return post_every (Context1 <F,A0>(f,a0), ms );
162+ template <typename F, typename A0, typename A1, typename A2, typename A3, typename A4 >
163+ int post_in ( int ms, F f, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4 ) {
164+ return post_in (ms, Context5 <F,A0,A1,A2,A3,A4 >(f,a0,a1,a2,a3,a4) );
198165 }
199166
167+ /* * Post an event to the queue periodically
168+ *
169+ * @param f Function to call on event dispatch
170+ * @param a0..a4 Arguments to pass to the callback
171+ * @param ms Period of the event in milliseconds
172+ * @return A positive id representing the event in the queue,
173+ * or 0 on failure
174+ */
200175 template <typename F>
201- int post_every (F f, int ms ) {
176+ int post_every (int ms, F f ) {
202177 void *p = event_alloc (&_equeue, sizeof (F));
203178 if (!p) {
204179 return 0 ;
@@ -211,6 +186,30 @@ class EventQueue {
211186 return event_post (&_equeue, &EventQueue::call<F>, e);
212187 }
213188
189+ template <typename F, typename A0>
190+ int post_every (int ms, F f, A0 a0) {
191+ return post_every (ms, Context1<F,A0>(f,a0));
192+ }
193+
194+ template <typename F, typename A0, typename A1>
195+ int post_every (int ms, F f, A0 a0, A1 a1) {
196+ return post_every (ms, Context2<F,A0,A1>(f,a0,a1));
197+ }
198+
199+ template <typename F, typename A0, typename A1, typename A2>
200+ int post_every (int ms, F f, A0 a0, A1 a1, A2 a2) {
201+ return post_every (ms, Context3<F,A0,A1,A2>(f,a0,a1,a2));
202+ }
203+
204+ template <typename F, typename A0, typename A1, typename A2, typename A3>
205+ int post_every (int ms, F f, A0 a0, A1 a1, A2 a2, A3 a3) {
206+ return post_every (ms, Context4<F,A0,A1,A2,A3>(f,a0,a1,a2,a3));
207+ }
208+
209+ template <typename F, typename A0, typename A1, typename A2, typename A3, typename A4>
210+ int post_every (int ms, F f, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
211+ return post_every (ms, Context5<F,A0,A1,A2,A3,A4>(f,a0,a1,a2,a3,a4));
212+ }
214213
215214protected:
216215 void break_ ();
0 commit comments