TPIE

2362a60
tpie Namespace Reference

pipelining/factory_base.h Base class of pipelining factories More...

Namespaces

 ami
 A version of sort that takes an input stream of elements of type T, and an output stream, and and uses the < operator to sort, see also Sorting in TPIE.
 
 pipelining
 TPIE pipelining framework.
 

Classes

struct  allocation_scope_magic
 
class  allocator
 A allocator object usable in STL containers, using the TPIE memory manager. More...
 
class  array
 A generic array with a fixed size. More...
 
struct  array_allocation_scope_magic
 
class  array_iter_base
 Shared implementation of array iterators. More...
 
class  array_view
 Encapsulation of two pointers from any random access container. More...
 
class  array_view< const T >
 
class  array_view_base
 Base class for array_view. More...
 
struct  binary_argument_swap
 A binary functor with the arguments swapped. More...
 
struct  btree_augment
 
struct  btree_blocksize
 
struct  btree_comp
 
struct  btree_fanout
 
class  btree_iterator
 
struct  btree_key
 
class  btree_node
 Type that is useful for navigating a btree. More...
 
struct  BufferedHash
 
class  chaining_hash_table
 Hash table handling hash collisions by chaining. More...
 
class  close_on_fail_guard
 Implementation helper that closes the stream if a method exits by throwing an exception. More...
 
class  compressed_stream_base
 Base class containing the implementation details that are independent of the item type. More...
 
class  compression_scheme
 Abstract virtual base class for each compression scheme. More...
 
class  compressor_buffer
 A buffer for elements belonging to a specific stream block. More...
 
struct  compressor_buffer_state
 The different states of a compressor buffer. More...
 
class  compressor_request
 Tagged union containing either a read_request or a write_request. More...
 
class  compressor_request_kind
 
class  compressor_response
 Response to an I/O request. More...
 
class  compressor_thread
 
class  compressor_thread_lock
 
class  cpu_timer
 
struct  default_comp
 Default < comparator for the btree. More...
 
struct  default_unused
 
struct  default_unused< std::pair< T1, T2 > >
 
class  disjoint_sets
 Internal memory union find implementation. More...
 
struct  dummy_fraction_progress
 A fractional progress indicator that is conceptually compatible with tpie::fractional_progress. More...
 
struct  dummy_progress_indicator
 A progress indicator that is conceptually compatible with tpie::progress_indicator_base and tpie::fractional_subindicator. More...
 
struct  dynamic_store
 Fantastic store strategy. More...
 
struct  empty_augment
 Augmentation struct used in an un-augmented btree. More...
 
struct  empty_augmenter
 Functor used to augment an un-augmented btree. More...
 
struct  empty_key
 
struct  end_of_stream_exception
 
struct  exception
 
class  execution_time_predictor
 
struct  explicit_tpie_pointer_store
 Sort elements in tpie pointers. More...
 
struct  explicit_tpie_unique_pointer_store
 Sort elements in tpie unique pointers. More...
 
class  file
 Central file abstraction. More...
 
class  file_base
 
class  file_base_crtp
 Base class of classes that access files. More...
 
class  file_log_target
 A simple logger that writes messages to a tpie temporary file. More...
 
class  file_manager
 File management object used to track file usage. More...
 
class  file_stream
 Compressed stream. More...
 
class  file_stream_base
 
class  fractional_progress
 Fractional progress reporter. More...
 
class  fractional_subindicator
 Subindicator for fractional progress reporting. More...
 
struct  get_arg_help
 
struct  get_arg_help< bool >
 
struct  hash
 Default tabulation-hashing function for integral (size_t-castable) types. More...
 
struct  hash< const char * >
 Default hashing function for C-style strings. More...
 
struct  hash< std::pair< T1, T2 > >
 Default hashing function for std::pair. More...
 
struct  hash< std::string >
 Default hashing function for std::string. More...
 
class  hash_map
 Hash map implementation backed by a template parameterized hash table. More...
 
class  hash_set
 Hash set implementation backed by a template parameterized hash table. More...
 
struct  HashReflector
 Buffer based hash reflector. More...
 
struct  identity_key
 Functor used to extract the key from a value in case keys and values are the same. More...
 
class  internal_priority_queue
 Standard binary internal heap. More...
 
class  internal_queue
 A generic internal circular queue. More...
 
class  internal_stack
 A generic internal stack. More...
 
class  internal_stack_vector_base
 A base class for a generic internal fixed size stack and vector. More...
 
class  internal_vector
 A generic internal vector. More...
 
struct  invalid_argument_exception
 
struct  invalid_file_exception
 
struct  io_exception
 
class  is_simple_iterator
 Checks if an iterator is simple. More...
 
struct  is_simple_iterator_enable_if
 
struct  is_simple_iterator_enable_if< true >
 
struct  is_stream_writable
 
struct  is_stream_writable< std::pair< T1, T2 > >
 
struct  is_stream_writable< std::tuple< TT...> >
 
struct  is_stream_writable< T >
 
struct  is_stream_writable< T1, T2, TT...>
 
struct  is_stream_writable<>
 
class  is_stream_writable_override
 
struct  is_trivially_serializable
 
struct  is_trivially_serializable2
 
class  job
 
struct  job_manager_exception
 
class  JSONPrinter
 helper struct for printing More...
 
struct  JSONReflector
 refletor for json printing to an ostream More...
 
struct  linear_memory_base
 Base class of data structures with linear memory usage. More...
 
struct  linear_memory_structure_concept
 Check if a structure adheres to the linear_memory_structure concept. More...
 
struct  linear_memory_structure_doc
 Description of the methods that must be implemented to support the linear_memory_structure_concept. More...
 
class  linear_probing_hash_table
 Hash table handling hash collisions by linear probing. More...
 
class  log_group
 RAII-style management for log groups. More...
 
struct  log_group_mode
 
class  log_level_manip
 
class  log_stream_buf
 
struct  log_target
 
class  logstream
 A log is like a regular output stream, but it also supports messages at different priorities, see log_level. More...
 
struct  magic_cast_help
 
struct  magic_cast_help< bool, std::string >
 
struct  magic_cast_help< std::string, bool >
 
class  maybe
 
struct  maybe_exception
 
class  memory_bucket
 Bucket used for memory counting. More...
 
class  memory_bucket_ref
 Class storring a reference to a memory bucket. More...
 
class  memory_manager
 Memory management object used to track memory usage. More...
 
class  merge_sort_not_ready
 
class  merge_sorter
 Merge sorting consists of three phases. More...
 
class  merger
 
struct  no_key
 
class  op2TPIE_cmp
 Convert a class with a comparison operator < to a TPIE comparison object with a compare() function. More...
 
struct  open
 
struct  out_of_files_error
 
struct  out_of_memory_error
 
struct  out_of_resource_error
 Thrown when trying to allocate too much of a resource. More...
 
struct  out_of_space_exception
 
class  packed_array
 An array storring elements of type T using B bits to to store a element. More...
 
class  packed_array_iter_facade
 Base class for the iterators. More...
 
class  parallel_sort_impl
 A simple parallel sort implementation with progress tracking. More...
 
struct  plain_store
 Plain old store. More...
 
struct  pointer_store
 Sort elements using pointer indirection. More...
 
class  pq_merge_heap
 
class  pq_overflow_heap
 Overflow Priority Queue, based on a simple Heap. More...
 
class  priority_queue
 External memory priority queue implementation. More...
 
struct  priority_queue_error
 
class  progress_indicator_arrow
 A class that indicates the progress by expanding an arrow. More...
 
class  progress_indicator_base
 The base class for indicating the progress of some task. More...
 
class  progress_indicator_null
 a dummy progress indicator that produces no output More...
 
class  progress_indicator_spin
 A class that indicates the progress by a spinning cross. More...
 
class  progress_indicator_subindicator
 
class  progress_indicator_terminal
 A class that indicates the progress by a simple counter that is printed to the terminal. More...
 
struct  progress_types
 For applications where you wish to disable progress indicators via a template parameter, refer to progress_types<use_progress> members names sub, fp and base. More...
 
struct  progress_types< false >
 
class  ptime
 
class  queue
 Basic Implementation of I/O Efficient FIFO queue. More...
 
struct  read_direction
 Class enum designating a read/write direction. More...
 
class  read_request
 
class  reflect_sfinae
 
struct  reflect_tag_array_read
 
struct  reflect_tag_array_write
 
struct  reflect_tag_compute
 
struct  reflect_tag_compute< false, false, false, false, false, true >
 
struct  reflect_tag_compute< false, false, false, false, true, array_write >
 
struct  reflect_tag_compute< false, false, false, true, push_back_array_write, array_write >
 
