Defines minor utility functions and common classes used by FastBit. More...
#include <stdlib.h>#include "const.h"#include <cctype>#include <cstring>#include <stdio.h>#include <sys/stat.h>#include <fcntl.h>#include <map>#include <string>#include <limits>#include <sstream>#include <float.h>#include <math.h>#include <unistd.h>Go to the source code of this file.
Classes | |
| class | ibis::bad_alloc |
| A specialization of std::bad_alloc. More... | |
| class | ibis::nameList |
| A data structure to store a small set of names. More... | |
| class | ibis::util::counter |
| A simple shared counter. More... | |
| class | ibis::util::guardBase |
| A class hierarchy for cleaning up after durable resources. More... | |
| class | ibis::util::guardImpl0< F > |
| A concrete class for cleanup jobs that take a function without any argument. More... | |
| class | ibis::util::guardImpl1< F, A > |
| A concrete class for cleanup jobs that take a function with one argument. More... | |
| class | ibis::util::guardImpl2< F, A1, A2 > |
| A concrete class for cleanup jobs that take a function with two arguments. More... | |
| class | ibis::util::guardObj0< C, F > |
| A class to work with class member functions with no arguments. More... | |
| class | ibis::util::ioLock |
| A global I/O lock. More... | |
| class | ibis::util::logger |
| A class for logging messages. More... | |
| class | ibis::util::mutexLock |
| An wrapper class for perform pthread_mutex_lock/unlock. More... | |
| class | ibis::util::quietLock |
| An wrapper class for perform pthread_mutex_lock/unlock. More... | |
| class | ibis::util::readLock |
| An wrapper class for perform pthread_rwlock_rdlock/unlock. More... | |
| class | ibis::util::refHolder< T > |
| A template to hold a reference to an object. More... | |
| class | ibis::util::sharedInt32 |
| A shared integer class. More... | |
| class | ibis::util::sharedInt64 |
| A 64-bit shared integer class. More... | |
| class | ibis::util::timer |
| Print simply-formated timing information. More... | |
| class | ibis::util::writeLock |
| An wrapper class for perform pthread_rwlock_wrlock/unlock. More... | |
| struct | std::less< char * > |
| struct | std::less< const char * > |
| struct | std::less< const ibis::rid_t * > |
| struct | std::less< ibis::rid_t > |
Namespaces | |
| namespace | ibis |
The current implementation of FastBit is code named IBIS; most data structures and functions are in the name space ibis. | |
| namespace | ibis::util |
Organize the miscellaneous functions under the name util. | |
Defines | |
| #define | DBL_EPSILON 2.2204460492503131e-16 |
| #define | IBIS_BLOCK_GUARD ibis::util::guard IBIS_GUARD_NAME = ibis::util::makeGuard |
| #define | IBIS_GUARD_NAME IBIS_JOIN_MACRO(_guard, __LINE__) |
| #define | IBIS_JOIN_MACRO(X, Y) IBIS_JOIN_MACRO2(X, Y) |
| #define | IBIS_JOIN_MACRO2(X, Y) X##Y |
| #define | LOGGER(v) if (false == (v)) ; else ibis::util::logger(0)() |
| #define | OPEN_FILEMODE S_IRUSR | S_IWUSR |
| #define | Stat_T struct stat |
| #define | STRMATCH_META_CSH_ANY '*' |
| #define | STRMATCH_META_CSH_ONE '?' |
| #define | STRMATCH_META_ESCAPE '\\' |
| #define | STRMATCH_META_SQL_ANY '%' |
| #define | STRMATCH_META_SQL_ONE '_' |
| #define | UnixClose ::close |
| #define | UnixFlush ::fsync |
| #define | UnixFStat ::fstat |
| #define | UnixOpen ::open |
| Guess about GCC atomic operations. | |
| #define | UnixRead ::read |
| #define | UnixSeek ::lseek |
| #define | UnixSnprintf ::snprintf |
| #define | UnixStat ::stat |
| #define | UnixWrite ::write |
Typedefs | |
| typedef std::vector< colValues * > | ibis::colList |
| typedef const guardBase & | ibis::util::guard |
| The type to be used by client code. | |
| typedef std::map< const char *, part *, lessi > | ibis::partAssoc |
| An associative array for data partitions. | |
Functions | |
| void | ibis::util::clear (ibis::array_t< ibis::bitvector * > &bv) throw () |
| Clear an array of bit vectors. | |
| void | ibis::util::clear (ibis::partList &pl) throw () |
| Deallocate the list of data partitions. | |
| template<typename T > | |
| void | ibis::util::clearVec (std::vector< T * > &v) |
| A template to clean up a vector of pointers. | |
| void | ibis::util::closeLogFile () |
| int | ibis::util::copy (const char *to, const char *from) |
| Copy "from" to "to". | |
| off_t | ibis::util::getFileSize (const char *name) |
| Return size of the file in bytes. | |
| void | ibis::util::getGMTime (char *str) |
| Return the current GMT time in string format. | |
| void | ibis::util::getLocalTime (char *str) |
Return the current time in string format as asctime_r. | |
| FILE * | ibis::util::getLogFile () |
| const char * | ibis::util::getLogFileName () |
| char * | ibis::util::getString (const char *buf) |
| Extract a string from the given buf. | |
| const char * | ibis::util::getToken (char *&str, const char *tok_chrs) |
| Return a null-terminated string from the beginning of input string str. | |
| int | ibis::util::getVersionNumber () |
| Return an integer designating the version of this software. | |
| const char * | ibis::util::getVersionString () |
| Return a pointer to the string designating the version of this software. | |
| ibis::resource & | ibis::gParameters () |
| List of in-memory data. | |
| long | ibis::util::intersect (const std::vector< ibis::bitvector > &bits1, const std::vector< ibis::bitvector > &bits2, std::vector< ibis::bitvector > &res) |
| Intersect two sets of bit vectors. | |
| long | ibis::util::intersect (const std::vector< ibis::bitvector > &bits1, const std::vector< ibis::bitvector > &bits2, const std::vector< ibis::bitvector > &bits3, std::vector< ibis::bitvector > &res) |
| Intersect three sets of bit vectors. | |
| char * | ibis::util::itoa (int value, char *str, int) |
| void | ibis::util::logMessage (const char *event, const char *fmt,...) |
| int | ibis::util::makeDir (const char *dir) |
| Recursively create the name directory. | |
| template<typename F > | |
| guardImpl0< F > | ibis::util::makeGuard (F f) |
| template<typename F , typename A > | |
| guardImpl1< F, A > | ibis::util::makeGuard (F f, A a) |
| template<typename F , typename A1 , typename A2 > | |
| guardImpl2< F, A1, A2 > | ibis::util::makeGuard (F f, A1 a1, A2 a2) |
| template<class C , typename F > | |
| guardObj0< C, F > | ibis::util::objectGuard (C o, F f) |
| std::ostream & | operator<< (std::ostream &out, const ibis::rid_t &rid) |
| Print a rid_t to an output stream. | |
| std::istream & | operator>> (std::istream &is, ibis::rid_t &rid) |
| Read a rid_t from an input stream. | |
| const ibis::bitvector64 & | ibis::util::outerProduct (const ibis::bitvector &a, const ibis::bitvector &b, ibis::bitvector64 &c) |
Compute the outer product of a and b, add the result to c. | |
| const ibis::bitvector64 & | ibis::util::outerProductUpper (const ibis::bitvector &a, const ibis::bitvector &b, ibis::bitvector64 &c) |
Add the strict upper triangular portion of the outer production between a and b to c. | |
| double | ibis::util::rand () |
| A pseudo-random number generator (0,1). | |
| int64_t | ibis::util::read (int, void *, int64_t) |
| A wrapper over POSIX read function. | |
| int | ibis::util::readDouble (double &val, const char *&str, const char *del=ibis::util::delimiters) |
| Attempt to convert the incoming string into a double. | |
| int | ibis::util::readInt (int64_t &val, const char *&str, const char *del=ibis::util::delimiters) |
| Attempt to convert the incoming string into an integer. | |
| int | ibis::util::readString (std::string &str, const char *&buf, const char *delim=0) |
| Copy the next string to the output variable str. | |
| int | ibis::util::readUInt (uint64_t &val, const char *&str, const char *del=ibis::util::delimiters) |
| Attempt to convert the incoming string into a unsigned integer. | |
| template<class T > | |
| refHolder< T > | ibis::util::ref (T &r) |
| A function template to produce refHolder. | |
| void | ibis::util::removeDir (const char *name, bool leaveDir=false) |
| Remove the content of named directory. | |
| void | ibis::util::removeTail (char *str, char tail) |
| Remove trailing character 'tail' from str. | |
| void | ibis::util::secondsToString (const time_t, char *str) |
| uint32_t | ibis::util::serialNumber () |
| Return an integer that is always increasing. | |
| int | ibis::util::setLogFileName (const char *filename) |
| void | ibis::util::setVerboseLevel (int v) |
| Set the verboseness level. | |
| bool | ibis::util::strMatch (const char *str, const char *pat) |
Match the string str against a simple pattern pat. | |
| char * | ibis::util::strnewdup (const char *s) |
| Duplicate string content with C++ default new operator. | |
| char * | ibis::util::strnewdup (const char *s, const uint32_t n) |
| Duplicate no more than n characters. | |
| char * | ibis::util::trim (char *str) |
| Remove leading and trailing blank space. | |
| void | ibis::util::uniformFraction (const long unsigned idx, long unsigned &denominator, long unsigned &numerator) |
| void | ibis::util::updateDatasets (void) |
| Update the metadata about the data partitions. | |
| const char * | ibis::util::userName () |
| Return the user name. | |
| int | ibis::util::writeLogFileHeader (FILE *fptr, const char *fname) |
| uint32_t | ibis::util::checksum (const char *str, uint32_t sz) |
| Fletcher's checksum on two integers. Returns an integer. | |
| uint32_t | ibis::util::checksum (uint32_t a, uint32_t b) |
| Fletcher's checksum on two integers. Returns an integer. | |
| std::string | ibis::util::shortName (const std::string &longname) |
| Fletcher's checksum on two integers. Returns an integer. | |
| std::string | ibis::util::randName (const std::string &longname) |
| Fletcher's checksum on two integers. Returns an integer. | |
| void | ibis::util::int2string (std::string &str, unsigned val) |
| void | ibis::util::int2string (std::string &str, unsigned v1, unsigned v2) |
| void | ibis::util::int2string (std::string &str, unsigned v1, unsigned v2, unsigned v3) |
| void | ibis::util::int2string (std::string &str, const std::vector< unsigned > &val) |
| void | ibis::util::encode64 (uint64_t, std::string &) |
| int | ibis::util::decode64 (uint64_t &, const std::string &) |
| int | ibis::util::decode16 (uint64_t &, const char *) |
| std::string | ibis::util::groupby1000 (uint64_t) |
| double | ibis::util::incrDouble (const double &) |
| Functions to handle manipulation of floating-point numbers. | |
| double | ibis::util::decrDouble (const double &) |
| Decrease the input value to the next smaller value. | |
| void | ibis::util::eq2range (const double &, double &, double &) |
| Generate a range [left, right) that contains exactly the input value in. | |
| double | ibis::util::coarsen (const double in, unsigned prec=2) |
| Reduce the decimal precision of the incoming floating-point value to specified precision. | |
| double | ibis::util::compactValue (double left, double right, double start=0.0) |
| Compute a compact 64-bit floating-point value with a short decimal representation. | |
| double | ibis::util::compactValue2 (double left, double right, double start=0.0) |
| Compute a compact 64-bit floating-point value with a short binary representation. | |
| void | ibis::util::setNaN (double &val) |
| Set a double to NaN. | |
| void | ibis::util::setNaN (float &val) |
| Functions to handle manipulation of floating-point numbers. | |
| template<typename Tin , typename Tout > | |
| void | ibis::util::round_down (const Tin &inval, Tout &outval) |
| Round the incoming value to the largest output value that is no more than the input. | |
| template<typename Tin , typename Tout > | |
| void | ibis::util::round_up (const Tin &inval, Tout &outval) |
| Round the incoming value to the smallest output value that is no less than the input. | |
| template<typename Tin > | |
| void | ibis::util::round_up (const Tin &inval, float &) |
| A specialization of round_up for the output type float. | |
| template<typename Tin > | |
| void | ibis::util::round_up (const Tin &inval, double &outval) |
| A specialization of round_up for the output in double. | |
| int | ibis::util::log2 (uint32_t x) |
| Log_2 of a 32-bit integer. | |
| int | ibis::util::log2 (uint64_t x) |
| Log_2 of a 64-bit integer. | |
Variables | |
| const short unsigned | ibis::util::charIndex [] |
| charIndex maps the characters (ASCII) back to integer [0-64] | |
| const char * | ibis::util::charTable = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~" |
| charTable lists the 64 printable characters to be used for names | |
| partList | ibis::datasets |
| Select clause. | |
| const char * | ibis::util::delimiters = ";, \v\b\f\r\t\n'\"" |
| Delimiters used to separate a string of names. | |
| pthread_mutex_t | ibis::util::envLock = PTHREAD_MUTEX_INITIALIZER |
| A mutex for serialize operations FastBit wide. | |
| const int | ibis::util::log2table [256] |
| log base 2 of an integer, the lookup table | |
Defines minor utility functions and common classes used by FastBit.
| #define UnixOpen ::open |
Guess about GCC atomic operations.
Guess about MS Windows automic operation support
Referenced by ibis::index::activate(), ibis::text::append(), ibis::category::append(), ibis::blob::append(), ibis::column::append(), ibis::column::appendStrings(), ibis::column::appendValues(), ibis::bord::backup(), ibis::bin::binningT(), ibis::bin::binOrderT(), ibis::util::copy(), ibis::blob::countRawBytes(), ibis::index::create(), ibis::part::doCompare(), ibis::fileManager::roFile::doRead(), ibis::blob::extractAll(), ibis::blob::extractSome(), ibis::category::fillIndex(), ibis::index::isIndex(), ibis::roster::mergeBlock2(), ibis::bin::mergeValues(), ibis::part::negativeCompare(), ibis::roster::oocSearch(), ibis::part::barrel::open(), ibis::part::vault::open(), ibis::query::orderPairs(), ibis::keywords::parseTextFile(), ibis::relic::read(), ibis::bin::read(), ibis::direkte::read(), ibis::keywords::read(), ibis::fileManager::storage::read(), ibis::slice::read(), ibis::fade::read(), ibis::fuzz::read(), ibis::range::read(), ibis::bylt::read(), ibis::zona::read(), ibis::ambit::read(), ibis::pale::read(), ibis::pack::read(), ibis::zone::read(), ibis::fuge::read(), ibis::egale::read(), ibis::blob::readBlob(), ibis::bundle::readRIDs(), ibis::text::readString(), ibis::query::recordDeltaPairs(), ibis::query::recordEqualPairs(), ibis::part::reorderValues(), ibis::column::searchSortedOOCC(), ibis::column::searchSortedOOCD(), ibis::text::selectStrings(), ibis::column::selectValuesT(), ibis::category::setDictionary(), ibis::relic::write(), ibis::bin::write(), ibis::tafel::write(), ibis::direkte::write(), ibis::keywords::write(), ibis::slice::write(), ibis::fade::write(), ibis::sbiad::write(), ibis::sapid::write(), ibis::fuzz::write(), ibis::range::write(), ibis::bylt::write(), ibis::mesa::write(), ibis::zona::write(), ibis::ambit::write(), ibis::pale::write(), ibis::pack::write(), ibis::zone::write(), ibis::fuge::write(), ibis::egale::write(), ibis::moins::write(), ibis::entre::write(), ibis::blob::writeData(), ibis::text::writeStrings(), and ibis::part::writeValues().
|
| |