iapi.h
1 /* File: $Id$
2  Author: John Wu <John.Wu at acm.org>
3  Lawrence Berkeley National Laboratory
4  Copyright (c) 2001-20164-2014 the Regents of the University of California
5 */
6 #ifndef IBIS_IAPI_H
7 #define IBIS_IAPI_H
8 
27 #include "const.h" // common definitions and declarations
28 #include "capi.h" // reuse the definitions from capi.h
29 
42 typedef enum FastBitDataType {
43  FastBitDataTypeUnknown,
44  FastBitDataTypeByte,
45  FastBitDataTypeUByte,
46  FastBitDataTypeShort,
47  FastBitDataTypeUShort,
48  FastBitDataTypeInt,
49  FastBitDataTypeUInt,
50  FastBitDataTypeLong,
51  FastBitDataTypeULong,
52  FastBitDataTypeFloat,
53  FastBitDataTypeDouble,
54  FastBitDataTypeBitRaw,
55  FastBitDataTypeBitCompressed
56 } FastBitDataType;
57 
60 typedef enum FastBitCompareType {
61  FastBitCompareLess,
62  FastBitCompareLessEqual,
63  FastBitCompareGreater,
64  FastBitCompareGreaterEqual,
65  FastBitCompareEqual,
66  FastBitCompareNotEqual,
67 } FastBitCompareType;
68 
72 typedef enum FastBitCombineType {
73  FastBitCombineAnd,
74  FastBitCombineOr,
75  FastBitCombineXor,
76  FastBitCombineNand,
77  FastBitCombineNor,
78 } FastBitCombineType;
79 
81 #ifdef __cplusplus
82 typedef ibis::qExpr* FastBitSelectionHandle;
83 #else
84 typedef void* FastBitSelectionHandle;
85 #endif
86 typedef void* FastBitIndexHandle;
87 
92 #ifdef __cplusplus
93 extern "C" {
94 #endif
95 
98  FastBitSelectionHandle fastbit_selection_osr
99  (const char*, FastBitCompareType, double);
100 
102  void fastbit_selection_free(FastBitSelectionHandle);
103 
105  FastBitSelectionHandle fastbit_selection_combine
106  (FastBitSelectionHandle, FastBitCombineType, FastBitSelectionHandle);
107 
109  int64_t fastbit_selection_estimate(FastBitSelectionHandle);
110 
112  int64_t fastbit_selection_evaluate(FastBitSelectionHandle);
113 
117  (FastBitSelectionHandle, uint64_t*, uint64_t, uint64_t);
118 
119  int64_t fastbit_selection_read
120  (FastBitDataType, const void *, uint64_t, FastBitSelectionHandle,
121  void *, uint64_t, uint64_t);
122 
124  void fastbit_selection_purge_results(FastBitSelectionHandle);
126  void fastbit_iapi_free_all();
128  void fastbit_iapi_free_array(const char *);
132  void fastbit_iapi_free_array_by_addr(void *);
135  (const char*, FastBitDataType, void*, uint64_t);
138  (const char*, FastBitDataType, void*, uint64_t);
141  (const char*, FastBitDataType, void*, uint64_t*, uint64_t);
144  (const char*, FastBitDataType, uint64_t*, uint64_t, void*,
148  (const char*, FastBitDataType, uint64_t*, uint64_t,
149  double*, uint64_t, int64_t*, uint64_t, void*, FastBitReadBitmaps);
152  (const char*, FastBitSelectionHandle);
155  (const char*, FastBitSelectionHandle);
156 
158  int fastbit_iapi_build_index(const char*, const char*);
159 
165  (const char*, double**keys, uint64_t*nkeys,
166  int64_t**offsets, uint64_t*noffsets,
167  uint32_t**bms, uint64_t*nbms);
168 
176  (const char*, double*, uint64_t, int64_t*, uint64_t, uint32_t*, uint64_t);
177 
185  (const char*, double*, uint64_t, int64_t*, uint64_t,
186  void*, FastBitReadBitmaps);
187 
194  FastBitIndexHandle fastbit_iapi_reconstruct_index
195  (double*, uint64_t, int64_t*, uint64_t);
196 
202  (FastBitIndexHandle, FastBitCompareType, double, uint32_t *,
203  uint32_t *, uint32_t *, uint32_t *);
204 
210  (FastBitIndexHandle, uint32_t, uint32_t, uint32_t*);
211 
216  FastBitSelectionHandle fastbit_selection_create
217  (FastBitDataType, void*, uint64_t, FastBitCompareType, void*);
218 
223  FastBitSelectionHandle fastbit_selection_create_nd
224  (FastBitDataType, void*, uint64_t*, uint64_t, FastBitCompareType, void*);
225 #ifdef __cplusplus
226 } /* extern "C" */
227 #endif
228 #endif
229 
int fastbit_iapi_resolve_range(FastBitIndexHandle, FastBitCompareType, double, uint32_t *, uint32_t *, uint32_t *, uint32_t *)
Evalute a range condition on an index data structure.
Definition: iapi.cpp:1982
int(* FastBitReadExtArray)(void *context, uint64_t nd, uint64_t *starts, uint64_t *counts, void *data)
A function prototype for reading a portion of an external array.
Definition: const.h:365
int64_t fastbit_selection_evaluate(FastBitSelectionHandle)
Compute the number of hits.
Definition: iapi.cpp:1383
FastBitSelectionHandle fastbit_selection_combine(FastBitSelectionHandle, FastBitCombineType, FastBitSelectionHandle)
Combining two selection conditions into one.
Definition: iapi.cpp:1286
int fastbit_iapi_deconstruct_index(const char *, double **keys, uint64_t *nkeys, int64_t **offsets, uint64_t *noffsets, uint32_t **bms, uint64_t *nbms)
Write index into three arrays.
Definition: iapi.cpp:1916
void fastbit_iapi_free_array_by_addr(void *)
Remove an array from the list of known variables.
Definition: iapi.cpp:1598
The top level query expression object.
Definition: qExpr.h:36
int fastbit_iapi_register_array_index_only(const char *, FastBitDataType, uint64_t *, uint64_t, double *, uint64_t, int64_t *, uint64_t, void *, FastBitReadBitmaps)
Register an array under the specified name.
Definition: iapi.cpp:1864
int fastbit_iapi_register_array_nd(const char *, FastBitDataType, void *, uint64_t *, uint64_t)
Register a n-dimensional array under the specified name.
Definition: iapi.cpp:1801
FastBitIndexHandle fastbit_iapi_reconstruct_index(double *, uint64_t, int64_t *, uint64_t)
Reconstitute the index data structure from the first two arrays produced by fastbit_iapi_write_index...
Definition: iapi.cpp:1956
int64_t fastbit_iapi_get_number_of_hits(FastBitIndexHandle, uint32_t, uint32_t, uint32_t *)
Retrieve the numbers of values in the given range.
Definition: iapi.cpp:2012
FastBitSelectionHandle fastbit_selection_create(FastBitDataType, void *, uint64_t, FastBitCompareType, void *)
Create a simple one-sided range condition.
Definition: iapi.cpp:1155
int fastbit_iapi_register_array(const char *, FastBitDataType, void *, uint64_t)
Register a simple array under the specified name.
Definition: iapi.cpp:1645
int fastbit_iapi_extend_bit_array_with_selection(const char *, FastBitSelectionHandle)
Extend the array with the given name with new content.
Definition: iapi.cpp:2110
int fastbit_iapi_build_index(const char *, const char *)
Build index.
Definition: iapi.cpp:1894
int fastbit_iapi_attach_full_index(const char *, double *, uint64_t, int64_t *, uint64_t, uint32_t *, uint64_t)
Attach an index to a column already registered.
Definition: iapi.cpp:2020
int fastbit_iapi_register_array_ext(const char *, FastBitDataType, uint64_t *, uint64_t, void *, FastBitReadExtArray)
Register an external array under the specified name.
Definition: iapi.cpp:1835
int64_t fastbit_selection_estimate(FastBitSelectionHandle)
Provide an upper bound on the number of hits.
Definition: iapi.cpp:1345
void fastbit_selection_free(FastBitSelectionHandle)
Free/destroy the selection object.
Definition: iapi.cpp:1265
void fastbit_selection_purge_results(FastBitSelectionHandle)
Free in-memory resources associated with the selection handle.
Definition: iapi.cpp:1563
int64_t fastbit_selection_get_coordinates(FastBitSelectionHandle, uint64_t *, uint64_t, uint64_t)
Extract the coordinates of the elements of arrays satisfying the selection conditions.
Definition: iapi.cpp:1518
void fastbit_iapi_free_all()
Free all cached object for IAPI.
Definition: iapi.cpp:1576
int fastbit_iapi_register_selection_as_bit_array(const char *, FastBitSelectionHandle)
Register query result as a bit array.
Definition: iapi.cpp:2097
Defines common data types, constants and macros.
int64_t fastbit_selection_read(FastBitDataType, const void *, uint64_t, FastBitSelectionHandle, void *, uint64_t, uint64_t)
Fill the buffer (buf) with the next set of values satisfying the selection criteria.
Definition: iapi.cpp:1432
int fastbit_iapi_extend_array(const char *, FastBitDataType, void *, uint64_t)
Extend the array with the given name with new content.
Definition: iapi.cpp:1681
int(* FastBitReadBitmaps)(void *context, uint64_t start, uint64_t count, uint32_t *data)
A function prototype for delayed index reconstruction.
Definition: const.h:341
FastBitSelectionHandle fastbit_selection_osr(const char *, FastBitCompareType, double)
Create a simple one-sided range condition.
Definition: iapi.cpp:2063
void fastbit_iapi_free_array(const char *)
Remove an array from the list of known variables.
Definition: iapi.cpp:1581
int fastbit_iapi_attach_index(const char *, double *, uint64_t, int64_t *, uint64_t, void *, FastBitReadBitmaps)
Attach an index to a column already registered.
Definition: iapi.cpp:2040
FastBitSelectionHandle fastbit_selection_create_nd(FastBitDataType, void *, uint64_t *, uint64_t, FastBitCompareType, void *)
Create a simple one-sided range condition on a n-dimensional array.
Definition: iapi.cpp:1211

Make It A Bit Faster
Contact us
Disclaimers
FastBit source code
FastBit mailing list archive