15 #if defined(DEBUG) && !defined(_DEBUG)
17 #elif !defined(DEBUG) && defined(_DEBUG) && _DEBUG + 0 > 1
18 # define DEBUG _DEBUG - 1
27 #ifndef _ISOC90_SOURCE
28 # define _ISOC90_SOURCE
31 #if defined(__SUNPRO_CC)
32 # ifndef __EXTENSIONS__
33 # define __EXTENSIONS__
37 # ifdef _POSIX_C_SOURCE
38 # undef _POSIX_C_SOURCE
40 # ifndef _XOPEN_VERSION
41 # define _XOPEN_VERSION 4
43 # undef _XOPEN_VERSION
44 # define _XOPEN_VERSION 4
50 #ifndef HAVE_STRUCT_TIMESPEC
51 #if defined(__CYGWIN__) || defined(__MINGW32__) || (_MSC_VER+0 >= 1900)
52 # define HAVE_STRUCT_TIMESPEC
74 #if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
76 # define _CRTDBG_MAP_ALLOC
84 #if !defined(WITHOUT_FASTBIT_CONFIG_H) && !defined(__MINGW32__) && !defined(_MSC_VER)
85 # include "fastbit-config.h"
86 # ifdef HAVE_SYS_TYPES_H
87 # include <sys/types.h>
93 # if defined(__unix__)||defined(__linux__)||defined(__APPLE__)||defined(__CYGWIN__)||defined(__FreeBSD__)
94 # define HAVE_VPRINTF 1
95 # define HAVE_DIRENT_H 1
97 # if !defined(_MSC_VER)
103 #if defined(__SUNPRO_CC)
104 # if defined(_REENTRANT)
108 # define errno (*(::___errno()))
109 # endif // defined(_REENTRANT)
120 #ifndef FASTBIT_STRING
121 #define FASTBIT_STRING "FastBit ibis"
125 #define MAX_LINE 2048
136 #ifndef PREFERRED_BLOCK_SIZE
137 #define PREFERRED_BLOCK_SIZE 1048576
143 #if defined(_CRAY) | defined(__KCC)
144 # define __LIM_H_PARAM_
145 # include <sys/param.h>
146 # include <inttypes.h>
150 # include <inttypes.h>
153 # ifndef PTHREAD_RWLOCK_INITIALIZER
155 # define pthread_rwlock_t rwlock_t
156 # define pthread_rwlock_init(lk, attr) rwlock_init(lk, attr, 0)
157 # define pthread_rwlock_destroy rwlock_destroy
158 # define pthread_rwlock_rdlock rw_rdlock
159 # define pthread_rwlock_wrlock rw_wrlock
160 # define pthread_rwlock_tryrdlock rw_tryrdlock
161 # define pthread_rwlock_trywrlock rw_trywrlock
162 # define pthread_rwlock_unlock rw_unlock
163 # define PTHREAD_RWLOCK_INITIALIZER DEFAULTRWLOCK;
166 #elif defined(__unix__) || defined(__HOS_AIX__)
168 # ifdef __CYGWIN__ // cygwin port of gcc compiler
170 # include <cygwin/types.h>
173 #elif defined(_WIN32)
175 # define WIN32_LEAN_AND_MEAN
179 # define WINVER _WIN32_WINNT
181 # define WINVER 0x0600
185 # include <windows.h>
187 # define mkdir(x,y) _mkdir(x)
188 # define chmod _chmod
190 # if defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)
195 # define int16_t __int16
198 # define uint16_t unsigned __int16
201 # define int32_t __int32
204 # define uint32_t unsigned __int32
207 # define int64_t __int64
210 # define uint64_t unsigned __int64
214 #elif defined(__APPLE__)
216 # include <sys/syslimits.h>
220 # include <syslimits.h>
229 #if !(defined(HAVE_STDINT_H) || defined(__unix__) || defined(_WIN32) || defined(__APPLE__) || defined(__x86_64__) || defined(_STDINT_H))
231 # define int16_t short int
232 # define INT16_MAX (32767)
235 # define uint16_t unsigned short int
236 # define UINT16_MAX (65535)
240 # define INT32_MAX (2147483647)
243 # define uint32_t unsigned int
244 # define UINT32_MAX (4294967295UL)
247 # define int64_t long long int
248 # define INT64_MAX (9223372036854775807LL)
251 # define uint64_t unsigned long long int
252 # define UINT64_MAX (18446744073709551615ULL)
257 # define PATH_MAX 512
263 #if defined(_WIN32) && defined(_MSC_VER)
264 # define FASTBIT_DIRSEP '\\'
266 # define FASTBIT_DIRSEP '/'
269 #if defined(_WIN32) && (defined(_MSC_VER) || defined(__MINGW32__))
270 # if defined(_USRDLL) || defined(CXX_USE_DLL)
271 # if defined(DLL_EXPORT)
272 # define FASTBIT_CXX_DLLSPEC __declspec(dllexport)
274 # define FASTBIT_CXX_DLLSPEC __declspec(dllimport)
277 # define FASTBIT_CXX_DLLSPEC
280 # define FASTBIT_CXX_DLLSPEC
290 #if defined(__APPLE__) && !defined(PTHREAD_RWLOCK_INITIALIZER)
291 #define PTHREAD_RWLOCK_INITIALIZER
294 #ifndef PTHREAD_RWLOCK_INITIALIZER
295 #define IBIS_REPLACEMENT_RWLOCK
296 #define THREAD_RWLOCK_INITIALIZER \
297 {PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, \
298 PTHREAD_COND_INITIALIZER, 0, 0}
300 pthread_mutex_t lock;
301 pthread_cond_t readers;
302 pthread_cond_t writers;
341 (
void *context, uint64_t start, uint64_t count, uint32_t *data);
365 (
void *context, uint64_t nd, uint64_t *starts, uint64_t *counts,
void *data);
371 # if _MSC_VER >= 1500 || defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)
372 # define strnicmp _strnicmp
373 # define stricmp _stricmp
376 # include <strings.h>
377 # define MessageBox(x1,x2,x3,x4); {} // fake message box
378 # define strnicmp strncasecmp
379 # define stricmp strcasecmp
385 #if defined(__SUNPRO_CC)
386 # if (__SUNPRO_CC < 0x500)
387 # include <iostream.h>
405 #include <functional>
415 template<
class T>
class array_t;
417 typedef FASTBIT_CXX_DLLSPEC std::vector< part* > partList;
419 typedef FASTBIT_CXX_DLLSPEC std::vector< const part* > constPartList;
422 union FASTBIT_CXX_DLLSPEC rid_t {
432 bool operator<(
const rid_t& r)
const {
return(value < r.value);}
433 bool operator>(
const rid_t& r)
const {
return(value > r.value);}
434 bool operator<=(
const rid_t& r)
const {
return(value <= r.value);}
435 bool operator>=(
const rid_t& r)
const {
return(value >= r.value);}
436 bool operator==(
const rid_t& r)
const {
return(value == r.value);}
437 bool operator!=(
const rid_t& r)
const {
return(value != r.value);}
438 rid_t operator+(
const rid_t& r)
const {
439 rid_t tmp; tmp.value = value + r.value;
return tmp;}
440 rid_t operator-(
const rid_t& r)
const {
441 rid_t tmp; tmp.value = value - r.value;
return tmp;}
442 rid_t operator*(
const rid_t& r)
const {
443 rid_t tmp; tmp.value = value * r.value;
return tmp;}
444 rid_t operator/(
const rid_t& r)
const {
445 rid_t tmp; tmp.value = value / r.value;
return tmp;}
449 class FASTBIT_CXX_DLLSPEC opaque {
452 const char* address()
const {
return buf_;}
454 uint64_t size()
const {
return len_;}
455 int copy(
const void* ptr, uint64_t len);
464 void assign(
void* ptr, uint64_t len) {
466 buf_ =
static_cast<char*
>(ptr);
470 void assign(opaque &rhs) {
479 void swap(opaque& rhs) {
489 ~opaque() {
delete [] buf_;}
491 opaque() : buf_(0), len_(0) {};
494 opaque(
void* ptr, uint64_t len)
495 : buf_(static_cast<char*>(ptr)), len_(len) {}
498 opaque(
const opaque &rhs) : buf_(0), len_(0) {
499 copy(rhs.buf_, rhs.len_);
502 opaque& operator=(
const opaque &rhs) {
503 copy(rhs.buf_, rhs.len_);
515 public std::binary_function< const char*, const char*, bool > {
516 bool operator()(
const char* x,
const char* y)
const {
517 return (x && y ? stricmp(x, y) < 0 :
false);
523 extern FASTBIT_CXX_DLLSPEC
int gVerbose;
525 #endif // C++ portion
526 #endif // ifndef IBIS_CONST_H
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
The current implementation of FastBit is code named IBIS; most data structures and functions are in t...
Definition: bord.h:16
int copy(const char *to, const char *from)
Copy file named "from" to a file named "to".
Definition: util.cpp:894
int(* FastBitReadBitmaps)(void *context, uint64_t start, uint64_t count, uint32_t *data)
A function prototype for delayed index reconstruction.
Definition: const.h:341