ZFFramework
Loading...
Searching...
No Matches
Macros | Functions
ZFMethodUserRegister.h File Reference

user registered ZFMethod More...

#include "ZFMethod.h"
#include "ZFMethodUserRegister_ZFObject.h"
#include "ZFMethodUserRegister_Wrapper.h"

Go to the source code of this file.

Macros

#define ZFMethodUserRegister_0(resultMethod, methodInvokerAction, ownerClass, ReturnType, methodNameString)
 register a custom method to existing class, for advanced reflection use only
 
#define ZFMethodUserRegisterDetail_0(resultMethod, methodInvokerAction, ownerClass, PublicOrProtectedOrPrivate, ZFMethodType_, ReturnType, methodNameString)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_0(methodInvokerAction, ownerClassSig, ReturnType, methodName)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_DETAIL_0(methodInvokerAction, ownerClassSig, PublicOrProtectedOrPrivate, ZFMethodType_, RegSig, ReturnType, methodName)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegister_1(resultMethod, methodInvokerAction, ownerClass, ReturnType, methodNameString, ZFMP_0)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegisterDetail_1(resultMethod, methodInvokerAction, ownerClass, PublicOrProtectedOrPrivate, ZFMethodType_, ReturnType, methodNameString, ZFMP_0)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_1(methodInvokerAction, ownerClassSig, ReturnType, methodName, ZFMP_0)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_DETAIL_1(methodInvokerAction, ownerClassSig, PublicOrProtectedOrPrivate, ZFMethodType_, RegSig, ReturnType, methodName, ZFMP_0)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegister_2(resultMethod, methodInvokerAction, ownerClass, ReturnType, methodNameString, ZFMP_0, ZFMP_1)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegisterDetail_2(resultMethod, methodInvokerAction, ownerClass, PublicOrProtectedOrPrivate, ZFMethodType_, ReturnType, methodNameString, ZFMP_0, ZFMP_1)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_2(methodInvokerAction, ownerClassSig, ReturnType, methodName, ZFMP_0, ZFMP_1)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_DETAIL_2(methodInvokerAction, ownerClassSig, PublicOrProtectedOrPrivate, ZFMethodType_, RegSig, ReturnType, methodName, ZFMP_0, ZFMP_1)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegister_3(resultMethod, methodInvokerAction, ownerClass, ReturnType, methodNameString, ZFMP_0, ZFMP_1, ZFMP_2)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegisterDetail_3(resultMethod, methodInvokerAction, ownerClass, PublicOrProtectedOrPrivate, ZFMethodType_, ReturnType, methodNameString, ZFMP_0, ZFMP_1, ZFMP_2)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_3(methodInvokerAction, ownerClassSig, ReturnType, methodName, ZFMP_0, ZFMP_1, ZFMP_2)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_DETAIL_3(methodInvokerAction, ownerClassSig, PublicOrProtectedOrPrivate, ZFMethodType_, RegSig, ReturnType, methodName, ZFMP_0, ZFMP_1, ZFMP_2)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegister_4(resultMethod, methodInvokerAction, ownerClass, ReturnType, methodNameString, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegisterDetail_4(resultMethod, methodInvokerAction, ownerClass, PublicOrProtectedOrPrivate, ZFMethodType_, ReturnType, methodNameString, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_4(methodInvokerAction, ownerClassSig, ReturnType, methodName, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_DETAIL_4(methodInvokerAction, ownerClassSig, PublicOrProtectedOrPrivate, ZFMethodType_, RegSig, ReturnType, methodName, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegister_5(resultMethod, methodInvokerAction, ownerClass, ReturnType, methodNameString, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegisterDetail_5(resultMethod, methodInvokerAction, ownerClass, PublicOrProtectedOrPrivate, ZFMethodType_, ReturnType, methodNameString, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_5(methodInvokerAction, ownerClassSig, ReturnType, methodName, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_DETAIL_5(methodInvokerAction, ownerClassSig, PublicOrProtectedOrPrivate, ZFMethodType_, RegSig, ReturnType, methodName, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegister_6(resultMethod, methodInvokerAction, ownerClass, ReturnType, methodNameString, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4, ZFMP_5)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegisterDetail_6(resultMethod, methodInvokerAction, ownerClass, PublicOrProtectedOrPrivate, ZFMethodType_, ReturnType, methodNameString, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4, ZFMP_5)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_6(methodInvokerAction, ownerClassSig, ReturnType, methodName, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4, ZFMP_5)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_DETAIL_6(methodInvokerAction, ownerClassSig, PublicOrProtectedOrPrivate, ZFMethodType_, RegSig, ReturnType, methodName, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4, ZFMP_5)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegister_7(resultMethod, methodInvokerAction, ownerClass, ReturnType, methodNameString, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4, ZFMP_5, ZFMP_6)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegisterDetail_7(resultMethod, methodInvokerAction, ownerClass, PublicOrProtectedOrPrivate, ZFMethodType_, ReturnType, methodNameString, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4, ZFMP_5, ZFMP_6)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_7(methodInvokerAction, ownerClassSig, ReturnType, methodName, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4, ZFMP_5, ZFMP_6)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_DETAIL_7(methodInvokerAction, ownerClassSig, PublicOrProtectedOrPrivate, ZFMethodType_, RegSig, ReturnType, methodName, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4, ZFMP_5, ZFMP_6)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegister_8(resultMethod, methodInvokerAction, ownerClass, ReturnType, methodNameString, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4, ZFMP_5, ZFMP_6, ZFMP_7)
 see ZFMethodUserRegister_0
 