struct  reflect_tag_compute< false, false, true, false, false, false >
 
struct  reflect_tag_compute< false, true, array_read, false, false, false >
 
struct  reflect_tag_compute< true, trivial_array_read, array_read, trivial_array_write, push_back_array_write, array_write >
 
struct  reflect_tag_direct
 
struct  reflect_tag_impl
 
struct  reflect_tag_push_back_array_write
 
struct  reflect_tag_trivial_array_read
 
struct  reflect_tag_trivial_array_write
 
class  request_base
 Base class for read_request and write_request. More...
 
class  resource_manager
 Resource management object used to track resource usage. More...
 
class  scoped_log_enabler
 
struct  serialization_error
 Class to compute the disjunction between two std true/false types. More...
 
class  serialization_reader
 
class  serialization_reverse_reader
 
class  serialization_reverse_writer
 
class  serialization_sorter
 
class  serialization_writer
 
class  serializer
 Class providing binary serialization to a std::ostream. More...
 
struct  sign
 
struct  sign< uint16_t >
 
struct  sign< uint32_t >
 
struct  sign< uint64_t >
 
struct  sign< uint8_t >
 
class  sort_manager
 A class of manager objects for merge sorting objects of type T. More...
 
struct  sort_parameters
 
class  stack
 An implementation of an external-memory stack. More...
 
class  stat_timer
 
class  stderr_log_target
 A simple logger that writes messages to stderr. More...
 
class  STL2TPIE_cmp
 Convert STL comparison object with operator() to a TPIE comparison object with a compare() function. More...
 
class  stream_buffer_pool
 Pool of shared buffers. More...
 
class  stream_buffers
 Buffer manager for a single stream. More...
 
class  stream_crtp
 
struct  stream_exception
 
struct  stream_header_t
 
class  stream_position
 POD object indicating the position of an item in a stream. More...
 
struct  sysinfo
 Class providing system and platform info. More...
 
class  temp_file
 Class representing a reference to a temporary file. More...
 
struct  tempfile_error
 
struct  template_log
 Computes the least integer strictly greater than log(t). More...
 
struct  template_log< 1 >
 
class  tempname
 Static methods for generating temporary file names and finding temporary file directories. More...
 
class  testmanip
 
class  tests
 
class  teststream
 
class  teststream_buf
 
class  TPIE2STL_cmp
 Convert a TPIE comparison object with a compare() function to STL comparison object with operator(). More...
 
struct  tpie_deleter
 
struct  trivial_same_size
 
class  uncompressed_stream
 Simple class acting both as file and a file::stream. More...
 
class  unique_id_type
 
class  unserializer
 Class for unserializing binary data serialized with the serializer Data can be unserialized using the >> operators. More...
 
struct  unsign
 
struct  unsign< int16_t >
 
struct  unsign< int32_t >
 
struct  unsign< int64_t >
 
struct  unsign< int8_t >
 
class  write_request
 

Typedefs

typedef packed_array< bool, 1 > bit_array
 Packed array of bits. More...
 
using btree_internal = bbits::int_opt< bbits::f_internal >
 
using btree_external = bbits::int_opt< 0 >
 
using btree_static = bbits::int_opt< bbits::f_static >
 
using btree_dynamic = bbits::int_opt< 0 >
 
using btree_unordered = bbits::int_opt< bbits::f_unordered >
 
using btree_ordered = bbits::int_opt< 0 >
 
using btree_serialized = bbits::int_opt< bbits::f_serialized >
 
using btree_not_serialized = bbits::int_opt< 0 >
 
template<typename T , typename... Opts>
using btree = bbits::tree< T, typename bbits::OptComp< Opts...>::type >
 
template<typename T , typename... Opts>
using btree_builder = bbits::builder< T, typename bbits::OptComp< Opts...>::type >
 
typedef uint64_t time_type
 
typedef
file_accessor::raw_file_accessor 
default_raw_file_accessor
 
typedef
file_accessor::stream_accessor
< default_raw_file_accessor
default_file_accessor
 
template<typename T >
using unique_ptr = std::unique_ptr< T, tpie_deleter >
 like std::unique_ptr, but delete the object with tpie_delete. More...
 
typedef dynamic_store default_store
 
typedef uint64_t hash_type
 
typedef TPIE_OS_SIZE_T arity_t
 Intended to signal the number of input streams in a merge. More...
 
typedef uint64_t stream_size_type
 
typedef int64_t stream_offset_type
 
typedef std::size_t memory_size_type
 
typedef ssize_t memory_offset_type
 
typedef stream_offset_type offset_type
 
typedef ssize_t ssize_type
 
typedef size_t size_type
 
typedef
std::chrono::high_resolution_clock 
test_clock
 
typedef
std::chrono::time_point
< test_clock > 
test_time
 

Enumerations

enum  access_type { access_read, access_write, access_read_write }
 Type describing how we wish to access a file. More...
 
enum  cache_hint { access_normal, access_sequential, access_random }
 
enum  compression_flags { compression_none = 0, compression_normal = 1, compression_all = 2 }
 Possible values for the compressionFlags parameter to stream::open. More...
 
enum  log_level {
  LOG_FATAL = 0, LOG_ERROR, LOG_WARNING, LOG_INFORMATIONAL,
  LOG_APP_DEBUG, LOG_DEBUG, LOG_MEM_DEBUG, LOG_USER1,
  LOG_USER2, LOG_USER3
}
 TPIE logging levels, from higest priority to lowest. More...
 
enum  description_importance { IMPORTANCE_NONE, IMPORTANCE_LOG, IMPORTANCE_MINOR, IMPORTANCE_MAJOR }
 
enum  resource_type { FILES, MEMORY, TOTAL_RESOURCE_TYPES, NO_RESOURCE }
 
enum  stream_usage {
  STREAM_USAGE_OVERHEAD = 1, STREAM_USAGE_BUFFER, STREAM_USAGE_CURRENT, STREAM_USAGE_MAXIMUM,
  STREAM_USAGE_SUBSTREAM
}
 
enum  subsystem {
  MEMORY_MANAGER =1, DEFAULT_LOGGING =2, PROGRESS =4, PRIMEDB =8,
  JOB_MANAGER =16, CAPTURE_FRACTIONS =32, STREAMS =64, HASH =128,
  TEMPFILE =256, FILE_MANAGER =512, ALL =MEMORY_MANAGER | DEFAULT_LOGGING | PROGRESS | PRIMEDB | JOB_MANAGER | STREAMS | HASH | TEMPFILE | FILE_MANAGER
}
 Subsystems of TPIE. More...
 

Functions

template<typename T >
std::ostream & operator<< (std::ostream &o, const array< T > &a)
 
template<typename T >
array_view< typename
std::remove_pointer< typename
std::iterator_traits< T >
::pointer >::type > 
make_array_view (T start, T end)
 
template<typename T >
array_view< T > make_array_view (T *start, T *end)
 
template<typename T >
array_view< typename
T::value_type > 
make_array_view (T &s)
 
template<typename T >
array_view< typename
T::value_type > 
make_array_view (T &s, size_t start, size_t end)
 
template<typename T >
array_view< const typename
T::value_type > 
make_array_view (const T &s)
 
template<typename T >
array_view< const typename
T::value_type > 
make_array_view (const T &s, size_t start, size_t end)
 
void backtrace (std::ostream &out, int depth=1024)
 Output a function call backtrace for debugging. More...
 
void __softassert (const char *expr, const char *file, int line)
 Do not use this directly; use the softassert() macro instead. More...
 
void init_stream_buffer_pool ()
 Used by tpie::init to initialize stream buffer pool. More...
 
void finish_stream_buffer_pool ()
 Used by tpie::finish to free stream buffer pool. More...
 
stream_buffer_poolthe_stream_buffer_pool ()
 Get the stream buffer pool singleton. More...
 
void init_compressor ()
 
void finish_compressor ()
 
compressor_threadthe_compressor_thread ()
 
const compression_schemeget_compression_scheme_none ()
 
const compression_schemeget_compression_scheme_snappy ()
 
const compression_schemeget_compression_scheme (compression_scheme::type t)
 
std::ostream & operator<< (std::ostream &s, cpu_timer &ct)
 Enable outputting the queriable values of this timer. More...
 
void init_execution_time_db ()
 Used by tpie_init to initialize the execution time database. More...
 
void finish_execution_time_db ()
 Used by tpie_finish to deinitialize the execution time database. More...
 
void init_file_manager ()
 Used by tpie_init to initialize the file manager. More...
 
void finish_file_manager ()
 Used by tpie_finish to deinitialize the file manager. More...
 
