ibis.h
Go to the documentation of this file.
1 // $Id$
2 // Author: John Wu <John.Wu at ACM.org>
3 // Lawrence Berkeley National Laboratory
4 //
5 // Copyright (c) 2000-2016, The Regents of the University of California,
6 // through Lawrence Berkeley National Laboratory (subject to receipt of any
7 // required approvals from the U.S. Dept. of Energy). All rights reserved.
8 //
9 // If you have questions about your rights to use or distribute this
10 // software, please contact Berkeley Lab's Technology Transfer Department
11 // at [email protected].
12 //
13 // NOTICE. This software is owned by the U.S. Department of Energy. As
14 // such, the U.S. Government has been granted for itself and others acting
15 // on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in
16 // the Software to reproduce, prepare derivative works, and perform
17 // publicly and display publicly. Beginning five (5) years after the date
18 // permission to assert copyright is obtained from the U.S. Department of
19 // Energy, and subject to any subsequent five (5) year renewals, the
20 // U.S. Government is granted for itself and others acting on its behalf a
21 // paid-up, nonexclusive, irrevocable, worldwide license in the Software to
22 // reproduce, prepare derivative works, distribute copies to the public,
23 // perform publicly and display publicly, and to permit others to do so.
24 
25 #ifndef IBIS_H
26 #define IBIS_H
27 #include "countQuery.h" // ibis::countQuery
37 #include "meshQuery.h" // ibis::meshQuery
38 #include "resource.h" // ibis::gParameters
39 #include "bundle.h" // ibis::bundle
40 #include "quaere.h" // ibis::quaere
41 #include "query.h" // ibis::query
42 #include "part.h" // ibis::part, ibis::column, ibis::table
43 #include "blob.h" // ibis::blob
44 #include "rids.h" // ibis::ridHandler
45 
325 namespace ibis {
378  inline void init(const char* rcfile=0,
379  const char* mesgfile=0) {
380 #if defined(DEBUG) || defined(_DEBUG)
381  if (gVerbose <= 0) {
382 #if DEBUG + 0 > 10 || _DEBUG + 0 > 10
383  gVerbose = INT_MAX;
384 #elif DEBUG + 0 > 0
385  gVerbose += 7 * DEBUG;
386 #elif _DEBUG + 0 > 0
387  gVerbose += 5 * _DEBUG;
388 #else
389  gVerbose += 3;
390 #endif
391  }
392 #endif
393  int ierr;
394 #if defined(PTW32_STATIC_LIB)
395  if (ibis::util::envLock == PTHREAD_MUTEX_INITIALIZER) {
396  ierr = pthread_mutex_init(&ibis::util::envLock, 0);
397  if (ierr != 0)
398  throw "ibis::init failed to initialize ibis::util::envLock";
399  }
400 #endif
401  if (mesgfile != 0 && *mesgfile != 0) {
402  ierr = ibis::util::setLogFileName(mesgfile);
403  if (ierr < 0 && ibis::gVerbose >= 0) {
404  std::cerr << "ibis::init failed to set log file to "
405  << mesgfile << std::endl;
406  }
407  }
408 
409  if (0 != atexit(ibis::util::closeLogFile)) {
410  if (ibis::gVerbose >= 0)
411  std::cerr << "ibis::init failed to register the function "
412  "ibis::util::closeLogFile with atexit" << std::endl;
413  }
414  // if (0 != atexit(ibis::util::clearDatasets)) {
415  // if (ibis::gVerbose >= 0)
416  // std::cerr << "ibis::init failed to register the function "
417  // "ibis::util::clearDatasets with atexit" << std::endl;
418  // }
419 
420  ierr = ibis::gParameters().read(rcfile);
421  if (ierr < 0)
422  std::cerr << "ibis::init failed to open configuration file \""
423  << (rcfile!=0&&*rcfile!=0 ? rcfile : "") << '"'
424  << std::endl;
425  (void) ibis::fileManager::instance(); // initialize the file manager
426  if (! ibis::gParameters().empty()) {
428  if (ibis::gVerbose > 0 && ierr > 0)
429  std::cerr << "ibis::init found " << ierr << " data partition"
430  << (ierr > 1 ? "s" : "") << std::endl;
431  }
432 #if defined(_WIN32) && defined(_MSC_VER) && (defined(_DEBUG) || defined(DEBUG))
433  std::cerr << "DEBUG - WIN32 related macros";
434 #ifdef NTDDI_VERSION
435  std::cerr << "\nNTDDI_VERSION=" << std::hex << NTDDI_VERSION
436  << std::dec;
437 #endif
438 #ifdef NTDDI_WINVISTA
439  std::cerr << "\nNTDDI_WINVISTA=" << std::hex << NTDDI_WINVISTA
440  << std::dec;
441 #endif
442 #ifdef WINVER
443  std::cerr << "\nWINVER=" << std::hex << WINVER << std::dec;
444 #endif
445 #if defined(HAVE_WIN_ATOMIC32)
446  std::cerr << "\nHAVE_WIN_ATOMIC32 true";
447 #else
448  std::cerr << "\nHAVE_WIN_ATOMIC32 flase";
449 #endif
450 #if defined(HAVE_WIN_ATOMIC64)
451  std::cerr << "\nHAVE_WIN_ATOMIC64 true";
452 #else
453  std::cerr << "\nHAVE_WIN_ATOMIC64 flase";
454 #endif
455  std::cerr << std::endl;
456 #endif
457  }
458 }
459 #endif // IBIS_H
int read(const char *fn=0)
Read a configuration file.
Definition: resource.cpp:44
Classes to store selected values.
partList datasets
!< Select clause.
Definition: util.cpp:83
unsigned int gatherParts(ibis::partList &parts, const char *adir, const char *bdir, bool ro=false)
Look for data partitions in the given pair of directories.
Definition: part.cpp:20692
pthread_mutex_t envLock
A mutex for serialize operations FastBit wide.
Definition: util.cpp:49
void closeLogFile()
Close the log file.
Definition: util.cpp:2120
The current implementation of FastBit is code named IBIS; most data structures and functions are in t...
Definition: bord.h:16
FastBit Quaere Interface.
The header file defining the individual query objects.
ibis::resource & gParameters()
List of in-memory data.
Definition: resource.cpp:545
The header file defining an extension of query on mesh data.
void init(const char *rcfile=0, const char *mesgfile=0)
Initializes the memory manager of FastBit.
Definition: ibis.h:378
Defines a class to hold name-value pairs.
static fileManager & instance()
Returns a pointer to the one and only file manager.
Definition: fileManager.cpp:507
The header file defining the individual countQuery objects.
Define the class ibis::blob.
Define simple IO functions for ibis::rid_t.
int setLogFileName(const char *filename)
Change the current log file to the named file.
Definition: util.cpp:1952
Define the class ibis::part.

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