ZFFramework
Loading...
Searching...
No Matches
Macros | Typedefs
ZFCoreTypeDef_CoreType.h File Reference

types for ZFFramework More...

#include "ZFCoreTypeDef_CoreIntType.h"
#include <cstdarg>
#include <cstdio>
#include <new>

Go to the source code of this file.

Macros

#define zfnullT
 type for zfnull, can be used for function overload
 
#define zfnull
 same as NULL, defined for future use
 
#define zftrue
 bool true type
 
#define zffalse
 bool false type
 
#define zfindexMax()
 (zfindex)-1, indicate a max index value, see zfindex
 
#define zfindexZero()
 zero value
 
#define zfintZero()
 zero value
 
#define zfuintZero()
 zero value
 
#define zffloatZero()
 zero value
 
#define zfdoubleZero()
 zero value
 
#define zflongdoubleZero()
 zero value
 
#define zfbyteZero()
 zero value
 
#define zftimetZero()
 zero value
 
#define zfflagsZero()
 zero value
 
#define zfidentityZero()
 zero value
 
#define zfidentityInvalid()
 an invalid id value, ensured ((zfidentity)-1)
 
#define ZFTOKEN_zfidentityInvalid
 string tokens
 

Typedefs

typedef _ZFT_t_zfbool zfbool
 bool type
 
typedef _ZFT_t_zfbool zft_zfbool
 primitive number type, use only if necessary, for app, use zfbool instead
 
typedef _ZFT_t_zfindex zfindex
 similar to size_t, used for index and size only
 
typedef _ZFT_t_zfindex zft_zfindex
 primitive number type, use only if necessary, for app, use zfindex instead
 
typedef _ZFT_t_zfint zfint
 same as int, see zfindex
 
typedef _ZFT_t_zfint zft_zfint
 primitive number type, use only if necessary, for app, use zfint instead
 
typedef _ZFT_t_zfuint zfuint
 same as unsigned int, see zfindex
 
typedef _ZFT_t_zfuint zft_zfuint
 primitive number type, use only if necessary, for app, use zfuint instead
 
typedef _ZFT_t_zffloat zffloat
 same as float, see zfindex
 
typedef _ZFT_t_zffloat zft_zffloat
 primitive number type, use only if necessary, for app, use zffloat instead
 
typedef _zft_zfdouble zfdouble
 same as double, see zfindex
 
typedef double zft_zfdouble
 primitive number type, use only if necessary, for app, use zfdouble instead
 
typedef _zft_zflongdouble zflongdouble
 same as long double, see zfindex
 
typedef long double zft_zflongdouble
 primitive number type, use only if necessary, for app, use zflongdouble instead
 
typedef _ZFT_t_zfbyte zfbyte
 8-bit unsigned value, see zfindex
 
typedef _ZFT_t_zfbyte zft_zfbyte
 primitive number type, use only if necessary, for app, use zfbyte instead
 
typedef _zft_zftimet zftimet
 time unit, ensured at least 64 bit, ensured signed
 
typedef zft_zfint64 zft_zftimet
 primitive number type, use only if necessary, for app, use zftimet instead
 
typedef _zft_zfflags zfflags
 used to hold flags, ensured 32 bit, ensured unsigned
 
typedef zft_zfuint32 zft_zfflags
 primitive number type, use only if necessary, for app, use zfflags instead
 
typedef _zft_zfidentity zfidentity
 identity type, ensured at least 32 bit, ensured unsigned
 
typedef zft_zfuint32 zft_zfidentity
 primitive number type, use only if necessary, for app, use zfidentity instead
 

Detailed Description

types for ZFFramework

Macro Definition Documentation

◆ zfindexMax

#define zfindexMax ( )

(zfindex)-1, indicate a max index value, see zfindex

See also
zfuint

Typedef Documentation

◆ zfindex

typedef _ZFT_t_zfindex zfindex

similar to size_t, used for index and size only

we use these number types in ZFFramework:

  • zfint, zfuint: normal integer types, size depends on environment
  • zfindex: integer types used for index and size
  • zffloat/zfdouble/zflongdouble: most widely used float type in ZFFramework, size depends on environment
  • zfbyte: for byte types
  • zftimet: for time types
  • zfflags: for flag types
  • zfidentity: for identity types
Warning
take good care of that, zfindex is not ensured same as size_t, so it is not ensured that zfindexMax() is equal to string::npos, e.g.:
zfindex n = std::string::npos;
zfbool b0 = (n == std::string::npos); // true
zfbool b1 = (zfindexMax() == std::string::npos); // not ensured
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:58
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:108
#define zfindexMax()
(zfindex)-1, indicate a max index value, see zfindex
Definition ZFCoreTypeDef_CoreType.h:113
Note
all integer types are ensured differs from each other (by ZFT_INT_STRONG if necessary), so that it's convenient to achieve template specialization
however, as the cost, some math operators may have strange behaviors, use static_cast if necessary
we ensure these types are primitive:
  • zfbool
  • zfchar
  • zfbyte
  • zfint
  • zfuint
  • zfindex
  • zffloat

and only primitive types are safe to be passed to va_arg

for types wrapped by ZFT_INT_STRONG, you may use zft_XXX to access original primitive type

◆ zftimet

typedef _zft_zftimet zftimet

time unit, ensured at least 64 bit, ensured signed

time unit of zftimet is not required, but usually use miliseconds in ZFFramework

◆ zfidentity

typedef _zft_zfidentity zfidentity

identity type, ensured at least 32 bit, ensured unsigned

Note
typically, an identity type has these usage:
  • use as task id, the actual value is not important, and should not be serialized
  • use as event id, the actual value may change during app launch, while event name would be stable

because of the above reasons, zfidentity would always be serialized by the name of ZFIdMapNameForId