file_managerget_file_manager ()
 Return a reference to the file manager. More...
 
void init_fraction_db (bool capture_progress=false)
 Used by tpie_init to initialize the fraction database. More...
 
void finish_fraction_db ()
 Used by tpie_finish to deinitialize the fraction database. More...
 
void update_fractions (const char *name, float frac, stream_size_type n)
 
void load_fractions (const std::string &path)
 
void save_fractions (const std::string &path, bool force=false)
 
void init_hash ()
 
template<typename R , typename T , typename... TT>
bool reflect (R &r, T &&v, TT &&...vs)
 
template<typename H , typename T >
void ghash (H &h, const T &t)
 Hash t using reflection. More...
 
memory_size_type default_worker_count ()
 Return the number of job threads initialized by the job framework in init_job(). More...
 
void init_job ()
 Used by tpie_init to initialize the job subsystem. More...
 
void finish_job ()
 Used by tpie_finish to deinitialize the job subsystem. More...
 
template<typename T >
JSONPrinter< T > json_printer (const T &t, bool pretty=true)
 create a json print wrapper around t More...
 
void add_log_target (log_target *t)
 
void remove_log_target (log_target *t)
 
void begin_log_group (const std::string &name)
 
void end_log_group ()
 
log_level_manip setlevel (log_level p)
 
void init_memory_manager ()
 Used by tpie_init to initialize the memory manager. More...
 
void finish_memory_manager ()
 Used by tpie_finish to deinitialize the memory manager. More...
 
memory_managerget_memory_manager ()
 Return a reference to the memory manager. More...
 
void __register_pointer (void *p, size_t size, const std::type_info &t)
 
void __unregister_pointer (void *p, size_t size, const std::type_info &t)
 
void assert_tpie_ptr (void *p)
 In a debug build, assert that a given pointer has been allocated with tpie_new. More...
 
template<typename D , typename T >
ptr_cast (T *t)
 Cast between pointer types. More...
 
template<typename T >
T * __allocate ()
 
template<typename T >
size_t tpie_size (T *p)
 
template<typename T >
T * tpie_new_array (size_t size)
 Allocate a new array and register its memory usage. More...
 
template<typename T , typename... Args>
T * tpie_new (Args &&...args)
 Allocate an element of the type given as template parameter, and register its memory usage with TPIE. More...
 
template<typename T >
void tpie_delete (T *p) throw ()
 Delete an object allocated with tpie_new. More...
 
template<typename T >
void tpie_delete_array (T *a, size_t size) throw ()
 Delete an array allocated with tpie_new_array. More...
 
template<typename T , typename... TT>
unique_ptr< T > make_unique (TT &&...tt)
 Create a new unique object using tpie::new. More...
 
size_t consecutive_memory_available (size_t granularity=5 *1024 *1024)
 Find the largest amount of memory that can be allocated as a single chunk. More...
 
template<typename CT , bool f, typename RT >
CT operator+ (ptrdiff_t n, const packed_array_iter_facade< CT, f, RT > &i)
 
template<bool Progress, typename iterator_type , typename comp_type >
void parallel_sort (iterator_type a, iterator_type b, typename tpie::progress_types< Progress >::base &pi, comp_type comp=std::less< typename boost::iterator_value< iterator_type >::type >())
 Sort items in the range [a,b) using a parallel quick sort. More...
 
template<typename iterator_type , typename comp_type >
void parallel_sort (iterator_type a, iterator_type b, comp_type comp=std::less< typename boost::iterator_value< iterator_type >::type >())
 Sort items in the range [a,b) using a parallel quick sort. More...
 
void init_prime ()
 Used by tpie_init to initialize the prime number database. More...
 
void finish_prime ()
 Used by tpie_finish to deinitialize the prime number database. More...
 
bool is_prime (size_type i)
 Check if i is a prime. More...
 
hash_type prime_hash (const std::string &s)
 Calculate a fairly good string hash based on prime numbers. More...
 
size_t next_prime (size_t i)
 Get next prime. More...
 
template<typename D , typename R , typename... T>
bool reflect_dispatch (reflect_tag_impl, R &r, T &&...v)
 
template<typename D , typename R , typename... T>
bool reflect_dispatch (reflect_tag_direct, R &r, T &&...v)
 
template<typename D , typename R , typename T , typename... TT>
bool reflect_dispatch (reflect_tag_array_read, R &r, T &&v, TT &&...vs)
 
template<typename D , typename R , typename T >
bool reflect_dispatch (reflect_tag_trivial_array_read, R &r, T &&v)
 
template<typename D , typename R , typename T >
bool reflect_dispatch (reflect_tag_array_write, R &r, T &&v)
 
template<typename D , typename R , typename T >
bool reflect_dispatch (reflect_tag_trivial_array_write, R &r, T &&v)
 
template<typename D , typename R , typename T >
bool reflect_dispatch (reflect_tag_push_back_array_write, R &r, T &&v)
 
template<size_t C, typename R , typename T >
bool reflect_static_array_dispatch (std::true_type, R &r, T &&v)
 
template<size_t C, typename R , typename T , typename... TT>
bool reflect_static_array_dispatch (std::false_type, R &r, T &&v, TT &&...vv)
 
template<typename R , typename T , std::size_t C, typename... TT>
bool reflect (R &r, T(&v)[C], TT &&...vs)
 
template<typename R , typename T , std::size_t C, typename... TT>
bool reflect (R &r, const std::array< T, C > &v, TT &&...vs)
 
template<typename R , typename T , std::size_t C, typename... TT>
bool reflect (R &r, std::array< T, C > &v, TT &&...vs)
 
std::ostream & operator<< (std::ostream &os, const resource_type t)
 
template<typename D >
void serialize (D &dst, const foo &v)
 Sample tpie::serialize prototype. More...
 
template<typename S >
void unserialize (S &src, foo &v)
 Sample tpie::unserialize prototype. More...
 
template<typename D , typename T >
void serialize (D &dst, const T &v, typename std::enable_if< is_trivially_serializable< T >::value >::type *=0)
 tpie::serialize for POD/array types. More...
 
template<typename S , typename T >
void unserialize (S &src, T &v, typename std::enable_if< is_trivially_serializable< T >::value >::type *=0)
 tpie::unserialize for POD/array types. More...
 
template<typename D , typename T >
void serialize (D &dst, T start, T end)
 Serialize an array of serializables. More...
 
template<typename D , typename T >
void unserialize (D &dst, T start, T end)
 Unserialize an array of serializables. More...
 
template<typename D , typename T , std::size_t size>
void serialize (D &dst, const T(&x)[size])
 tpie::serialize for fixed-length C-style arrays of serializable items. More...
 
template<typename S , typename T , std::size_t size>
void unserialize (S &src, T(&x)[size])
 tpie::unserialize for fixed-length C-style arrays unserializable items. More...
 
template<typename D , typename T , std::size_t size>
void serialize (D &dst, const std::array< T, size > &v)
 tpie::serialize for std::arrays of serializable items. More...
 
template<typename S , typename T , std::size_t size>
void unserialize (S &src, std::array< T, size > &v)
 tpie::unserialize for std::arrays of unserializable items. More...
 
template<typename D , typename T , typename alloc_t >
void serialize (D &dst, const std::vector< T, alloc_t > &v)
 tpie::serialize for std::vectors of serializable items. More...
 
template<typename S , typename T , typename alloc_t >
void unserialize (S &src, std::vector< T, alloc_t > &v)
 tpie::unserialize for std::vectors of unserializable items. More...
 
template<typename D , typename T >
void serialize (D &dst, const std::basic_string< T > &v)
 tpie::serialize for std::basic_strings of serializable items, including std::strings. More...
 
template<typename S , typename T >
void unserialize (S &src, std::basic_string< T > &v)
 tpie::unserialize for std::basic_strings of unserializable items, including std::strings. More...
 
template<typename T >
size_t serialized_size (const T &v)
 Given a serializable, serialize it and measure its serialized size. More...
 
template<typename T , typename Compare >
void sort (uncompressed_stream< T > &instream, uncompressed_stream< T > &outstream, Compare comp, progress_indicator_base &indicator)
 Sort elements of a stream using the given STL-style comparator object. More...
 
template<typename T >
void sort (uncompressed_stream< T > &instream, uncompressed_stream< T > &outstream, tpie::progress_indicator_base *indicator=NULL)
 Sort elements of a stream using the less-than operator. More...
 
template<typename T >
void sort (file_stream< T > &instream, file_stream< T > &outstream, tpie::progress_indicator_base *indicator=NULL)
 Sort elements of a stream using the less-than operator. More...
 
