⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdk.h

📁 这个是内存数据库中的一个管理工具
💻 H
📖 第 1 页 / 共 4 页
字号:
/* The batRestricted field indicates whether a BAT is readonly. * we have modes: BAT_WRITE  = all permitted *                BAT_APPEND = append-only *                BAT_READ   = read-only * VIEW bats are always mapped read-only. */#define	VIEWchk(x,y,z)							  	\	if ((((x)->batRestricted & (z)) != 0) | ((x)->batSharecnt > 0)) {	 \		GDKerror("%s: access denied to %s, aborting.\n", y, BATgetId(x));\		return 0;							 \	}/* the parentid in a VIEW is correct for the normal view. We must correct * for the reversed view. A special case are the VIEWcombine bats, these * always refer to the same parent column (i.e. no correction needed) */#define VIEWparent(x)	((x)->batLview?0:\                         ((x)->H == (x)->T || (x)->batCacheid >= 0)?(x)->batParentid:-(x)->batParentid)/* VIEWparentcol(b) tells whether the head column was inherited from the parent * "as is". We must check whether the type was not overridden in the view. */#define VIEWparentcol(b) ((VIEWparent(b) && (b)->htype			\			   && (b)->htype == BBP_cache(VIEWparent(b))->htype \			   && (b)->hloc == BBP_cache(VIEWparent(b))->hloc) \			  ?VIEWparent(b):0)#define BATloop(r,	p, q) \	for(q = BUNlast(r), p = BUNfirst(r);p < q; p = BUNnext(r, p))#define BATloopFast(r,	p, q, x) \	for(q = BUNlast(r), x = BUNsize(r), p = BUNfirst(r); p < q; p += x)#define BATloopDEL(r, p, q, x)						\	for(p = BUNfirst(r), q = BUNlast(r), x = BUNsize(r); p < q;	\	    q=MIN(q,BUNlast(r)), p += x)#define DELloop(b, p, q, x)						\	for (q = (b)->batFirst, p = (b)->batDeleted, x=BUNsize(b); p < q; p += x)#define GDK_STREQ(l,r) (*(char*) (l) == *(char*) (r) && !strcmp(l,r))#define HASHloop(b, h, hb, v)						\	for (hb = h->hash[HASHprobe(h, v)]; hb != HASH_MAX; hb = h->link[hb])	\		if (ATOMcmp(h->type, v, BUNhead(b, BUNptr(b, hb))) == 0)#define HASHloop_str(b,	h, hb, v)					\	for (hb = h->hash[strHash(v)&h->mask]; hb != HASH_MAX; hb = h->link[hb])	\		if (GDK_STREQ(v, BUNhvar(b, BUNptr(b, hb))))#define HASHloop_fstr(b, h, hb, idx, v)					\	for (hb = h->hash[strHash(v)&h->mask], idx = strLocate((b)->hheap,v); \	     hb != HASH_MAX; hb = h->link[hb])					\		     if (*(var_t*) BUNhloc(b, BUNptr(b, hb)) == idx)#define HASHlooploc(b,	h, hb, v, w)					\	for (hb = h->hash[HASHprobe(h, v)]; hb != HASH_MAX; hb = h->link[hb])	\		if ((w=BUNptr(b, hb)) != NULL && ATOMcmp(h->type, v, BUNhloc(b, w)) == 0)#define HASHloopvar(b,	h, hb, v, w)					\	for (hb = h->hash[HASHprobe(h, v)]; hb != HASH_MAX; hb = h->link[hb])	\		if ((w=BUNptr(b, hb)) != NULL && ATOMcmp(h->type, v, BUNhvar(b, w)) == 0)#define HASHloop_bit(b,h,hb,v,w)						\	for (hb = h->hash[hash_chr(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), bte))#define HASHloop_chr(b,h,hb,v,w)						\	for (hb = h->hash[hash_chr(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), chr))#define HASHloop_bte(b,h,hb,v,w)						\	for (hb = h->hash[hash_bte(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), bte))#define HASHloop_sht(b,h,hb,v,w)						\	for (hb = h->hash[hash_sht(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), sht))#define HASHloop_int(b,h,hb,v,w)						\	for (hb = h->hash[hash_int(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), int))#if SIZEOF_OID == SIZEOF_INT#define HASHloop_oid(b,h,hb,v,w)						\	for (hb = h->hash[hash_int(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), int))	/* OIDDEPEND */#else#define HASHloop_oid(b,h,hb,v,w)						\	for (hb = h->hash[hash_lng(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), lng))	/* OIDDEPEND */#endif#if SIZEOF_WRD == SIZEOF_INT#define HASHloop_wrd(b,h,hb,v,w)						\	for (hb = h->hash[hash_int(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), int))#else#define HASHloop_wrd(b,h,hb,v,w)						\	for (hb = h->hash[hash_lng(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), lng))#endif#define HASHloop_bat(b,h,hb,v,w)						\	for (hb = h->hash[hash_int(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), int))#if SIZEOF_VOID_P == SIZEOF_INT#define HASHloop_ptr(b,h,hb,v,w)						\	for (hb = h->hash[hash_int(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), int))#else /* SIZEOF_VOID_P == SIZEOF_LNG */#define HASHloop_ptr(b,h,hb,v,w)						\	for (hb = h->hash[hash_lng(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), lng))#endif#define HASHloop_flt(b,h,hb,v,w)						\	for (hb = h->hash[hash_int(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), int))#define HASHloop_lng(b,h,hb,v,w)						\	for (hb = h->hash[hash_lng(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), lng))#define HASHloop_dbl(b,h,hb,v,w)						\	for (hb = h->hash[hash_lng(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && simple_EQ(v, BUNhloc(b, w), lng))#define HASHloop_any(b,h,hb,v,w)						\	for (hb = h->hash[hash_any(h,v)]; hb != HASH_MAX; hb = h->link[hb])		\		if ((w=BUNptr(b, hb)) != NULL && atom_EQ(v, BUNhead(b, w), (b)->htype))#define SORTloop(b,p,q,tl,th,s)						\	if (!(BATtordered(b)&1)) GDKerror("SORTloop: BAT not sorted.\n"); \	else for (p = (ATOMcmp((b)->ttype,tl,ATOMnilptr((b)->ttype))?	\		     SORTfndfirst(b,tl):BUNfirst(b)),			\		  q = (ATOMcmp((b)->ttype,th,ATOMnilptr((b)->ttype))?	\		     SORTfndlast(b,th):BUNlast(b)),			\		  s = BUNsize(b); p < q; p += s)#define SORTloop_chr(b,p,q,tl,th,s)					\	if (!(BATtordered(b)&1)) GDKerror("SORTloop_chr: BAT not sorted.\n"); \	else for (p = simple_EQ(tl,&chr_nil,chr)?BUNfirst(b):SORTfndfirst_chr(b,tl), \		  q = simple_EQ(th,&chr_nil,chr)?BUNfirst(b):SORTfndlast_chr(b,th),	\		  s = BUNsize(b); p < q; p += s)#define SORTloop_bte(b,p,q,tl,th,s)					\	if (!(BATtordered(b)&1)) GDKerror("SORTloop_bte: BAT not sorted.\n"); \	else for (p = simple_EQ(tl,&bte_nil,bte)?BUNfirst(b):SORTfndfirst_bte(b,tl), \		  q = simple_EQ(th,&bte_nil,bte)?BUNfirst(b):SORTfndlast_bte(b,th),	\		  s = BUNsize(b); p < q; p += s)#define SORTloop_sht(b,p,q,tl,th,s)					\	if (!(BATtordered(b)&1)) GDKerror("SORTloop_sht: BAT not sorted.\n"); \	else for (p = simple_EQ(tl,&sht_nil,sht)?BUNfirst(b):SORTfndfirst_sht(b,tl), \		  q = simple_EQ(th,&sht_nil,sht)?BUNfirst(b):SORTfndlast_sht(b,th),	\		  s = BUNsize(b); p < q; p += s)#define SORTloop_int(b,p,q,tl,th,s)					\	if (!(BATtordered(b)&1)) GDKerror("SORTloop_int: BAT not sorted.\n"); \	else for (p = simple_EQ(tl,&int_nil,int)?BUNfirst(b):SORTfndfirst_int(b,tl), \		  q = simple_EQ(th,&int_nil,int)?BUNfirst(b):SORTfndlast_int(b,th),	\		  s = BUNsize(b); p < q; p += s)#define SORTloop_flt(b,p,q,tl,th,s)					\	if (!(BATtordered(b)&1)) GDKerror("SORTloop_flt: BAT not sorted.\n"); \	else for (p = simple_EQ(tl,&flt_nil,flt)?BUNfirst(b):SORTfndfirst_flt(b,tl), \		  q = simple_EQ(th,&flt_nil,flt)?BUNfirst(b):SORTfndlast_flt(b,th),	\		  s = BUNsize(b); p < q; p += s)#define SORTloop_lng(b,p,q,tl,th,s)					\	if (!(BATtordered(b)&1)) GDKerror("SORTloop_lng: BAT not sorted.\n"); \	else for (p = simple_EQ(tl,&lng_nil,lng)?BUNfirst(b):SORTfndfirst_lng(b,tl), \		  q = simple_EQ(th,&lng_nil,lng)?BUNfirst(b):SORTfndlast_lng(b,th),	\		  s = BUNsize(b); p < q; p += s)#define SORTloop_dbl(b,p,q,tl,th,s)					\	if (!(BATtordered(b)&1)) GDKerror("SORTloop_dbl: BAT not sorted.\n"); \	else for (p = simple_EQ(tl,&dbl_nil,dbl)?BUNfirst(b):SORTfndfirst_dbl(b,tl), \		  q = simple_EQ(th,&dbl_nil,dbl)?BUNfirst(b):SORTfndlast_dbl(b,th),	\		  s = BUNsize(b); p < q; p += s)#define SORTloop_loc(b,p,q,tl,th,s)					\	if (!(BATtordered(b)&1)) GDKerror("SORTloop_loc: BAT not sorted.\n"); \	else for (p = atom_EQ(tl,ATOMnilptr((b)->ttype),(b)->ttype)?BUNfirst(b):SORTfndfirst_loc(b,tl), \		  q = atom_EQ(th,ATOMnilptr((b)->ttype),(b)->ttype)?BUNfirst(b):SORTfndlast_loc(b,th),	\		  s = BUNsize(b); p < q; p += s)#define SORTloop_var(b,p,q,tl,th,s)					\	if (!(BATtordered(b)&1)) GDKerror("SORTloop_var: BAT not sorted.\n"); \	else for (p = atom_EQ(tl,ATOMnilptr((b)->ttype),(b)->ttype)?BUNfirst(b):SORTfndfirst_var(b,tl), \		  q = atom_EQ(th,ATOMnilptr((b)->ttype),(b)->ttype)?BUNfirst(b):SORTfndlast_var(b,th),	\		  s = BUNsize(b); p < q; p += s)/* OIDDEPEND */#if SIZEOF_OID == SIZEOF_INT#define SORTfnd_oid(b,v)	SORTfnd_int(b,v)#define SORTfndfirst_oid(b,v)	SORTfndfirst_int(b,v)#define SORTfndlast_oid(b,v)	SORTfndlast_int(b,v)#define SORTloop_oid(b,p,q,tl,th,s) SORTloop_int(b,p,q,tl,th,s)#else#define SORTfnd_oid(b,v)	SORTfnd_lng(b,v)#define SORTfndfirst_oid(b,v)	SORTfndfirst_lng(b,v)#define SORTfndlast_oid(b,v)	SORTfndlast_lng(b,v)#define SORTloop_oid(b,p,q,tl,th,s) SORTloop_lng(b,p,q,tl,th,s)#endif#if SIZEOF_WRD == SIZEOF_INT#define SORTfnd_wrd(b,v)	SORTfnd_int(b,v)#define SORTfndfirst_wrd(b,v)	SORTfndfirst_int(b,v)#define SORTfndlast_wrd(b,v)	SORTfndlast_int(b,v)#define SORTloop_wrd(b,p,q,tl,th,s) SORTloop_int(b,p,q,tl,th,s)#else#define SORTfnd_wrd(b,v)	SORTfnd_lng(b,v)#define SORTfndfirst_wrd(b,v)	SORTfndfirst_lng(b,v)#define SORTfndlast_wrd(b,v)	SORTfndlast_lng(b,v)#define SORTloop_wrd(b,p,q,tl,th,s) SORTloop_lng(b,p,q,tl,th,s)#endif#define SORTloop_bit(b,p,q,tl,th,s) SORTloop_chr(b,p,q,tl,th,s)#define GDK_AGGR_SIZE 1#define GDK_AGGR_CARD 2#define GDK_AGGR_HASNIL 3gdk_export void PROPdestroy(PROPrec *p);gdk_export bit BATgetprop_bit(BAT *b, int idx);gdk_export int BATgetprop_int(BAT *b, int idx);gdk_export wrd BATgetprop_wrd(BAT *b, int idx);gdk_export const char *BATgetprop_str(BAT *b, int idx);gdk_export void BATsetprop_bit(BAT *b, int idx, bit val);gdk_export void BATsetprop_int(BAT *b, int idx, int val);gdk_export void BATsetprop_wrd(BAT *b, int idx, wrd val);gdk_export void BATsetprop_str(BAT *b, int idx, str val);gdk_export void BATpropagate(BAT *dst, BAT *src, int idx);gdk_export BAT *BATsample(BAT *b, size_t n);gdk_export BAT *BAThistogram(BAT *b);gdk_export size_t BATtopN(BAT *b, size_t topN);	/* used in monet5/src/modules/kernel/algebra.mx */#define AGGR_MAGIC	111#define NOID(x)		((oid)(x))#define NOID_AGGR(x)	NOID_MULT(AGGR_MAGIC,x)#define NOID_MULT(x,y)	NOID( (lng)(y)*(lng)(x) )#define JOIN_EQ	0#define JOIN_LT	-1#define JOIN_LE	-2#define JOIN_GT	1#define JOIN_GE	2#define JOIN_BAND 3gdk_export BAT *BATfragment(BAT *b, ptr hl, ptr hh, ptr tl, ptr th);gdk_export BAT *BAT_select_(BAT *b, ptr tl, ptr th, bit li, bit hi, bit tail, bit preserve_order);gdk_export BAT *BAT_select(BAT *b, ptr tl, ptr th, bit tail);gdk_export BAT *BATselect_(BAT *b, ptr tl, ptr th, bit li, bit hi);gdk_export BAT *BATuselect_(BAT *b, ptr tl, ptr th, bit li, bit hi);gdk_export BAT *BATselect(BAT *b, ptr tl, ptr th);gdk_export BAT *BATuselect(BAT *b, ptr tl, ptr th);gdk_export BAT *BATrestrict(BAT *b, ptr hl, ptr hh, ptr tl, ptr th);gdk_export BAT *BATconst(BAT *l, int tt, ptr val);gdk_export BAT *BATthetajoin(BAT *l, BAT *r, int mode, size_t estimate);gdk_export BAT *BATleftthetajoin(BAT *l, BAT *r, int mode, size_t estimate);gdk_export BAT *BATnlthetajoin(BAT *l, BAT *r, int mode, size_t estimate);gdk_export BAT *BATbandjoin(BAT *l, BAT *r, ptr c1, ptr c2);	/* should bandjoin remain in the kernel? */gdk_export BAT *BATsemijoin(BAT *l, BAT *r);gdk_export BAT *BATmergejoin(BAT *l, BAT *r, size_t estimate);gdk_export BAT *BATleftmergejoin(BAT *l, BAT *r, size_t estimate);gdk_export BAT *BATjoin(BAT *l, BAT *r, size_t estimate);gdk_export BAT *BATantijoin(BAT *l, BAT *r);gdk_export BAT *BATleftjoin(BAT *l, BAT *r, size_t estimate);gdk_export BAT *BATouterjoin(BAT *l, BAT *r, size_t estimate);gdk_export BAT *BATcross(BAT *l, BAT *r);gdk_export BAT *BATslice(BAT *b, size_t low, size_t high);gdk_export BAT *BATfetch(BAT *b, BAT *s);gdk_export BAT *BATfetchjoin(BAT *b, BAT *s, size_t estimate);gdk_export BAT *BATleftfetchjoin(BAT *b, BAT *s, size_t estimate);gdk_export BAT *BATins_kunique(BAT *bn, BAT *b);gdk_export BAT *BATsunique(BAT *b);gdk_export BAT *BATkunique(BAT *b);gdk_export BAT *BATukunique(BAT *b);gdk_export BAT *BATsintersect(BAT *b, BAT *c);gdk_export BAT *BATkintersect(BAT *b, BAT *c);gdk_export BAT *BATsunion(BAT *b, BAT *c);gdk_export BAT *BATkunion(BAT *b, BAT *c);gdk_export BAT *BATsdiff(BAT *b, BAT *c);gdk_export BAT *BATkdiff(BAT *b, BAT *c);/* generic n-ary multijoin beast, with defines to interpret retval */#define MULTIJOIN_SORTED(r)	((char*) &r)[0]#define MULTIJOIN_KEY(r)	((char*) &r)[1]#define MULTIJOIN_SYNCED(r)	((char*) &r)[2]#define MULTIJOIN_LEAD(r)	((char*) &r)[3]typedef void (*ColFcn) (ptr, ptr);typedef void (*RowFcn) (ptr, ptr *);gdk_export int BATmultijoin(int argc, BAT *argv[], RowFcn tuple_fcn, ptr tuple_data, ColFcn value_fcn[], ptr value_data[], int orderspec);#ifdef __cplusplus}#endif#define ILLEGALVALUE	((ptr)-1L)#define MAXPARAMS	32#endif /* _GDK_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -