capi.h
00001 // File: $Id$
00002 // Author: John Wu <John.Wu at acm.org>
00003 //      Lawrence Berkeley National Laboratory
00004 // Copyright 2006-2012 the Regents of the University of California
00005 #ifndef IBIS_CAPI_H
00006 #define IBIS_CAPI_H
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #if _MSC_VER >= 1000
00023 #pragma once
00024 #endif // _MSC_VER >= 1000
00025 
00026 #if !defined(WITHOUT_FASTBIT_CONFIG_H) && !defined(__MINGW32__) && !defined(_MSC_VER)
00027 #include "fastbit-config.h"
00028 #endif
00029 #if defined(HAVE_SYS_TYPES_H) || defined(__PGI)
00030 #  include <sys/types.h>        // required by PGI compilers (bug 775993)
00031 #endif
00032 #if defined(HAVE_INTTYPES_H) || defined(sun) || defined(__MINGW32__) || defined(__FreeBSD__)
00033 #  include <inttypes.h>
00034 #elif defined(HAVE_STDINT_H) || defined(unix) || defined(__APPLE__)
00035 #  include <stdint.h>
00036 #elif defined(_WIN32) && defined(_MSC_VER)
00037 // MS windows has its own exact-width types, use them
00038 #  ifndef int16_t
00039 #    define int16_t __int16
00040 #  endif
00041 #  ifndef uint16_t
00042 #    define uint16_t unsigned __int16
00043 #  endif
00044 #  ifndef int32_t
00045 #    define int32_t __int32
00046 #  endif
00047 #  ifndef uint32_t
00048 #    define uint32_t unsigned __int32
00049 #  endif
00050 #  ifndef int64_t
00051 #    define int64_t __int64
00052 #  endif
00053 #  ifndef uint64_t
00054 #    define uint64_t unsigned __int64
00055 #  endif
00056 #else
00057 #error Do NOT know how to find the exact width data types!
00058 #endif
00059 
00060 #if defined(_WIN32) && (defined(_MSC_VER) || defined(__MINGW32__))
00061 #  if defined(_USRDLL) || defined(CXX_USE_DLL)
00062 #    if defined(DLL_EXPORT)
00063 #      define FASTBIT_DLLSPEC __declspec(dllexport)
00064 #    else
00065 #      define FASTBIT_DLLSPEC __declspec(dllimport)
00066 #    endif
00067 #  else
00068 #    define FASTBIT_DLLSPEC
00069 #  endif
00070 #else
00071 #  define FASTBIT_DLLSPEC
00072 #endif
00073 
00074 #include <stdio.h>      // FILE*
00075 
00078 #ifdef __cplusplus
00079 extern "C" {
00080 #endif
00081 
00082     FASTBIT_DLLSPEC int
00083     fastbit_build_indexes(const char *indexLocation,
00084                           const char *indexOptions);
00086     FASTBIT_DLLSPEC int fastbit_purge_indexes(const char *indexLocation);
00088     FASTBIT_DLLSPEC int
00089     fastbit_build_index(const char *indexLocation, const char* cname,
00090                         const char *indexOptions);
00092     FASTBIT_DLLSPEC int
00093     fastbit_purge_index(const char *indexLocation, const char* cname);
00094     FASTBIT_DLLSPEC int fastbit_reorder_partition(const char *dir);
00095 
00097     struct FastBitQuery;
00099     typedef struct FastBitQuery* FastBitQueryHandle;
00100 
00102     FASTBIT_DLLSPEC FastBitQueryHandle
00103     fastbit_build_query(const char *selectClause, const char *indexLocation,
00104                         const char *queryConditions);
00107     FASTBIT_DLLSPEC int fastbit_destroy_query(FastBitQueryHandle query);
00108 
00112     FASTBIT_DLLSPEC int fastbit_get_result_rows(FastBitQueryHandle query);
00115     FASTBIT_DLLSPEC int fastbit_get_result_columns(FastBitQueryHandle query);
00117     FASTBIT_DLLSPEC const char*
00118     fastbit_get_select_clause(FastBitQueryHandle query);
00120     FASTBIT_DLLSPEC const char*
00121     fastbit_get_from_clause(FastBitQueryHandle query);
00123     FASTBIT_DLLSPEC const char*
00124     fastbit_get_where_clause(FastBitQueryHandle query);
00125 
00135     FASTBIT_DLLSPEC const float*
00136     fastbit_get_qualified_floats(FastBitQueryHandle query,
00137                                  const char* cname);
00138     FASTBIT_DLLSPEC const double*
00139     fastbit_get_qualified_doubles(FastBitQueryHandle query,
00140                                   const char* cname);
00141     FASTBIT_DLLSPEC const signed char*
00142     fastbit_get_qualified_bytes(FastBitQueryHandle query,
00143                                 const char* cname);
00144     FASTBIT_DLLSPEC const int16_t*
00145     fastbit_get_qualified_shorts(FastBitQueryHandle query,
00146                                  const char* cname);
00147     FASTBIT_DLLSPEC const int32_t*
00148     fastbit_get_qualified_ints(FastBitQueryHandle query,
00149                                const char* cname);
00150     FASTBIT_DLLSPEC const int64_t*
00151     fastbit_get_qualified_longs(FastBitQueryHandle query,
00152                                 const char* cname);
00153     FASTBIT_DLLSPEC const unsigned char*
00154     fastbit_get_qualified_ubytes(FastBitQueryHandle query,
00155                                  const char* cname);
00156     FASTBIT_DLLSPEC const uint16_t*
00157     fastbit_get_qualified_ushorts(FastBitQueryHandle query,
00158                                   const char* cname);
00159     FASTBIT_DLLSPEC const uint32_t*
00160     fastbit_get_qualified_uints(FastBitQueryHandle query,
00161                                 const char* cname);
00162     FASTBIT_DLLSPEC const uint64_t*
00163     fastbit_get_qualified_ulongs(FastBitQueryHandle query,
00164                                  const char* cname);
00165     FASTBIT_DLLSPEC const char**
00166     fastbit_get_qualified_strings(FastBitQueryHandle query,
00167                                   const char* cname);
00169 
00174     struct FastBitResultSet;
00176     typedef struct FastBitResultSet* FastBitResultSetHandle;
00177 
00179     FASTBIT_DLLSPEC FastBitResultSetHandle
00180     fastbit_build_result_set(FastBitQueryHandle query);
00182     FASTBIT_DLLSPEC int
00183     fastbit_destroy_result_set(FastBitResultSetHandle rset);
00184 
00186     FASTBIT_DLLSPEC int fastbit_result_set_next(FastBitResultSetHandle);
00188     FASTBIT_DLLSPEC int fastbit_result_set_next_bundle(FastBitResultSetHandle);
00190     FASTBIT_DLLSPEC int
00191     fastbit_result_set_get_int(FastBitResultSetHandle rset, const char *cname);
00193     FASTBIT_DLLSPEC unsigned
00194     fastbit_result_set_get_unsigned(FastBitResultSetHandle rset,
00195                                     const char *cname);
00197     FASTBIT_DLLSPEC int64_t
00198     fastbit_result_set_get_long(FastBitResultSetHandle rset,
00199                                 const char *cname);
00202     FASTBIT_DLLSPEC float
00203     fastbit_result_set_get_float(FastBitResultSetHandle rset,
00204                                  const char *cname);
00207     FASTBIT_DLLSPEC double
00208     fastbit_result_set_get_double(FastBitResultSetHandle rset,
00209                                   const char *cname);
00211     FASTBIT_DLLSPEC const char*
00212     fastbit_result_set_get_string(FastBitResultSetHandle rset,
00213                                   const char *cname);
00218     FASTBIT_DLLSPEC int32_t
00219     fastbit_result_set_getInt(FastBitResultSetHandle rset,
00220                               unsigned position);
00222     FASTBIT_DLLSPEC uint32_t
00223     fastbit_result_set_getUnsigned(FastBitResultSetHandle rset,
00224                                    unsigned position);
00226     FASTBIT_DLLSPEC int64_t
00227     fastbit_result_set_getLong(FastBitResultSetHandle rset,
00228                                 unsigned position);
00231     FASTBIT_DLLSPEC float
00232     fastbit_result_set_getFloat(FastBitResultSetHandle rset,
00233                                 unsigned position);
00236     FASTBIT_DLLSPEC double
00237     fastbit_result_set_getDouble(FastBitResultSetHandle rset,
00238                                  unsigned position);
00240     FASTBIT_DLLSPEC const char*
00241     fastbit_result_set_getString(FastBitResultSetHandle rset,
00242                                  unsigned position);
00244 
00246     FASTBIT_DLLSPEC int fastbit_flush_buffer(const char *dir);
00249     FASTBIT_DLLSPEC int
00250     fastbit_add_values(const char *colname, const char *coltype,
00251                        void *vals, uint32_t nelem, uint32_t start);
00253     FASTBIT_DLLSPEC int fastbit_rows_in_partition(const char *dir);
00255     FASTBIT_DLLSPEC int fastbit_columns_in_partition(const char *dir);
00256 
00258     FASTBIT_DLLSPEC void fastbit_init(const char *rcfile);
00260     FASTBIT_DLLSPEC void fastbit_cleanup(void);
00262     FASTBIT_DLLSPEC int  fastbit_set_verbose_level(int v);
00264     FASTBIT_DLLSPEC int  fastbit_get_verbose_level(void);
00266     FASTBIT_DLLSPEC int  fastbit_set_logfile(const char* filename);
00268     FASTBIT_DLLSPEC const char* fastbit_get_logfile();
00270     FASTBIT_DLLSPEC FILE* fastbit_get_logfilepointer();
00271 
00273     FASTBIT_DLLSPEC const char* fastbit_get_version_string();
00275     FASTBIT_DLLSPEC int fastbit_get_version_number();
00276 #ifdef __cplusplus
00277 }
00278 #endif
00279 
00280 #endif // ifndef IBIS_CAPI_H

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