template<typename T , typename Compare >
void sort (uncompressed_stream< T > &instream, Compare comp, progress_indicator_base &indicator)
 Sort elements of a stream in-place using the given STL-style comparator object. More...
 
template<typename T , typename Compare >
void sort (file_stream< T > &instream, Compare comp, progress_indicator_base &indicator)
 Sort elements of a stream in-place using the given STL-style comparator object. More...
 
template<typename T >
void sort (uncompressed_stream< T > &instream, progress_indicator_base &indicator)
 Sort elements of a stream in-place using the less-than operator. More...
 
template<typename T >
void sort (file_stream< T > &instream, progress_indicator_base &indicator)
 
template<typename T >
void sort (uncompressed_stream< T > &instream)
 Sort elements of a stream in-place using the less-than operator and no progress indicator. More...
 
stream_size_type get_temp_file_usage ()
 Return the number of bytes currently being used by temporary files. More...
 
void increment_temp_file_usage (stream_offset_type delta)
 Increment (possibly by a negative amount) the number of bytes being used by temporary files. More...
 
stream_size_type get_bytes_read ()
 Return the number of bytes read from disk since program start. More...
 
stream_size_type get_bytes_written ()
 Return the number of bytes written to disk since program start. More...
 
void increment_bytes_read (stream_size_type delta)
 Inform that stats module that an additional delta bytes have been read from disk. More...
 
void increment_bytes_written (stream_size_type delta)
 Inform the stats module that an additional delta bytes have been written to disk. More...
 
stream_size_type get_user (size_t i)
 
void increment_user (size_t i, stream_size_type delta)
 
std::ostream & operator<< (std::ostream &s, const sysinfo &info)
 Report default system info to the specified ostream. More...
 
void finish_tempfile ()
 
void tpie_init (flags< subsystem > subsystems=ALL)
 Initialize the given subsystems of TPIE. More...
 
void tpie_finish (flags< subsystem > subsystems=ALL)
 Deinitialize the given subsystems of TPIE. More...
 
memory_size_type get_block_size ()
 Get the TPIE block size. More...
 
void set_block_size (memory_size_type block_size)
 Set the TPIE block size. More...
 
const std::string & log_name ()
 Returns the file name of the log stream. More...
 
void init_default_log ()
 Used by tpie_init to initialize the log subsystem. More...
 
void finish_default_log ()
 Used by tpie_finish to deinitialize the log subsystem. More...
 
logstreamget_log_by_level (log_level level)
 
logstreamlog_fatal ()
 Return logstream for writing fatal log messages. More...
 
logstreamlog_error ()
 Return logstream for writing error log messages. More...
 
logstreamlog_info ()
 Return logstream for writing info log messages. More...
 
logstreamlog_warning ()
 Return logstream for writing warning log messages. More...
 
logstreamlog_app_debug ()
 Return logstream for writing app_debug log messages. More...
 
logstreamlog_debug ()
 Return logstream for writing debug log messages. More...
 
logstreamlog_mem_debug ()
 Return logstream for writing mem_debug log messages. More...
 
log_bits::log_selector get_log ()
 Returns the only logstream object. More...
 
test_time test_now ()
 
double test_millisecs (const test_time &from, const test_time &to)
 
double test_secs (const test_time &from, const test_time &to)
 
testmanip< bool > result (bool success)
 
testmanip< bool > success ()
 
testmanip< bool > failure ()
 
template<typename dst , typename src >
dst magic_cast (const src &s)
 
template<typename T >
void unused (const T &x)
 Declare that a variable is unused on purpose. More...
 
template<typename T , typename C >
void pop_and_push_heap (T a, T b, C lt)
 Restore heap invariants after the first element has been replaced by some other element. More...
 
template<typename T >
void pop_and_push_heap (T a, T b)
 Restore heap invariants after the first element has been replaced by some other element. More...
 
void atomic_rename (const std::string &src, const std::string &dst)
 
template<typename T >
void free_structure_memory (T &v)
 Free the memory assosiated with a stl or tpie structure by swapping it with a default constructed structure of the same type. More...
 

Variables

enum TPIE_DEPRECATED_CLASS_B
tpie::persistence 
TPIE_DEPRECATED_CLASS_C
 
const char * git_commit
 The Git commit hash (40 hexadecimal characters) that TPIE was built from. More...
 
const char * git_refspec
 The Git refspec that TPIE was built from. More...
 
const char directory_delimiter = '/'
 

Detailed Description

pipelining/factory_base.h Base class of pipelining factories

TPIE's namespace.

Typedef Documentation

typedef TPIE_OS_SIZE_T tpie::arity_t

Intended to signal the number of input streams in a merge.

Definition at line 51 of file sort_manager.h.

typedef packed_array<bool, 1> tpie::bit_array

Packed array of bits.

Definition at line 31 of file bit_array.h.

template<typename T >
using tpie::unique_ptr = typedef std::unique_ptr<T, tpie_deleter>

like std::unique_ptr, but delete the object with tpie_delete.

Template Parameters
Tthe type of the object.

Definition at line 338 of file memory.h.

Enumeration Type Documentation

Type describing how we wish to access a file.

Enumerator
access_read 

Open a file for reading.

access_write 

Open a file for writing only, content is truncated.

access_read_write 

Open a file for reading or writing.

Definition at line 29 of file access_type.h.

29  {
36 };
Open a file for reading.
Definition: access_type.h:31
Open a file for writing only, content is truncated.
Definition: access_type.h:33
Open a file for reading or writing.
Definition: access_type.h:35
Enumerator
access_normal 

Neither sequential access nor random access is intended.

Corresponds to POSIX_FADV_NORMAL.

access_sequential 

Sequential access is intended.

Default for file_stream. Corresponds to POSIX_FADV_SEQUENTIAL and FILE_FLAG_SEQUENTIAL_SCAN (Win32).

access_random 

Random access is intended.

Corresponds to POSIX_FADV_RANDOM and FILE_FLAG_RANDOM_ACCESS (Win32).

Definition at line 28 of file cache_hint.h.

28  {
32 
37 
41 };
Sequential access is intended.
Definition: cache_hint.h:36
Random access is intended.
Definition: cache_hint.h:40
Neither sequential access nor random access is intended.
Definition: cache_hint.h:31

Possible values for the compressionFlags parameter to stream::open.

Enumerator
compression_none 

No written blocks should be compressed.

If a new stream is opened with compression_none, it will support seek(n) and truncate(n) for arbitrary n.

compression_normal 

Compress some blocks according to available resources (time, memory).

compression_all 

Compress all blocks according to the preferred compression scheme which can be set using tpie::the_compressor_thread().set_preferred_compression().

Definition at line 33 of file scheme.h.

33  {
37  compression_none = 0,
44  compression_all = 2
45 };
No written blocks should be compressed.
Definition: scheme.h:37
Compress some blocks according to available resources (time, memory).
Definition: scheme.h:40
Compress all blocks according to the preferred compression scheme which can be set using tpie::the_co...
Definition: scheme.h:44

TPIE logging levels, from higest priority to lowest.

Enumerator
LOG_FATAL 

LOG_FATAL is the highest error level and is used for all kinds of errors that would normally impair subsequent computations; LOG_FATAL errors are always logged.

LOG_ERROR 

LOG_ERROR is used for none fatal errors.

LOG_WARNING 

LOG_WARNING is used for warnings.

LOG_INFORMATIONAL 

LOG_INFORMATIONAL is used for informational messagse.

LOG_APP_DEBUG 

LOG_APP_DEBUG can be used by applications built on top of TPIE, for logging debugging information.

LOG_DEBUG 

LOG_DEBUG is the lowest level and is used by the TPIE library for logging debugging information.

LOG_MEM_DEBUG 

Logging level for warnings concerning memory allocation and deallocation.

LOG_USER1 

Logging levels to be further defined by user applications.

Definition at line 33 of file loglevel.h.

33  {
37  LOG_FATAL = 0,
38 
40  LOG_ERROR,
41 
43  LOG_WARNING,
44 
47 
51 
54  LOG_DEBUG,
55 
58 
60  LOG_USER1,
61  LOG_USER2,
62  LOG_USER3
63 };
Logging level for warnings concerning memory allocation and deallocation.
Definition: loglevel.h:57
LOG_FATAL is the highest error level and is used for all kinds of errors that would normally impair s...
Definition: loglevel.h:37
LOG_ERROR is used for none fatal errors.
Definition: loglevel.h:40
LOG_WARNING is used for warnings.
Definition: loglevel.h:43
LOG_INFORMATIONAL is used for informational messagse.
Definition: loglevel.h:46
Logging levels to be further defined by user applications.
Definition: loglevel.h:60
LOG_DEBUG is the lowest level and is used by the TPIE library for logging debugging information...
Definition: loglevel.h:54
LOG_APP_DEBUG can be used by applications built on top of TPIE, for logging debugging information...
Definition: loglevel.h:50
Enumerator
STREAM_USAGE_OVERHEAD 

