6#ifndef _ZFI_ZFObjectObserver_h_
7#define _ZFI_ZFObjectObserver_h_
54 inline zfbool operator () (
void)
const {
93 typedef void (*FUNC_TYPE)(
ZF_IN const ZFArgs &zfargs);
118 template<
typename T_Func>
121 , std::function<
void(
const ZFArgs &)>, f
127 template<typename T_Func>
130 , std::function<
void(
const ZFArgs &)>, f
222 this->
observerAdd(eventId, observer, observerLevel);
281 _ZFP_ZFObserverPrivate *d;
328#define ZFEVENT(YourEvent) \
329 ZFIDMAP_DETAIL(E_, YourEvent)
332#define ZFEVENT_INLINE(YourEvent) \
333 ZFIDMAP_DETAIL_INLINE(E_, YourEvent)
336#define ZFEVENT_REGISTER(YourClass, YourEvent) \
337 ZFIDMAP_REGISTER_DETAIL(YourClass, E_, YourEvent)
369#define ZFEVENT_GLOBAL(ZFLIB_, YourEvent) \
370 ZFIDMAP_GLOBAL_DETAIL(ZFLIB_, E_, YourEvent)
373#define ZFEVENT_GLOBAL_REGISTER(YourEvent) \
374 ZFIDMAP_GLOBAL_REGISTER_DETAIL(E_, YourEvent)
#define ZFCallbackForMemberMethod(obj, zfmethod)
create a callback from ZFMethod of an object
Definition ZFCallback.h:375
#define ZFCallbackForMethod(zfmethod)
create a callback from ZFMethod
Definition ZFCallback.h:365
#define ZFCALLBACK_DECLARE_BEGIN(ZFLIB_, CallbackTypeName, ParentType)
util macro to declare a child type of ZFCallback
Definition ZFCallback.h:458
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
#define zffinal
dummy macro shows that a method or class is designed must not to be overrided
Definition ZFCoreTypeDef_ClassType.h:63
#define zfclassLikePOD
shows the class is not a POD type, but you may use it like a POD except memset it to 0
Definition ZFCoreTypeDef_ClassType.h:41
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:184
#define ZF_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:188
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:196
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
#define zftrue
bool true type
Definition ZFCoreTypeDef_CoreType.h:107
_zft_zfidentity zfidentity
identity type, ensured at least 32 bit, ensured unsigned
Definition ZFCoreTypeDef_CoreType.h:225
#define zffalse
bool false type
Definition ZFCoreTypeDef_CoreType.h:111
#define zfnull
same as NULL, defined for future use
Definition ZFCoreTypeDef_CoreType.h:88
_ZFT_t_zfuint zfuint
same as unsigned int, see zfindex
Definition ZFCoreTypeDef_CoreType.h:169
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
id to string map util, useful to define extendable string enum
zfidentity ZFIdMapIdForName(const zfstring &idName)
get id value from id name, or zfidentityInvalid if no such id name, see ZFIDMAP
zfidentity ZFIdMapDynamicRegister(const zfstring &idName)
dynamically register your own id
void ZFIdMapDynamicUnregister(zfidentity idValue)
unregister id that was registered by ZFIdMapDynamicRegister
zfstring ZFIdMapNameForId(zfidentity idValue)
get id name from id value, or null if no such id, see ZFIdMapIdForName
ZFLevel
level for logic which depends on order
Definition ZFLevel.h:17
@ ZFLevelAppNormal
app
Definition ZFLevel.h:26
util macros to declare ZFListener as ZFCallback
#define ZFLISTENER_END()
see ZFLISTENER
Definition ZFListenerDeclare.h:17
#define ZFLISTENER_1(name, CaptureParam0, capture0)
see ZFLISTENER
Definition ZFListenerDeclare.h:69
#define ZF_NAMESPACE_BEGIN_REGISTER(NameSpace, ParentNameSpace)
begin and register namespace
Definition ZFNamespace.h:48
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_END(NameSpace)
end namespace
Definition ZFNamespace.h:60
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define ZF_NAMESPACE_GLOBAL
namespace of ZFFramework
Definition ZFNamespace.h:96
zfidentity ZFEventIdForName(const zfstring &idName)
get id value from id name, or zfidentityInvalid if no such id name
Definition ZFObjectObserver.h:393
void ZFEventDynamicUnregister(zfidentity idValue)
unregister id that was registered by ZFEventDynamicRegister
Definition ZFObjectObserver.h:411
zfstring ZFEventNameForId(zfidentity idValue)
get id name from id value, or null if no such id, see ZFEventIdForName
Definition ZFObjectObserver.h:380
zfidentity ZFEventDynamicRegister(const zfstring &idName)
dynamically register your own id
Definition ZFObjectObserver.h:402
ZFObserver & ZFGlobalObserver(void)
all event notified by ZFObject::observerNotify would also be notified to the observers added by this ...
listener data used by ZFListener
Definition ZFArgs.h:20
callback used by ZFFramework
Definition ZFCallback.h:96
T_ReturnType executeExact() const
see ZFCallback, you must assign the exact return type and param types for safe
Definition ZFCallback.h:123
zfbool valid(void) const
return true if callback is valid
Definition ZFCallback.h:238
listener as ZFCallback, mostly used by ZFObject::observerNotify
Definition ZFObjectObserver.h:30
zfbool execute(void) const
see ZFListener
Definition ZFObjectObserver.h:33
zfbool execute(const ZFArgs &zfargs) const
see ZFListener
Definition ZFObjectObserver.h:44
reflectable method for ZFObject
Definition ZFMethod.h:252
base class of all objects
Definition ZFObjectCore.h:209
holder object for observer logic, see ZFObject::observerNotify
Definition ZFObjectObserver.h:147
void observerAddForOnce(zfidentity eventId, const ZFListener &observer, ZFLevel observerLevel=ZFLevelAppNormal)
see ZFObject::observerNotify
void on(zfidentity eventId, const ZFListener &observer, ZFLevel observerLevel=ZFLevelAppNormal)
util to observerAdd
Definition ZFObjectObserver.h:217
void observerNotifyReverselyWithSender(ZFObject *customSender, zfidentity eventId, ZFObject *param0=zft_zfnull, ZFObject *param1=zft_zfnull) const
see ZFObject::observerNotify
void observerHasAddStateDetach(zfidentity eventId, zfuint *flag, zfuint flagBit)
see observerHasAddStateAttach
void observerRemove(zfidentity eventId, const ZFListener &callback)
see ZFObject::observerNotify
void observerRemoveAll(void)
see ZFObject::observerNotify
void objectInfoT(zfstring &ret) const
see objectInfo
zfany observerOwner(void) const
owner object of this observer holder, or null if none
zfstring objectInfo(void) const
return a short string describe the object
Definition ZFObjectObserver.h:269
void observerRemoveAll(zfidentity eventId)
see ZFObject::observerNotify
void observerAdd(zfidentity eventId, const ZFListener &observer, ZFLevel observerLevel=ZFLevelAppNormal)
see ZFObject::observerNotify
void observerNotifyWithSender(ZFObject *customSender, zfidentity eventId, ZFObject *param0=zft_zfnull, ZFObject *param1=zft_zfnull) const
see ZFObject::observerNotify
zfbool observerHasAdd(void) const
see ZFObject::observerNotify
void observerNotify(zfidentity eventId, ZFObject *param0=zft_zfnull, ZFObject *param1=zft_zfnull) const
see ZFObject::observerNotify
Definition ZFObjectObserver.h:185
void observerHasAddStateAttach(zfidentity eventId, zfuint *flag, zfuint flagBit)
attach a state that indicate whether the observer has add, for performance usage
zfbool observerHasAdd(zfidentity eventId) const
see ZFObject::observerNotify
void observerNotifyReversely(zfidentity eventId, ZFObject *param0=zft_zfnull, ZFObject *param1=zft_zfnull) const
see ZFObject::observerNotify
Definition ZFObjectObserver.h:200
util method to cast ZFObject types freely
Definition zfany.h:35