ZFFramework
 
Loading...
Searching...
No Matches
ZFTaskUtil.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFTaskUtil_h_
7#define _ZFI_ZFTaskUtil_h_
8
9#include "ZFTask.h"
10#include "ZFThread_zfasyncIO.h"
12
13// ============================================================
17zfclass ZFLIB_ZFCore ZFWaitTask : zfextend ZFTask {
18 ZFOBJECT_DECLARE(ZFWaitTask, ZFTask)
19
20public:
23
24protected:
26 virtual void objectOnInit(void) {
28 }
29
31 ZFMP_IN(zftimet, duration)
32 )
33
34protected:
36 virtual void taskOnStart(void);
38 virtual void taskOnStop(void);
39private:
40 zfautoT<ZFTaskId> _implTaskId;
41};
42
43// ============================================================
49zfclass ZFLIB_ZFCore ZFAsyncTask : zfextend ZFTask {
50 ZFOBJECT_DECLARE(ZFAsyncTask, ZFTask)
51
52public:
55
56protected:
58 virtual void objectOnInit(void) {
60 }
61
63 ZFMP_IN(const ZFListener &, impl)
64 )
65
66protected:
68 virtual void taskOnStart(void);
70 virtual void taskOnStop(void);
71private:
72 zfautoT<ZFTaskId> _implTaskId;
73};
74
75// ============================================================
81zfclass ZFLIB_ZFCore ZFPostTask : zfextend ZFTask {
82 ZFOBJECT_DECLARE(ZFPostTask, ZFTask)
83
84public:
87
88protected:
90 virtual void objectOnInit(void) {
92 }
93
95 ZFMP_IN(const ZFListener &, impl)
96 )
97
98protected:
100 virtual void taskOnStart(void);
102 virtual void taskOnStop(void);
103private:
104 zfautoT<ZFTaskId> _implTaskId;
105};
106
107// ============================================================
113zfclass ZFLIB_ZFCore ZFAsyncIOCustomTask : zfextend ZFTask {
114 ZFOBJECT_DECLARE(ZFAsyncIOCustomTask, ZFTask)
115
116public:
119
120protected:
122 virtual void objectOnInit(void) {
124 }
125
127 ZFMP_IN(const ZFListener &, impl)
129
130protected:
132 virtual void taskOnStart(void);
134 virtual void taskOnStop(void);
135private:
136 zfautoT<ZFTaskId> _implTaskId;
137};
138
139// ============================================================
145zfclass ZFLIB_ZFCore ZFAsyncIOTask : zfextend ZFTask {
146 ZFOBJECT_DECLARE(ZFAsyncIOTask, ZFTask)
147
148public:
157
158protected:
160 virtual void objectOnInit(void) {
162 }
163
165 ZFMP_IN(const ZFOutput &, output)
166 , ZFMP_IN(const ZFInput &, input)
167 , ZFMP_IN_OPT(const ZFListener &, onProgress, zfnull)
168 , ZFMP_IN_OPT(ZFAsyncIOResumable *, resumable, zfnull)
170
171protected:
173 virtual void taskOnStart(void);
175 virtual void taskOnStop(void);
176private:
177 zfautoT<ZFTaskId> _implTaskId;
178};
179
181#endif // #ifndef _ZFI_ZFTaskUtil_h_
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
#define zfoverride
dummy macro shows that method override parent's method
Definition ZFCoreTypeDef_ClassType.h:58
_zft_zftimet zftimet
time unit, ensured at least 64 bit, ensured signed
Definition ZFCoreTypeDef_CoreType.h:203
#define zfnull
same as NULL, defined for future use
Definition ZFCoreTypeDef_CoreType.h:88
#define ZFMP_IN_OPT(ParamType, paramName, DefaultValue)
see ZFMP_IN
Definition ZFMethod.h:108
#define ZFMP_IN(ParamType, paramName)
macro to wrap param types for ZFMETHOD_INLINE_0 series
Definition ZFMethod.h:105
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define zfclass
same as class, shows that this class is a ZFObject type
Definition ZFObjectClassTypeFwd.h:38
#define ZFOBJECT_ON_INIT_DECLARE_1(ZFMP_0)
see ZFOBJECT_ON_INIT_INLINE_1
Definition ZFObjectDeclare.h:263
#define ZFOBJECT_ON_INIT_DECLARE_4(ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3)
see ZFOBJECT_ON_INIT_INLINE_1
Definition ZFObjectDeclare.h:362
#define ZFOBJECT_DECLARE(ChildClass, SuperClass,...)
necessary for every class inherit from ZFObject
Definition ZFObjectDeclare.h:126
#define ZFPROPERTY_RETAIN(Type, Name,...)
declare a retain property
Definition ZFPropertyDeclare.h:103
#define ZFPROPERTY_ASSIGN(Type, Name,...)
see ZFPROPERTY_RETAIN
Definition ZFPropertyDeclare.h:127
abstract task util
thread utility
virtual void taskOnStop(void)
called to stop task
virtual ZFListener & impl()
the impl
Definition ZFTaskUtil.h:118
virtual void objectOnInit(void)
override this to init your object
Definition ZFTaskUtil.h:122
virtual void taskOnStart(void)
called to start task
resumable state for zfasyncIO
Definition ZFThread_zfasyncIO.h:42
virtual void taskOnStop(void)
called to stop task
virtual void taskOnStart(void)
called to start task
virtual ZFOutput & output()
the impl
Definition ZFTaskUtil.h:150
virtual zfanyT< ZFAsyncIOResumable > const & resumable()
the impl
Definition ZFTaskUtil.h:156
virtual ZFListener & onProgress()
the impl
Definition ZFTaskUtil.h:154
virtual void objectOnInit(void)
override this to init your object
Definition ZFTaskUtil.h:160
virtual ZFInput & input()
the impl
Definition ZFTaskUtil.h:152
virtual ZFListener & impl()
the impl
Definition ZFTaskUtil.h:54
virtual void objectOnInit(void)
override this to init your object
Definition ZFTaskUtil.h:58
virtual void taskOnStop(void)
called to stop task
virtual void taskOnStart(void)
called to start task
general input callback
Definition ZFIOCallback_input.h:36
listener as ZFCallback, mostly used by ZFObject::observerNotify
Definition ZFObjectObserver.h:30
general output callback
Definition ZFIOCallback_output.h:37
virtual void objectOnInit(void)
override this to init your object
Definition ZFTaskUtil.h:90
virtual ZFListener & impl()
the impl
Definition ZFTaskUtil.h:86
virtual void taskOnStop(void)
called to stop task
virtual void taskOnStart(void)
called to start task
virtual void objectOnInit(const ZFListener &implOnStart, const ZFListener &implOnStop=(zft_zfnull))
util constructor to attach custom impl to E_TaskOnStart and E_TaskOnStop
virtual void objectOnInit(void)
override this to init your object
Definition ZFTaskUtil.h:26
virtual zftimet & duration()
the wait duration
Definition ZFTaskUtil.h:22
virtual void taskOnStart(void)
called to start task
virtual void taskOnStop(void)
called to stop task
see zfany
Definition zfany.h:113
type restrict version of zfauto
Definition zfautoFwd.h:108