Overhead of the object without the buffer.

STREAM_USAGE_BUFFER 

Max amount ever used by a buffer.

STREAM_USAGE_CURRENT 

Amount currently in use.

STREAM_USAGE_MAXIMUM 

Max amount that will ever be used.

STREAM_USAGE_SUBSTREAM 

Maximum additional amount used by each substream created.

Definition at line 28 of file stream_usage.h.

28  {
39  };
Amount currently in use.
Definition: stream_usage.h:34
Maximum additional amount used by each substream created.
Definition: stream_usage.h:38
Max amount that will ever be used.
Definition: stream_usage.h:36
Overhead of the object without the buffer.
Definition: stream_usage.h:30
Max amount ever used by a buffer.
Definition: stream_usage.h:32

Subsystems of TPIE.

Enumerator
MEMORY_MANAGER 

Needed for tpie_new and tpie_delete and implicitly needed by all TPIE algorithm and data structure implementations.

DEFAULT_LOGGING 

TPIE logging framework.

See tpie_log.h.

PROGRESS 

Progress tracking.

Needed for the fraction database.

PRIMEDB 

Prime number database, for prime.h.

JOB_MANAGER 

Job manager, for job.h and the parallel quick sort.

CAPTURE_FRACTIONS 

Capture fractions.

STREAMS 

Enable support for streams.

HASH 

Generate random hashcodes for tabulation hashing.

TEMPFILE 

Generate temporary files.

FILE_MANAGER 

Needed for working with files and implicitly by all TPIE algorithm and data structure implementations.

ALL 

Alias for all default subsystems.

Definition at line 39 of file tpie.h.

39  {
46  PROGRESS=4,
48  PRIMEDB=8,
50  JOB_MANAGER=16,
54  STREAMS=64,
56  HASH=128,
58  TEMPFILE=256,
61  FILE_MANAGER=512,
64 };
Generate temporary files.
Definition: tpie.h:58
Needed for tpie_new and tpie_delete and implicitly needed by all TPIE algorithm and data structure im...
Definition: tpie.h:42
Generate random hashcodes for tabulation hashing.
Definition: tpie.h:56
Alias for all default subsystems.
Definition: tpie.h:63
Prime number database, for prime.h.
Definition: tpie.h:48
Capture fractions.
Definition: tpie.h:52
Needed for working with files and implicitly by all TPIE algorithm and data structure implementations...
Definition: tpie.h:61
Job manager, for job.h and the parallel quick sort.
Definition: tpie.h:50
TPIE logging framework.
Definition: tpie.h:44
Enable support for streams.
Definition: tpie.h:54
Progress tracking.
Definition: tpie.h:46

Function Documentation

void tpie::__register_pointer ( void *  p,
size_t  size,
const std::type_info &  t 
)
inline

Register a pointer, for debugging memory leaks and such.

Definition at line 117 of file memory.h.

References get_memory_manager(), and unused().

117  {
118 #ifndef TPIE_NDEBUG
119  get_memory_manager().register_pointer(p, size, t);
120 #else
121  unused(p);
122  unused(size);
123  unused(t);
124 #endif
125 }
void unused(const T &x)
Declare that a variable is unused on purpose.
Definition: util.h:42
memory_manager & get_memory_manager()
Return a reference to the memory manager.
void tpie::__softassert ( const char *  expr,
const char *  file,
int  line 
)

Do not use this directly; use the softassert() macro instead.

See also
softassert()
void tpie::__unregister_pointer ( void *  p,
size_t  size,
const std::type_info &  t 
)
inline

Unregister a registered pointer.

Definition at line 131 of file memory.h.

References get_memory_manager(), and unused().

Referenced by tpie_delete(), and tpie_delete_array().

131  {
132 #ifndef TPIE_NDEBUG
133  get_memory_manager().unregister_pointer(p, size, t);
134 #else
135  unused(p);
136  unused(size);
137  unused(t);
138 #endif
139 }
void unused(const T &x)
Declare that a variable is unused on purpose.
Definition: util.h:42
memory_manager & get_memory_manager()
Return a reference to the memory manager.
void tpie::assert_tpie_ptr ( void *  p)
inline

In a debug build, assert that a given pointer has been allocated with tpie_new.

Definition at line 145 of file memory.h.

References get_memory_manager(), and unused().

145  {
146 #ifndef TPIE_NDEBUG
147  if (p)
148  get_memory_manager().assert_tpie_ptr(p);
149 #else
150  unused(p);
151 #endif
152 }
void unused(const T &x)
Declare that a variable is unused on purpose.
Definition: util.h:42
memory_manager & get_memory_manager()
Return a reference to the memory manager.
void tpie::backtrace ( std::ostream &  out,
int  depth = 1024 
)

Output a function call backtrace for debugging.

Does not support Windows. On Linux, uses cxxabi.h and execinfo.h to inspect the stack at runtime.

size_t tpie::consecutive_memory_available ( size_t  granularity = 5 *1024 *1024)

Find the largest amount of memory that can be allocated as a single chunk.

memory_size_type tpie::default_worker_count ( )

Return the number of job threads initialized by the job framework in init_job().

When hardware concurrency is less than four, for instance on a dual-core processor without hyperthreading, or a single-core processor, the number of threads launched is equal to the number of cores. When hardware concurrency is four or greater, the job framework spares one core for the user interface.

Referenced by tpie::pipelining::parallel().

void tpie::finish_default_log ( )

Used by tpie_finish to deinitialize the log subsystem.

void tpie::finish_execution_time_db ( )

Used by tpie_finish to deinitialize the execution time database.

void tpie::finish_file_manager ( )

Used by tpie_finish to deinitialize the file manager.

void tpie::finish_fraction_db ( )

Used by tpie_finish to deinitialize the fraction database.

void tpie::finish_job ( )

Used by tpie_finish to deinitialize the job subsystem.

void tpie::finish_memory_manager ( )

Used by tpie_finish to deinitialize the memory manager.

void tpie::finish_prime ( )

Used by tpie_finish to deinitialize the prime number database.

void tpie::finish_stream_buffer_pool ( )

Used by tpie::finish to free stream buffer pool.

template<typename T >
void tpie::free_structure_memory ( T &  v)
inline

Free the memory assosiated with a stl or tpie structure by swapping it with a default constructed structure of the same type.

Definition at line 179 of file util.h.

Referenced by tpie::pipelining::bits::chunker_t< dest_t >::end().

179  {
180  T t;
181  std::swap(v, t);
182 }
memory_size_type tpie::get_block_size ( )

Get the TPIE block size.

This can be changed by setting the TPIE_BLOCK_SIZE environment variable or by calling the set_block_size method.

The default is 2 MiB (2**21 bytes).

Referenced by tpie::file_base_crtp< file_stream_base >::block_size().

stream_size_type tpie::get_bytes_read ( )

Return the number of bytes read from disk since program start.

stream_size_type tpie::get_bytes_written ( )

Return the number of bytes written to disk since program start.

file_manager& tpie::get_file_manager ( )

Return a reference to the file manager.

May only be called when init_file_manager has been called. See tpie_init().

Referenced by tpie::ami::stream_old< T >::available_streams(), and tpie::pipelining::bits::pipeline_base::operator()().

log_bits::log_selector tpie::get_log ( )
inline

Returns the only logstream object.

Definition at line 255 of file tpie_log.h.

255 {return log_bits::log_selector();}
memory_manager& tpie::get_memory_manager ( )

Return a reference to the memory manager.

May only be called when init_memory_manager has been called. See tpie_init().

Referenced by __register_pointer(), __unregister_pointer(), assert_tpie_ptr(), tpie::merge_sorter< T, UseProgress, pred_t, store_t >::end(), tpie_delete(), and tpie_delete_array().

stream_size_type tpie::get_temp_file_usage ( )

Return the number of bytes currently being used by temporary files.

template<typename H , typename T >
void tpie::ghash ( H &  h,
const T &  t 
)
inline

Hash t using reflection.

Definition at line 204 of file hash.h.

204  {
205  HashReflector<H> r(h);
206  reflect(r, t);
207 }
void tpie::increment_bytes_read ( stream_size_type  delta)

Inform that stats module that an additional delta bytes have been read from disk.

void tpie::increment_bytes_written ( stream_size_type  delta)

Inform the stats module that an additional delta bytes have been written to disk.

