aitools::util Namespace Reference

Enumerations

enum  memory_type {
  min_required, mb512, mb1024, mb2048,
  mb4096, mb8192, mb16384, mb32768,
  mb65536
}

Functions

bool is_prime (uint32_t number)
uint32_t next_prime (uint32_t number)
template<typename T >
hash (const char *key, size_t length)
template<>
uint16_t hash< uint16_t > (const char *key, size_t length)
template<>
uint32_t hash< uint32_t > (const char *key, size_t length)
template<>
uint64_t hash< uint64_t > (const char *key, size_t length)
template<typename T >
hash (const std::string &key)
uint16_t hash16 (const std::string &key)
uint32_t hash32 (const std::string &key)
uint64_t hash64 (const std::string &key)
template<typename T >
bool to_number (const std::string &value, T &number)
template<typename T >
const T to_number (const std::string &value)
template<typename T >
std::string to_string (T value)
template<typename T >
std::string format (const std::string &msg, const T &value)
template<typename T >
void throw_runtime_error (const std::string &msg, const T &value)
template<typename T >
void throw_invalid_argument (const std::string &msg, const T &value)
template<typename T >
void throw_out_of_range (const std::string &msg, const T &value)
template<typename T >
void throw_length_error (const std::string &msg, const T &value)
template<typename T >
void throw_logic_error (const std::string &msg, const T &value)
template<typename T >
void throw_domain_error (const std::string &msg, const T &value)
void throw_logic_error (const std::string &msg)
void throw_domain_error (const std::string &msg)
void throw_runtime_error (const std::string &msg)
void throw_overflow_error (const std::string &msg)
void throw_underflow_error (const std::string &msg)
void throw_invalid_argument (const std::string &msg)
std::ostream & print_timestamp_to (std::ostream &os)
void log_debug (const char *file, size_t line, const std::string &msg)
template<typename T >
void log_debug (const char *file, size_t line, const std::string &msg, const T &val)
template<typename Iter >
void log_debug (const char *file, size_t line, const std::string &msg, Iter first, Iter last)
void vlog_debug (const std::string &format, va_list args)
void logf_debug (const std::string &format,...)
void log_error (const std::string &message)
template<typename T >
void log_error (const std::string &message, const T &value)
void log_info (const std::string &message)
template<typename T >
void log_info (const std::string &message, const T &value)
uint64_t to_bytes (memory_type memory)
std::string to_string (memory_type memory)
void signal_error (const std::string &msg)
template<typename T >
void signal_error (const std::string &msg, const T &obj)
uint64_t directory_size (const bfs::path &dir)
void fclose (FILE *fs)
FILE * fopen (const bfs::path &path, const std::string &mode)
void fread (void *data, size_t size, size_t count, FILE *fs)
void fseek (FILE *fs, long offset, int origin)
void fwrite (const void *data, size_t size, size_t count, FILE *fs)
size_t ftell (FILE *fs)
void rewind (FILE *fs)
FILE * tmpfile ()
const bfs::path tmpdir (const bfs::path &parent_dir)

Enumeration Type Documentation

Enumerator:
min_required 
mb512 
mb1024 
mb2048 
mb4096 
mb8192 
mb16384 
mb32768 
mb65536 

Definition at line 12 of file memory.hpp.


Function Documentation

uint64_t aitools::util::directory_size ( const bfs::path &  dir  )  [inline]

Definition at line 36 of file systemio.hpp.

void aitools::util::fclose ( FILE *  fs  )  [inline]
FILE* aitools::util::fopen ( const bfs::path &  path,
const std::string &  mode 
) [inline]
template<typename T >
std::string aitools::util::format ( const std::string &  msg,
const T &  value 
) [inline]

Definition at line 19 of file exception.hpp.

Referenced by throw_domain_error(), throw_invalid_argument(), throw_length_error(), throw_logic_error(), throw_out_of_range(), and throw_runtime_error().

Here is the caller graph for this function:

void aitools::util::fread ( void *  data,
size_t  size,
size_t  count,
FILE *  fs 
) [inline]
void aitools::util::fseek ( FILE *  fs,
long  offset,
int  origin 
) [inline]

Definition at line 116 of file systemio.hpp.

References signal_error().

Referenced by aitools::bighashmap::core::external_map< T >::find(), aitools::invertedindex::System::fseek(), and aitools::invertedindex::Iterator::rewind().

Here is the call graph for this function:

Here is the caller graph for this function:

size_t aitools::util::ftell ( FILE *  fs  )  [inline]

Definition at line 137 of file systemio.hpp.

References signal_error().

