ZFFramework
 
Loading...
Searching...
No Matches
ZFIdentityUtil.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFIdentityUtil_h_
7#define _ZFI_ZFIdentityUtil_h_
8
10
12
13// ============================================================
14template<typename T_Element>
16zfclassFwd _ZFP_ZFIdentityGeneratorPrivate;
26public:
30 ZFIdentityGenerator &operator = (ZF_IN ZFIdentityGenerator const &ref);
31 zfbool operator == (ZF_IN ZFIdentityGenerator const &ref) const;
32 inline zfbool operator != (ZF_IN ZFIdentityGenerator const &ref) const {return !this->operator == (ref);}
35
36public:
47
51 zfbool idExist(ZF_IN zfidentity identity) const;
52
57
58public:
63 zfstring ret;
64 this->objectInfoT(ret);
65 return ret;
66 }
67
68private:
69 _ZFP_ZFIdentityGeneratorPrivate *d;
70};
71ZFOUTPUT_TYPE(ZFIdentityGenerator, {v.objectInfoT(s);})
72
73// ============================================================
78 ZF_IN const zfchar *src
79 , ZF_IN_OPT zfindex srcLen = zfindexMax()
80 );
85 ZF_IN const void *src
86 , ZF_IN zfindex srcLen
87 );
91template<typename T_Type>
93 return zfidentityCalcBuf(&v, sizeof(T_Type));
94}
95
97
98#endif // #ifndef _ZFI_ZFIdentityUtil_h_
99
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
_ZFT_t_zfchar zfchar
char wrapper
Definition ZFCoreTypeDef_CharType.h:17
#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_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
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
_zft_zfidentity zfidentity
identity type, ensured at least 32 bit, ensured unsigned
Definition ZFCoreTypeDef_CoreType.h:225
#define zfindexMax()
(zfindex)-1, indicate a max index value, see zfindex
Definition ZFCoreTypeDef_CoreType.h:159
types for ZFFramework
#define ZFOUTPUT_TYPE(T_Type, outputAction)
declare your custom type conversion to string, convenient for debug
Definition ZFCoreTypeDef_OtherType.h:221
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
zfidentity zfidentityCalc(T_Type const &v)
calculate identity from POD object
Definition ZFIdentityUtil.h:92
zfidentity zfidentityCalcBuf(const void *src, zfindex srcLen)
calculate identity from raw buffer
zfidentity zfidentityCalcString(const zfchar *src, zfindex srcLen=((zfindex) -1))
calculate identity from string
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
light weight array
Definition ZFCoreArray.h:331
identity generator utility
Definition ZFIdentityUtil.h:25
zfidentity idAcquire(void)
get next identity, ensured valid and ensured unused, and auto mark it as used
zfbool idExist(zfidentity identity) const
true if the identity is not used
zfstring objectInfo(void) const
return object info
Definition ZFIdentityUtil.h:62
void objectInfoT(zfstring &ret) const
see objectInfo
zfbool idRelease(zfidentity identity)
mark the identity unused
void idExistGetAll(ZFCoreArray< zfidentity > &ret) const
get all identity currently used, for debug use only