void tpie::increment_temp_file_usage ( stream_offset_type  delta)

Increment (possibly by a negative amount) the number of bytes being used by temporary files.

void tpie::init_default_log ( )

Used by tpie_init to initialize the log subsystem.

void tpie::init_execution_time_db ( )

Used by tpie_init to initialize the execution time database.

void tpie::init_file_manager ( )

Used by tpie_init to initialize the file manager.

void tpie::init_fraction_db ( bool  capture_progress = false)

Used by tpie_init to initialize the fraction database.

void tpie::init_job ( )

Used by tpie_init to initialize the job subsystem.

void tpie::init_memory_manager ( )

Used by tpie_init to initialize the memory manager.

void tpie::init_prime ( )

Used by tpie_init to initialize the prime number database.

void tpie::init_stream_buffer_pool ( )

Used by tpie::init to initialize stream buffer pool.

bool tpie::is_prime ( size_type  i)

Check if i is a prime.

Parameters
inumber to check, must be less then 4294967295.
Returns
true if and only if i is a prime number.

Referenced by tpie::chaining_hash_table< value_t, hash_t, equal_t, index_t >::resize(), and tpie::linear_probing_hash_table< value_t, hash_t, equal_t, index_t >::resize().

template<typename T >
JSONPrinter<T> tpie::json_printer ( const T &  t,
bool  pretty = true 
)
inline

create a json print wrapper around t

Example: std::cout << json_printer(42) << std::endl;

Definition at line 100 of file jsonprint.h.

100 {return JSONPrinter<T>(t, pretty);}
logstream& tpie::log_app_debug ( )
inline

Return logstream for writing app_debug log messages.

Definition at line 162 of file tpie_log.h.

References LOG_APP_DEBUG.

162 {return get_log_by_level(LOG_APP_DEBUG);}
LOG_APP_DEBUG can be used by applications built on top of TPIE, for logging debugging information...
Definition: loglevel.h:50
logstream& tpie::log_debug ( )
inline

Return logstream for writing debug log messages.

Definition at line 167 of file tpie_log.h.

References LOG_DEBUG.

Referenced by tpie::merge_sorter< T, UseProgress, pred_t, store_t >::begin(), tpie::merge_sorter< T, UseProgress, pred_t, store_t >::end(), tpie::pipelining::serialization_bits::sort_calc_t< Traits >::go(), tpie::merge_sorter< T, UseProgress, pred_t, store_t >::set_items(), and tpie::merge_sorter< T, UseProgress, pred_t, store_t >::set_parameters().

167 {return get_log_by_level(LOG_DEBUG);}
LOG_DEBUG is the lowest level and is used by the TPIE library for logging debugging information...
Definition: loglevel.h:54
logstream& tpie::log_fatal ( )
inline

Return logstream for writing fatal log messages.

Definition at line 142 of file tpie_log.h.

References LOG_FATAL.

142 {return get_log_by_level(LOG_FATAL);}
LOG_FATAL is the highest error level and is used for all kinds of errors that would normally impair s...
Definition: loglevel.h:37
logstream& tpie::log_info ( )
inline

Return logstream for writing info log messages.

Definition at line 152 of file tpie_log.h.

References LOG_INFORMATIONAL.

152 {return get_log_by_level(LOG_INFORMATIONAL);}
LOG_INFORMATIONAL is used for informational messagse.
Definition: loglevel.h:46
logstream& tpie::log_mem_debug ( )
inline

Return logstream for writing mem_debug log messages.

Definition at line 172 of file tpie_log.h.

References LOG_MEM_DEBUG.

172 {return get_log_by_level(LOG_MEM_DEBUG);}
Logging level for warnings concerning memory allocation and deallocation.
Definition: loglevel.h:57
const std::string& tpie::log_name ( )

Returns the file name of the log stream.

This assumes that init_default_log has been called.

logstream& tpie::log_warning ( )
inline

Return logstream for writing warning log messages.

Definition at line 157 of file tpie_log.h.

References LOG_WARNING.

Referenced by tpie::pipelining::serialization_bits::sort_pull_output_t< Traits >::go(), tpie::pipelining::bits::sort_pull_output_t< T, pred_t, store_t >::go(), and tpie::pipelining::node::go().

157 {return get_log_by_level(LOG_WARNING);}
LOG_WARNING is used for warnings.
Definition: loglevel.h:43
template<typename T , typename... TT>
unique_ptr<T> tpie::make_unique ( TT &&...  tt)
inline

Create a new unique object using tpie::new.

Template Parameters
Tthe type of the object.

Definition at line 345 of file memory.h.

345  {
346  return unique_ptr<T>(tpie_new<T>(std::forward<TT>(tt)...));
347 }
size_t tpie::next_prime ( size_t  i)

Get next prime.

Parameters
iSubject to same restrictions as in is_prime.
Returns
Least prime greater than or equal to i.
std::ostream& tpie::operator<< ( std::ostream &  s,
cpu_timer &  ct 
)

Enable outputting the queriable values of this timer.

On Windows, just output the elapsed real time in seconds. On Linux, output user, system and wall clock time in seconds.

std::ostream& tpie::operator<< ( std::ostream &  s,
const sysinfo &  info 
)
inline

Report default system info to the specified ostream.

See also
sysinfo::printinfo

Definition at line 181 of file sysinfo.h.

References tpie::sysinfo::blocksize(), tpie::sysinfo::commit(), tpie::sysinfo::hostname(), tpie::sysinfo::localtime(), tpie::sysinfo::platform(), and tpie::sysinfo::refspec().

181  {
182  return s
183  << "Hostname: " << info.hostname() << '\n'
184  << "Platform: " << info.platform() << '\n'
185  << "Git branch: " << info.refspec() << '\n'
186  << "Git commit: " << info.commit() << '\n'
187  << "Local time: " << info.localtime() << '\n'
188  << "Block size: " << info.blocksize() << '\n'
189  << "Parallel sort: "
190 #ifdef TPIE_PARALLEL_SORT
191  << "Enabled"
192 #else
193  << "Disabled"
194 #endif
195  << '\n'
196  << "Snappy: "
197 #ifdef TPIE_HAS_SNAPPY
198  << "Enabled"
199 #else
200  << "Disabled"
201 #endif
202  << '\n'
203  ;
204 }
template<bool Progress, typename iterator_type , typename comp_type >
void tpie::parallel_sort ( iterator_type  a,
iterator_type  b,
typename tpie::progress_types< Progress >::base &  pi,
comp_type  comp = std::less<typename boost::iterator_value<iterator_type>::type>() 
)

Sort items in the range [a,b) using a parallel quick sort.

Parameters
aIterator to left boundary.
bIterator to right boundary.
piProgress tracker. No thread-safety required.
compComparator.
See also
parallel_sort_impl

Definition at line 294 of file parallel_sort.h.

References tpie::progress_indicator_base::done(), tpie::progress_indicator_base::init(), and sort().

297  {
298 #ifdef TPIE_PARALLEL_SORT
299  parallel_sort_impl<iterator_type, comp_type, Progress> s(&pi);
300  s(a,b,comp);
301 #else
302  pi.init(1);
303  std::sort(a,b,comp);
304  pi.done();
305 #endif
306 }
void sort(uncompressed_stream< T > &instream, uncompressed_stream< T > &outstream, Compare comp, progress_indicator_base &indicator)
Sort elements of a stream using the given STL-style comparator object.
Definition: sort.h:141
template<typename iterator_type , typename comp_type >
void tpie::parallel_sort ( iterator_type  a,
iterator_type  b,
comp_type  comp = std::less<typename boost::iterator_value<iterator_type>::type>() 
)

Sort items in the range [a,b) using a parallel quick sort.

Parameters
aIterator to left boundary.
bIterator to right boundary.
compComparator.
See also
parallel_sort_impl

Definition at line 316 of file parallel_sort.h.

References sort().

318  {
319 #ifdef TPIE_PARALLEL_SORT
320  parallel_sort_impl<iterator_type, comp_type, false> s(0);
321  s(a,b,comp);
322 #else
323  std::sort(a, b, comp);
324 #endif
325 }
void sort(uncompressed_stream< T > &instream, uncompressed_stream< T > &outstream, Compare comp, progress_indicator_base &indicator)
Sort elements of a stream using the given STL-style comparator object.
Definition: sort.h:141
template<typename T , typename C >
void tpie::pop_and_push_heap ( a,
b,
lt 
)

Restore heap invariants after the first element has been replaced by some other element.

Definition at line 119 of file util.h.

Referenced by tpie::internal_priority_queue< tpie::ami::heap_ptr< REC >, comp >::pop_and_push(), and pop_and_push_heap().