Referenced by BOOST_AUTO_TEST_CASE(), aitools::invertedindex::System::ftell(), and aitools::invertedindex::Iterator::Page::Page().

Here is the call graph for this function:

Here is the caller graph for this function:

void aitools::util::fwrite ( const void *  data,
size_t  size,
size_t  count,
FILE *  fs 
) [inline]
template<typename T >
size_t aitools::util::hash ( const std::string &  key  )  [inline]

Definition at line 90 of file checksum.hpp.

template<typename T >
T aitools::util::hash ( const char *  key,
size_t  length 
) [inline]

Referenced by BOOST_AUTO_TEST_CASE(), and aitools::bighashmap::core::builder< T >::build_hashtable().

Here is the caller graph for this function:

uint16_t aitools::util::hash16 ( const std::string &  key  )  [inline]

Definition at line 96 of file checksum.hpp.

References hash< uint16_t >().

Here is the call graph for this function:

uint32_t aitools::util::hash32 ( const std::string &  key  )  [inline]

Definition at line 102 of file checksum.hpp.

References hash< uint32_t >().

Referenced by aitools::bighashmap::core::big_hash_map< T >::find(), and aitools::bighashmap::core::builder< T >::scatter().

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t aitools::util::hash64 ( const std::string &  key  )  [inline]

Definition at line 108 of file checksum.hpp.

References hash< uint64_t >().

Here is the call graph for this function:

template<>
uint16_t aitools::util::hash< uint16_t > ( const char *  key,
size_t  length 
) [inline]

Referenced by hash16().

Here is the caller graph for this function:

template<>
uint32_t aitools::util::hash< uint32_t > ( const char *  key,
size_t  length 
) [inline]

Referenced by hash32().

Here is the caller graph for this function:

template<>
uint64_t aitools::util::hash< uint64_t > ( const char *  key,
size_t  length 
) [inline]

Referenced by hash64().

Here is the caller graph for this function:

bool aitools::util::is_prime ( uint32_t  number  )  [inline]

Definition at line 16 of file checksum.hpp.

Referenced by next_prime().

Here is the caller graph for this function:

template<typename Iter >
void aitools::util::log_debug ( const char *  file,
size_t  line,
const std::string &  msg,
Iter  first,
Iter  last 
) [inline]

Definition at line 52 of file logging.hpp.

References print_timestamp_to().

Here is the call graph for this function:

template<typename T >
void aitools::util::log_debug ( const char *  file,
size_t  line,
const std::string &  msg,
const T &  val 
) [inline]

Definition at line 43 of file logging.hpp.

References print_timestamp_to().

Here is the call graph for this function:

void aitools::util::log_debug ( const char *  file,
size_t  line,
const std::string &  msg 
) [inline]

Definition at line 34 of file logging.hpp.

References print_timestamp_to().

Referenced by aitools::bighashmap::core::internal_map< T >::find(), and aitools::bighashmap::core::external_map< T >::find().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
void aitools::util::log_error ( const std::string &  message,
const T &  value 
) [inline]

Definition at line 89 of file logging.hpp.

References print_timestamp_to().

Here is the call graph for this function:

void aitools::util::log_error ( const std::string &  message  )  [inline]

Definition at line 81 of file logging.hpp.

References print_timestamp_to().

Referenced by bhm_build(), bhm_open(), and aitools::bighashmap::core::external_map< T >::find().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
void aitools::util::log_info ( const std::string &  message,
const T &  value 
) [inline]

Definition at line 104 of file logging.hpp.

References print_timestamp_to().

Here is the call graph for this function:

void aitools::util::log_info ( const std::string &  message  )  [inline]

Definition at line 96 of file logging.hpp.

References print_timestamp_to().

Referenced by aitools::bighashmap::core::builder< T >::build().

Here is the call graph for this function:

Here is the caller graph for this function:

void aitools::util::logf_debug ( const std::string &  format,
  ... 
) [inline]

Definition at line 72 of file logging.hpp.

References vlog_debug().

Here is the call graph for this function:

uint32_t aitools::util::next_prime ( uint32_t  number  )  [inline]

Definition at line 28 of file checksum.hpp.

References is_prime().

Here is the call graph for this function:

std::ostream& aitools::util::print_timestamp_to ( std::ostream &  os  )  [inline]

Definition at line 20 of file logging.hpp.

Referenced by log_debug(), log_error(), log_info(), and vlog_debug().

Here is the caller graph for this function:

void aitools::util::rewind ( FILE *  fs  )  [inline]

Definition at line 149 of file systemio.hpp.

Referenced by BOOST_AUTO_TEST_CASE(), aitools::invertedindex::PostlistBuilder::build(), and aitools::invertedindex::ExternalMergeSort::merge().