#define ZFMethodUserRegisterDetail_8(resultMethod, methodInvokerAction, ownerClass, PublicOrProtectedOrPrivate, ZFMethodType_, ReturnType, methodNameString, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4, ZFMP_5, ZFMP_6, ZFMP_7)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_8(methodInvokerAction, ownerClassSig, ReturnType, methodName, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4, ZFMP_5, ZFMP_6, ZFMP_7)
 see ZFMethodUserRegister_0
 
#define ZFMETHOD_USER_REGISTER_DETAIL_8(methodInvokerAction, ownerClassSig, PublicOrProtectedOrPrivate, ZFMethodType_, RegSig, ReturnType, methodName, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4, ZFMP_5, ZFMP_6, ZFMP_7)
 see ZFMethodUserRegister_0
 

Functions

void ZFMethodUserUnregister (const ZFMethod *method)
 see ZFMethodUserRegister_0
 

Detailed Description

user registered ZFMethod

Macro Definition Documentation

◆ ZFMethodUserRegister_0

#define ZFMethodUserRegister_0 ( resultMethod,
methodInvokerAction,
ownerClass,
ReturnType,
methodNameString )

register a custom method to existing class, for advanced reflection use only

example:

// register it, using ZF_GLOBAL_INITIALIZER_INIT is recommended
ZF_GLOBAL_INITIALIZER_INIT(MyMethodRegister) {
return (ReturnType)yourInvoker(invokerMethod, invokerObject, param0, param1);
}, MyClassToAttachTheMethod::ClassData(),
ReturnType, "myMethodName"
, ZFMP_IN(ParamType0, param0)
, ZFMP_IN(ParamType1, param1));
_method = resultMethod;
zfLogTrim() << resultMethod;
}
ZF_GLOBAL_INITIALIZER_DESTROY(MyMethodRegister) {
}
const ZFMethod *_method;
ZF_GLOBAL_INITIALIZER_END(MyMethodRegister)
// or, you may use this macro for short, at cpp files only
return (ReturnType)yourInvoker(invokerMethod, invokerObject, param0, param1);
}, MyClassToAttachTheMethod::ClassData(),
ReturnType, "myMethodName"
, ZFMP_IN(ParamType0, param0)
, ZFMP_IN(ParamType1, param1))
#define ZF_CALLER_LINE
same as LINE in C++ world
Definition ZFCallerInfo.h:56
#define ZF_GLOBAL_INITIALIZER_INIT(Name)
see ZF_GLOBAL_INITIALIZER_INIT_WITH_LEVEL
Definition ZFCoreGlobalInitializer.h:164
#define ZF_GLOBAL_INITIALIZER_DESTROY(Name)
see ZF_GLOBAL_INITIALIZER_INIT_WITH_LEVEL
Definition ZFCoreGlobalInitializer.h:173
#define ZF_GLOBAL_INITIALIZER_END(Name)
see ZF_GLOBAL_INITIALIZER_INIT_WITH_LEVEL
Definition ZFCoreGlobalInitializer.h:187
#define zfLogTrim(...)
see zfLog
Definition ZFLog.h:67
@ ZFMethodTypeStatic
static method
Definition ZFMethod.h:45
#define ZFMP_IN(ParamType, paramName)
macro to wrap param types for ZFMETHOD_INLINE_0 series
Definition ZFMethod.h:105
#define ZFMethodUserRegisterDetail_2(resultMethod, methodInvokerAction, ownerClass, PublicOrProtectedOrPrivate, ZFMethodType_, ReturnType, methodNameString, ZFMP_0, ZFMP_1)
see ZFMethodUserRegister_0
Definition ZFMethodUserRegister.h:422
#define ZFMETHOD_USER_REGISTER_DETAIL_2(methodInvokerAction, ownerClassSig, PublicOrProtectedOrPrivate, ZFMethodType_, RegSig, ReturnType, methodName, ZFMP_0, ZFMP_1)
see ZFMethodUserRegister_0
Definition ZFMethodUserRegister.h:459
void ZFMethodUserUnregister(const ZFMethod *method)
see ZFMethodUserRegister_0
reflectable method for ZFObject
Definition ZFMethod.h:237

note:

  • if there is already a method exist with same method name and method id:
    • if registered to same class, register would fail
    • if registered to different class in inherit tree, child class's one would replace parent class
  • the registered method must be unregister manually at proper time, use ZF_GLOBAL_INITIALIZER_INIT is recommeded
  • once registered, the method can be reflected by ZFClass::methodForName, but there's no way to invoke the method by object directly, it can only be invoked by ZFMethod::execute
See also
ZFMethodDynamicRegister