119  {
120  size_t i=0;
121  size_t n=(b-a);
122  while (true) {
123  size_t c=2*i+1;
124  if (c+1 >= n) {
125  if (c < n && lt(*(a+i), *(a+c)))
126  std::swap(*(a+c), *(a+i));
127  break;
128  }
129  if (lt(*(a+c+1), *(a+c))) {
130  if (lt(*(a+i), *(a+c))) {
131  std::swap(*(a+c), *(a+i));
132  i=c;
133  } else break;
134  } else {
135  if (lt(*(a+i), *(a+c+1))) {
136  std::swap(*(a+c+1), *(a+i));
137  i=c+1;
138  } else break;
139  }
140  }
141 }
template<typename T >
void tpie::pop_and_push_heap ( a,
b 
)

Restore heap invariants after the first element has been replaced by some other element.

Uses std::less as the heap property.

Definition at line 148 of file util.h.

References pop_and_push_heap().

148  {
149  pop_and_push_heap(a,b, std::less<typename T::value_type>());
150 }
void pop_and_push_heap(T a, T b)
Restore heap invariants after the first element has been replaced by some other element.
Definition: util.h:148
hash_type tpie::prime_hash ( const std::string &  s)

Calculate a fairly good string hash based on prime numbers.

Parameters
sThe string to hash.
Returns
The hash value.
template<typename D , typename T >
D tpie::ptr_cast ( T *  t)
inline

Cast between pointer types.

If the input pointer is polymorphic, its base address is found, and that is then casted to the output type.

Template Parameters
DA non-polymorphic pointer type.
TAny type.

Definition at line 182 of file memory.h.

Referenced by tpie_delete().

182 { return reinterpret_cast<D>(__object_addr<T>()(t)); }
template<typename D >
void tpie::serialize ( D &  dst,
const foo &  v 
)

Sample tpie::serialize prototype.

To enable serialization of your own type, overload tpie::serialize. This docstring is an example for a type named foo, but it is for exposition purposes only.

The implementation of tpie::serialize(dst, v) shall call dst.write(src, n) a number of times. Each time, src is a const pointer to a byte buffer of size n (bytes) that represents a piece of the serialized object.

A common idiom for polymorphic and/or variable-sized objects is to first serialize a constant-size tag or length and then serialize the variably sized payload. For this purpose, you may want to use tpie::serialize(dst, a, b) to serialize all elements in the range [a, b).

Referenced by tpie::serialization_writer::serialize(), serialize(), tpie::serialization_reverse_writer::serialize(), and serialized_size().

template<typename D , typename T >
void tpie::serialize ( D &  dst,
const T &  v,
typename std::enable_if< is_trivially_serializable< T >::value >::type *  = 0 
)

tpie::serialize for POD/array types.

Definition at line 104 of file serialization2.h.

105  {
106  dst.write((const char *)&v, sizeof(T));
107 }
template<typename D , typename T >
void tpie::serialize ( D &  dst,
start,
end 
)

Serialize an array of serializables.

This uses direct memory copying for POD typed arrays, and tpie::serialize for proper objects.

Definition at line 192 of file serialization2.h.

192  {
193  bits::array_encode_magic<D, T> magic;
194  magic(dst, start, end);
195 }
template<typename D , typename T , std::size_t size>
void tpie::serialize ( D &  dst,
const T(&)  x[size] 
)

tpie::serialize for fixed-length C-style arrays of serializable items.

Definition at line 213 of file serialization2.h.

References serialize().

213  {
214  using tpie::serialize;
215  serialize(dst, x, &x[size]);
216 }
void serialize(D &dst, const std::basic_string< T > &v)
tpie::serialize for std::basic_strings of serializable items, including std::strings.
void serialize(D &dst, const foo &v)
Sample tpie::serialize prototype.
template<typename D , typename T , std::size_t size>
void tpie::serialize ( D &  dst,
const std::array< T, size > &  v 
)

tpie::serialize for std::arrays of serializable items.

Definition at line 231 of file serialization2.h.

References serialize().

231  {
232  using tpie::serialize;
233  serialize(dst, v.begin(), v.end());
234 }
void serialize(D &dst, const std::basic_string< T > &v)
tpie::serialize for std::basic_strings of serializable items, including std::strings.
void serialize(D &dst, const foo &v)
Sample tpie::serialize prototype.
template<typename D , typename T , typename alloc_t >
void tpie::serialize ( D &  dst,
const std::vector< T, alloc_t > &  v 
)

tpie::serialize for std::vectors of serializable items.

Definition at line 249 of file serialization2.h.

References serialize().

249  {
250  using tpie::serialize;
251  serialize(dst, v.size());
252  serialize(dst, v.begin(), v.end());
253 }
void serialize(D &dst, const std::basic_string< T > &v)
tpie::serialize for std::basic_strings of serializable items, including std::strings.
void serialize(D &dst, const foo &v)
Sample tpie::serialize prototype.
template<typename D , typename T >
void tpie::serialize ( D &  dst,
const std::basic_string< T > &  v 
)

tpie::serialize for std::basic_strings of serializable items, including std::strings.

Definition at line 272 of file serialization2.h.

References serialize().

272  {
273  using tpie::serialize;
274  serialize(dst, v.size());
275  serialize(dst, v.c_str(), v.c_str() + v.size());
276 }
void serialize(D &dst, const std::basic_string< T > &v)
tpie::serialize for std::basic_strings of serializable items, including std::strings.
void serialize(D &dst, const foo &v)
Sample tpie::serialize prototype.
template<typename T >
size_t tpie::serialized_size ( const T &  v)

Given a serializable, serialize it and measure its serialized size.

Definition at line 295 of file serialization2.h.

References serialize().

Referenced by tpie::bbits::builder< T, O >::push().

295  {
296  using tpie::serialize;
297  bits::counter c;
298  serialize(c, v);
299  return c.size;
300 }
void serialize(D &dst, const std::basic_string< T > &v)
tpie::serialize for std::basic_strings of serializable items, including std::strings.
void serialize(D &dst, const foo &v)
Sample tpie::serialize prototype.
void tpie::set_block_size ( memory_size_type  block_size)

Set the TPIE block size.

It is not safe to change the block size when any streams are open.

template<typename T , typename Compare >
void tpie::sort ( uncompressed_stream< T > &  instream,
uncompressed_stream< T > &  outstream,
Compare  comp,
progress_indicator_base &  indicator 
)

Sort elements of a stream using the given STL-style comparator object.

Definition at line 141 of file sort.h.

Referenced by tpie::parallel_sort_impl< iterator_type, comp_type, Progress, min_size >::qsort_job::operator()(), tpie::parallel_sort_impl< iterator_type, comp_type, Progress, min_size >::operator()(), parallel_sort(), tpie::sort_manager< T, I, M >::sort(), and sort().

142  {
143  bits::generic_sort<uncompressed_stream<T>, T, Compare>(instream, outstream, &comp, &indicator);
144 }
template<typename T >
void tpie::sort ( uncompressed_stream< T > &  instream,
uncompressed_stream< T > &  outstream,
tpie::progress_indicator_base indicator = NULL 
)

Sort elements of a stream using the less-than operator.

Definition at line 150 of file sort.h.

References sort().

151  {
152  std::less<T> comp;
153  sort(instream, outstream, comp, indicator);
154 }
void sort(uncompressed_stream< T > &instream)
Sort elements of a stream in-place using the less-than operator and no progress indicator.
Definition: sort.h:215
template<typename T >
void tpie::sort ( file_stream< T > &  instream,
file_stream< T > &  outstream,
tpie::progress_indicator_base indicator = NULL 
)

Sort elements of a stream using the less-than operator.

Definition at line 160 of file sort.h.

161  {
162  std::less<T> comp;
163  bits::generic_sort<file_stream<T>, T>(instream, outstream, comp, indicator);
164 }
template<typename T , typename Compare >
void tpie::sort ( uncompressed_stream< T > &  instream,
Compare  comp,
progress_indicator_base &  indicator 
)

Sort elements of a stream in-place using the given STL-style comparator object.

Definition at line 179 of file sort.h.

References sort().

180  {
181  sort(instream, instream, comp, &indicator);
182 }
void sort(uncompressed_stream< T > &instream)
Sort elements of a stream in-place using the less-than operator and no progress indicator.
Definition: sort.h:215
template<typename T , typename Compare >
void tpie::sort ( file_stream< T > &  instream,
Compare  comp,
progress_indicator_base &  indicator 
)

Sort elements of a stream in-place using the given STL-style comparator object.

Definition at line 189 of file sort.h.