Here is the caller graph for this function:

template<typename T >
void aitools::util::signal_error ( const std::string &  msg,
const T &  obj 
) [inline]

Definition at line 29 of file systemio.hpp.

References throw_runtime_error().

Here is the call graph for this function:

void aitools::util::signal_error ( const std::string &  msg  )  [inline]

Definition at line 21 of file systemio.hpp.

References throw_runtime_error().

Referenced by fclose(), fopen(), fread(), fseek(), ftell(), fwrite(), tmpdir(), and tmpfile().

Here is the call graph for this function:

Here is the caller graph for this function:

void aitools::util::throw_domain_error ( const std::string &  msg  )  [inline]

Definition at line 75 of file exception.hpp.

template<typename T >
void aitools::util::throw_domain_error ( const std::string &  msg,
const T &  value 
) [inline]

Definition at line 63 of file exception.hpp.

References format().

Here is the call graph for this function:

void aitools::util::throw_invalid_argument ( const std::string &  msg  )  [inline]

Definition at line 99 of file exception.hpp.

template<typename T >
void aitools::util::throw_invalid_argument ( const std::string &  msg,
const T &  value 
) [inline]

Definition at line 35 of file exception.hpp.

References format().

Referenced by Java_de_aitools_aq_invertedindex_core_IndexBuilder_natBuild(), Java_de_aitools_aq_invertedindex_core_IndexSearcher_natInit(), and to_number().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
void aitools::util::throw_length_error ( const std::string &  msg,
const T &  value 
) [inline]

Definition at line 49 of file exception.hpp.

References format().

Here is the call graph for this function:

void aitools::util::throw_logic_error ( const std::string &  msg  )  [inline]

Definition at line 69 of file exception.hpp.

template<typename T >
void aitools::util::throw_logic_error ( const std::string &  msg,
const T &  value 
) [inline]

Definition at line 56 of file exception.hpp.

References format().

Here is the call graph for this function:

template<typename T >
void aitools::util::throw_out_of_range ( const std::string &  msg,
const T &  value 
) [inline]

Definition at line 42 of file exception.hpp.

References format().

Here is the call graph for this function:

void aitools::util::throw_overflow_error ( const std::string &  msg  )  [inline]

Definition at line 87 of file exception.hpp.

void aitools::util::throw_runtime_error ( const std::string &  msg  )  [inline]

Definition at line 81 of file exception.hpp.

template<typename T >
void aitools::util::throw_runtime_error ( const std::string &  msg,
const T &  value 
) [inline]
void aitools::util::throw_underflow_error ( const std::string &  msg  )  [inline]

Definition at line 93 of file exception.hpp.

const bfs::path aitools::util::tmpdir ( const bfs::path &  parent_dir  )  [inline]

Definition at line 167 of file systemio.hpp.

References signal_error().

Here is the call graph for this function:

FILE* aitools::util::tmpfile (  )  [inline]

Definition at line 156 of file systemio.hpp.

References signal_error().

Referenced by BOOST_AUTO_TEST_CASE(), aitools::invertedindex::PostlistBuilder::swap_out_values_(), and aitools::invertedindex::System::tmpfile().

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t aitools::util::to_bytes ( memory_type  memory  )  [inline]

Definition at line 19 of file memory.hpp.

References mb1024, mb16384, mb2048, mb32768, mb4096, mb512, mb65536, and mb8192.

Referenced by aitools::bighashmap::core::big_hash_map< T >::open().

Here is the caller graph for this function:

template<typename T >
const T aitools::util::to_number ( const std::string &  value  )  [inline]

Definition at line 26 of file conversion.hpp.

References throw_invalid_argument().

Here is the call graph for this function:

template<typename T >
bool aitools::util::to_number ( const std::string &  value,
T &  number 
) [inline]

Definition at line 19 of file conversion.hpp.

std::string aitools::util::to_string ( memory_type  memory  )  [inline]

Definition at line 46 of file memory.hpp.

References mb1024, mb16384, mb2048, mb32768, mb4096, mb512, mb65536, and mb8192.

template<typename T >
std::string aitools::util::to_string ( value  )  [inline]

Definition at line 36 of file conversion.hpp.

Referenced by aitools::bighashmap::core::builder< T >::build(), record_generator< T >::operator()(), and test().

Here is the caller graph for this function:

void aitools::util::vlog_debug ( const std::string &  format,
va_list  args 
) [inline]

Definition at line 63 of file logging.hpp.

References print_timestamp_to().

Referenced by logf_debug().

Here is the call graph for this function:

Here is the caller graph for this function:

Generated on Wed May 30 15:07:42 2012 by  doxygen 1.6.3