190  {
191  bits::generic_sort<file_stream<T>, T>(instream, comp, &indicator);
192 }
template<typename T >
void tpie::sort ( uncompressed_stream< T > &  instream,
progress_indicator_base &  indicator 
)

Sort elements of a stream in-place using the less-than operator.

Definition at line 198 of file sort.h.

References sort().

199  {
200  sort(instream, instream, &indicator);
201 }
void sort(uncompressed_stream< T > &instream)
Sort elements of a stream in-place using the less-than operator and no progress indicator.
Definition: sort.h:215
template<typename T >
void tpie::sort ( uncompressed_stream< T > &  instream)

Sort elements of a stream in-place using the less-than operator and no progress indicator.

Definition at line 215 of file sort.h.

References sort().

215  {
216  sort(instream, instream);
217 }
void sort(uncompressed_stream< T > &instream)
Sort elements of a stream in-place using the less-than operator and no progress indicator.
Definition: sort.h:215
stream_buffer_pool& tpie::the_stream_buffer_pool ( )

Get the stream buffer pool singleton.

You must have initialized the stream buffer pool with tpie::init beforehand, or you will get a null pointer or an assertion error!

template<typename T >
void tpie::tpie_delete ( T *  p)
throw (
)
inline

Delete an object allocated with tpie_new.

Parameters
pthe object to delete

Definition at line 301 of file memory.h.

References __unregister_pointer(), get_memory_manager(), and ptr_cast().

Referenced by tpie::pipelining::bits::internal_buffer_pull_output_t< T >::end(), tpie::pipelining::bits::internal_reverser_output_t< dest_t >::end(), and tpie::pipelining::bits::internal_reverser_pull_output_t< T >::end().

301  {
302  if (p == 0) return;
303  get_memory_manager().register_deallocation(tpie_size(p));
304  uint8_t * pp = ptr_cast<uint8_t *>(p);
305  __unregister_pointer(pp, tpie_size(p), typeid(*p));
306  p->~T();
307  if(!std::is_polymorphic<T>::value)
308  delete[] pp;
309  else
310  delete[] (pp - sizeof(size_t));
311 }
void __unregister_pointer(void *p, size_t size, const std::type_info &t)
Definition: memory.h:131
memory_manager & get_memory_manager()
Return a reference to the memory manager.
D ptr_cast(T *t)
Cast between pointer types.
Definition: memory.h:182
template<typename T >
void tpie::tpie_delete_array ( T *  a,
size_t  size 
)
throw (
)
inline

Delete an array allocated with tpie_new_array.

Parameters
aThe array to delete.
sizeThe size of the array in elements as passed to tpie_new_array.

Definition at line 319 of file memory.h.

References __unregister_pointer(), and get_memory_manager().

Referenced by tpie::file_stream_base::close(), and tpie::packed_array< T, B >::resize().

319  {
320  if (a == 0) return;
321  get_memory_manager().register_deallocation(sizeof(T) * size);
322  __unregister_pointer(a, sizeof(T) * size, typeid(T) );
323  delete[] a;
324 }
void __unregister_pointer(void *p, size_t size, const std::type_info &t)
Definition: memory.h:131
memory_manager & get_memory_manager()
Return a reference to the memory manager.
void tpie::tpie_finish ( flags< subsystem >  subsystems = ALL)

Deinitialize the given subsystems of TPIE.

You MUST pass the same bitmask of subsystems to tpie_finish as you did to tpie_init.

Parameters
subsystemsLogical OR of subsystem entries.
void tpie::tpie_init ( flags< subsystem >  subsystems = ALL)

Initialize the given subsystems of TPIE.

Parameters
subsystemsLogical OR of subsystem entries.
template<typename T , typename... Args>
T* tpie::tpie_new ( Args &&...  args)
inline

Allocate an element of the type given as template parameter, and register its memory usage with TPIE.

The implementation of tpie_new either uses variadic templates (if supported by the compiler) or a bunch of tpie_new overloads to support a variable number of constructor parameters.

Template Parameters
TThe type of element to allocate
ArgsThe variadic number of types of constructor parameters.
Parameters
argsThe variadic number of arguments to pass to the constructor of T.

Definition at line 290 of file memory.h.

290  {
291  allocation_scope_magic<T> m;
292  new(m.allocate()) T(std::forward<Args>(args)...);
293  return m.finalize();
294 }
template<typename T >
T* tpie::tpie_new_array ( size_t  size)
inline

Allocate a new array and register its memory usage.

Parameters
sizeThe number of elements in the new array.
Returns
The new array.

Definition at line 270 of file memory.h.

270  {
271  array_allocation_scope_magic<T> m(size);
272  m.allocate();
273  return m.finalize();
274 }
template<typename S >
void tpie::unserialize ( S &  src,
foo &  v 
)

Sample tpie::unserialize prototype.

To enable unserialization of your own type, overload tpie::unserialize. This docstring is an example for a type named foo, but it is for exposition purposes only.

The implementation of tpie::unserialize(src, v) shall call src.read(dst, n) a number of times. Each time, src is a pointer to a byte buffer that can hold at least n bytes, where n is the number of bytes to be read.

See also tpie::serialize.

Referenced by unserialize(), and tpie::bits::serialization_reader_base::unserialize().

template<typename S , typename T >
void tpie::unserialize ( S &  src,
T &  v,
typename std::enable_if< is_trivially_serializable< T >::value >::type *  = 0 
)

tpie::unserialize for POD/array types.

Definition at line 113 of file serialization2.h.

114  {
115  src.read((char *)&v, sizeof(T));
116 }
template<typename D , typename T >
void tpie::unserialize ( D &  dst,
start,
end 
)

Unserialize an array of serializables.

This uses direct memory copying for POD typed arrays, and tpie::unserialize for proper objects.

Definition at line 204 of file serialization2.h.

204  {
205  bits::array_decode_magic<D, T> magic;
206  magic(dst, start, end);
207 }
template<typename S , typename T , std::size_t size>
void tpie::unserialize ( S &  src,
T(&)  x[size] 
)

tpie::unserialize for fixed-length C-style arrays unserializable items.

Definition at line 222 of file serialization2.h.

References unserialize().

222  {
223  using tpie::unserialize;
224  unserialize(src, x, &x[size]);
225 }
void unserialize(S &src, foo &v)
Sample tpie::unserialize prototype.
void unserialize(S &src, std::basic_string< T > &v)
tpie::unserialize for std::basic_strings of unserializable items, including std::strings.
template<typename S , typename T , std::size_t size>
void tpie::unserialize ( S &  src,
std::array< T, size > &  v 
)

tpie::unserialize for std::arrays of unserializable items.

Definition at line 240 of file serialization2.h.

References unserialize().

240  {
241  using tpie::unserialize;
242  unserialize(src, v.begin(), v.end());
243 }
void unserialize(S &src, foo &v)
Sample tpie::unserialize prototype.
void unserialize(S &src, std::basic_string< T > &v)
tpie::unserialize for std::basic_strings of unserializable items, including std::strings.
template<typename S , typename T , typename alloc_t >
void tpie::unserialize ( S &  src,
std::vector< T, alloc_t > &  v 
)

tpie::unserialize for std::vectors of unserializable items.

Definition at line 259 of file serialization2.h.

References unserialize().

259  {
260  typename std::vector<T>::size_type s;
261  using tpie::unserialize;
262  unserialize(src, s);
263  v.resize(s);
264  unserialize(src, v.begin(), v.end());
265 }
void unserialize(S &src, foo &v)
Sample tpie::unserialize prototype.
void unserialize(S &src, std::basic_string< T > &v)
tpie::unserialize for std::basic_strings of unserializable items, including std::strings.
template<typename S , typename T >
void tpie::unserialize ( S &  src,
std::basic_string< T > &  v 
)

tpie::unserialize for std::basic_strings of unserializable items, including std::strings.

Definition at line 283 of file serialization2.h.

References unserialize().

283  {
284  typename std::basic_string<T>::size_type s;
285  using tpie::unserialize;
286  unserialize(src, s);
287  v.resize(s);
288  unserialize(src, v.c_str(), v.c_str() + v.size());
289 }
void unserialize(S &src, foo &v)
Sample tpie::unserialize prototype.
void unserialize(S &src, std::basic_string< T > &v)
tpie::unserialize for std::basic_strings of unserializable items, including std::strings.

Variable Documentation

const char* tpie::git_commit

The Git commit hash (40 hexadecimal characters) that TPIE was built from.

Referenced by tpie::sysinfo::commit().

const char* tpie::git_refspec

The Git refspec that TPIE was built from.

Usually of the form "refs/heads/"+branch, for instance "refs/heads/master".

Referenced by tpie::sysinfo::refspec().