TPIE

11a2c2d
tpie Namespace Reference

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
 pipelining/factory_base.h Base class of pipelining factories
 

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...
 
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  flags
 Type safe bitflags over an enumeration T. More...
 
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  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
 
class  job
 
struct  job_manager_exception
 
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...
 
struct  linear_memory_usage
 
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...
 
struct  memory_digest_item
 
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  merge_sorter_base
 
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. The top of the queue is the least element in the specified ordering. More...
 
struct  priority_queue_error
 
class  progress_indicator_arrow
 
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  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
 
class  serialization_reader
 
class  serialization_reverse_reader
 
class  serialization_reverse_writer
 
class  serialization_sorter
 
class  serialization_writer
 
class  shared_spin_lock
 
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
 
struct  type_allocations
 
class  uncompressed_stream
 Simple class acting both as file and a file::stream. More...
 
class  unique_id_type
 
class  unique_spin_lock
 
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_accessordefault_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 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 std::ptrdiff_t memory_offset_type
 
typedef stream_offset_type offset_type
 
typedef std::size_t size_type
 
typedef std::ptrdiff_t ssize_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  btree_flags : uint64_t {
  compress_none = 0x0, compress_lz4 = 0x1, compress_snappy = 0x2, compress_zstd = 0x3,
  compression_mask = 0xFF, compression_level_mask = 0xFF00, compress_level_default = 0x0000, compress_level_1 = 0x0100,
  compress_level_2 = 0x0200, compress_level_3 = 0x0300, compress_level_4 = 0x0400, compress_level_5 = 0x0500,
  compress_level_6 = 0x0600, compress_level_7 = 0x0700, compress_level_8 = 0x0800, compress_level_9 = 0x0900,
  compress_level_10 = 0x0A00, compress_level_11 = 0x0B00, compress_level_12 = 0x0C00, compress_level_13 = 0x0D00,
  compress_level_14 = 0x0E00, compress_level_15 = 0x0F00, compress_level_16 = 0x1000, compress_level_17 = 0x1100,
  compress_level_18 = 0x1200, compress_level_19 = 0x1300, compress_level_20 = 0x1400, compress_level_21 = 0x1500,
  compress_level_22 = 0x1600, compress_default = compress_level_default | compress_lz4, read = 0x010000, write = 0x020000,
  defaults = read | write, defaults_v0 = read | write
}
 
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_PIPE_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, JOB_MANAGER =16,
  CAPTURE_FRACTIONS =32, STREAMS =64, TEMPFILE =256, FILE_MANAGER =512,
  ALL =MEMORY_MANAGER | DEFAULT_LOGGING | PROGRESS | JOB_MANAGER | STREAMS | 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...
 
constexpr btree_flags operator| (btree_flags f1, btree_flags f2)
 
btree_flags & operator|= (btree_flags &f1, btree_flags f2)
 
constexpr btree_flags operator& (btree_flags f1, btree_flags f2)
 
btree_flags & operator&= (btree_flags &f1, btree_flags f2)
 
constexpr btree_flags operator~ (btree_flags f1)
 
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 ()
 
TPIE_EXPORT 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)
 
TPIE_EXPORT 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...
 
TPIE_EXPORT 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...
 
TPIE_EXPORT void update_fractions (const char *name, float frac, stream_size_type n)
 
TPIE_EXPORT void load_fractions (const std::string &path)
 
TPIE_EXPORT void save_fractions (const std::string &path, bool force=false)
 
TPIE_EXPORT 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...
 
TPIE_EXPORT void add_log_target (log_target *t)
 
TPIE_EXPORT void remove_log_target (log_target *t)
 
TPIE_EXPORT void log_to_targets (log_level level, const char *data, size_t size)
 
TPIE_EXPORT void begin_log_group (const std::string &name)
 
TPIE_EXPORT 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...
 
TPIE_EXPORT memory_managerget_memory_manager ()
 Return a reference to the memory manager. 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...
 
TPIE_EXPORT 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...
 
TPIE_EXPORT 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 tpie::array< T > &v)
 tpie::serialize for tpie::arrays of serializable items. More...
 
template<typename S , typename T >
void unserialize (S &src, tpie::array< T > &v)
 tpie::unserialize for tpie::arrays 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 D , typename T , typename U >
void serialize (D &dst, const std::pair< T, U > &v)
 tpie::serialize for std::pairs of serializable items. More...
 
template<typename S , typename T , typename U >
void unserialize (S &src, std::pair< T, U > &v)
 tpie::unserialize for std::pairs of unserializable items. More...
 
template<typename D , typename... Ts>
void serialize (D &dst, const std::tuple< Ts... > &t)
 tpie::serialize for std::tuples of serializable items. More...
 
template<typename S , typename... Ts>
void unserialize (S &src, std::tuple< Ts... > &t)
 tpie::unserialize for std::tuples of unserializable items. 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...
 
TPIE_EXPORT stream_size_type get_temp_file_usage ()
 Return the number of bytes currently being used by temporary files. More...
 
TPIE_EXPORT 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...
 
TPIE_EXPORT stream_size_type get_bytes_read ()
 Return the number of bytes read from disk since program start. More...
 
TPIE_EXPORT stream_size_type get_bytes_written ()
 Return the number of bytes written to disk since program start. More...
 
TPIE_EXPORT void increment_bytes_read (stream_size_type delta)
 Inform that stats module that an additional delta bytes have been read from disk. More...
 
TPIE_EXPORT void increment_bytes_written (stream_size_type delta)
 Inform the stats module that an additional delta bytes have been written to disk. More...
 
TPIE_EXPORT stream_size_type get_user (size_t i)
 
TPIE_EXPORT 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 ()
 
TPIE_EXPORT void tpie_init (flags< subsystem > subsystems=ALL)
 Initialize the given subsystems of TPIE. More...
 
TPIE_EXPORT void tpie_finish (flags< subsystem > subsystems=ALL)
 Deinitialize the given subsystems of TPIE. More...
 
TPIE_EXPORT memory_size_type get_block_size ()
 Get the TPIE block size. More...
 
TPIE_EXPORT 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...
 
logstreamlog_pipe_debug ()
 Return logstream for writing pipe_debug log messages. More...
 
log_bits::log_selector get_log ()
 Returns the only logstream object. More...
 
template<typename F , typename Tuple , size_t I = 0>
std::enable_if_t< I==std::tuple_size< typename std::remove_reference< Tuple >::type >::value > tuple_for_each (F, Tuple &&)
 
template<typename F , typename Tuple , size_t I = 0>
std::enable_if_t< I !=std::tuple_size< typename std::remove_reference< Tuple >::type >::value > tuple_for_each (F f, Tuple &&t)
 Calls a functor on element of a std::tuple in order. 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)
 
TPIE_EXPORT testmanip< bool > result (bool success)
 
TPIE_EXPORT testmanip< bool > success ()
 
TPIE_EXPORT 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...
 
TPIE_EXPORT void atomic_rename (const std::string &src, const std::string &dst)
 atomicly rename a src to dst More...
 
TPIE_EXPORT std::string pretty_print_size (stream_size_type size)
 pretty print a size More...
 
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 TPIE_EXPORT char * git_commit
 The Git commit hash (40 hexadecimal characters) that TPIE was built from. More...
 
const TPIE_EXPORT char * git_refspec
 The Git refspec that TPIE was built from. More...
 
const char directory_delimiter = '/'
 

Detailed Description

TPIE's namespace.

Typedef Documentation

◆ arity_t

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.

◆ bit_array

typedef packed_array<bool, 1> tpie::bit_array

Packed array of bits.

Definition at line 31 of file bit_array.h.

◆ unique_ptr

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 306 of file memory.h.

Enumeration Type Documentation

◆ access_type

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 };

◆ cache_hint

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 };

◆ compression_flags

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 };

◆ log_level

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 
59  LOG_PIPE_DEBUG,
60 
62  LOG_USER1,
63  LOG_USER2,
64  LOG_USER3
65 };

◆ stream_usage

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.

◆ subsystem

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.

JOB_MANAGER 

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

CAPTURE_FRACTIONS 

Capture fractions.

STREAMS 

Enable support for streams.

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 40 of file tpie.h.

40  {
47  PROGRESS=4,
49  JOB_MANAGER=16,
53  STREAMS=64,
55  TEMPFILE=256,
58  FILE_MANAGER=512,
61 };

Function Documentation

◆ __softassert()

void tpie::__softassert ( const char *  expr,
const char *  file,
int  line 
)

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

See also
softassert()

◆ atomic_rename()

TPIE_EXPORT void tpie::atomic_rename ( const std::string &  src,
const std::string &  dst 
)

atomicly rename a src to dst

◆ backtrace()

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.

◆ consecutive_memory_available()

TPIE_EXPORT 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.

◆ default_worker_count()

TPIE_EXPORT 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().

◆ finish_default_log()

void tpie::finish_default_log ( )

Used by tpie_finish to deinitialize the log subsystem.

◆ finish_execution_time_db()

void tpie::finish_execution_time_db ( )

Used by tpie_finish to deinitialize the execution time database.

◆ finish_file_manager()

void tpie::finish_file_manager ( )

Used by tpie_finish to deinitialize the file manager.

◆ finish_fraction_db()

void tpie::finish_fraction_db ( )

Used by tpie_finish to deinitialize the fraction database.

◆ finish_job()

void tpie::finish_job ( )

Used by tpie_finish to deinitialize the job subsystem.

◆ finish_memory_manager()

void tpie::finish_memory_manager ( )

Used by tpie_finish to deinitialize the memory manager.

◆ finish_stream_buffer_pool()

void tpie::finish_stream_buffer_pool ( )

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

◆ free_structure_memory()

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 217 of file util.h.

217  {
218  T t;
219  std::swap(v, t);
220 }

Referenced by tpie::pipelining::bits::chunker_t< dest_t >::end(), and tpie::pipelining::parallel_bits::producer< T1, T2 >::end().

◆ get_block_size()

TPIE_EXPORT 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().

◆ get_bytes_read()

TPIE_EXPORT stream_size_type tpie::get_bytes_read ( )

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

◆ get_bytes_written()

TPIE_EXPORT stream_size_type tpie::get_bytes_written ( )

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

◆ get_file_manager()

TPIE_EXPORT 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()().

◆ get_log()

log_bits::log_selector tpie::get_log ( )
inline

Returns the only logstream object.

Definition at line 263 of file tpie_log.h.

263 {return log_bits::log_selector();}

◆ get_memory_manager()

TPIE_EXPORT 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 tpie::merge_sorter< T, UseProgress, pred_t, store_t >::end(), tpie_delete(), and tpie_delete_array().

◆ get_temp_file_usage()

TPIE_EXPORT stream_size_type tpie::get_temp_file_usage ( )

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

◆ increment_bytes_read()

TPIE_EXPORT void tpie::increment_bytes_read ( stream_size_type  delta)

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

◆ increment_bytes_written()

TPIE_EXPORT void tpie::increment_bytes_written ( stream_size_type  delta)

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

◆ increment_temp_file_usage()

TPIE_EXPORT 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.

◆ init_default_log()

void tpie::init_default_log ( )

Used by tpie_init to initialize the log subsystem.

◆ init_execution_time_db()

void tpie::init_execution_time_db ( )

Used by tpie_init to initialize the execution time database.

◆ init_file_manager()

void tpie::init_file_manager ( )

Used by tpie_init to initialize the file manager.

◆ init_fraction_db()

void tpie::init_fraction_db ( bool  capture_progress = false)

Used by tpie_init to initialize the fraction database.

◆ init_job()

void tpie::init_job ( )

Used by tpie_init to initialize the job subsystem.

◆ init_memory_manager()

void tpie::init_memory_manager ( )

Used by tpie_init to initialize the memory manager.

◆ init_stream_buffer_pool()

void tpie::init_stream_buffer_pool ( )

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

◆ log_app_debug()

logstream& tpie::log_app_debug ( )
inline

Return logstream for writing app_debug log messages.

Definition at line 163 of file tpie_log.h.

163 {return get_log_by_level(LOG_APP_DEBUG);}

References LOG_APP_DEBUG.

◆ log_debug()

logstream& tpie::log_debug ( )
inline

Return logstream for writing debug log messages.

Definition at line 168 of file tpie_log.h.

168 {return get_log_by_level(LOG_DEBUG);}

References LOG_DEBUG.

Referenced by tpie::merge_sorter< T, UseProgress, pred_t, store_t >::end().

◆ log_error()

◆ log_fatal()

logstream& tpie::log_fatal ( )
inline

Return logstream for writing fatal log messages.

Definition at line 143 of file tpie_log.h.

143 {return get_log_by_level(LOG_FATAL);}

References LOG_FATAL.

◆ log_info()

logstream& tpie::log_info ( )
inline

Return logstream for writing info log messages.

Definition at line 153 of file tpie_log.h.

153 {return get_log_by_level(LOG_INFORMATIONAL);}

References LOG_INFORMATIONAL.

◆ log_mem_debug()

logstream& tpie::log_mem_debug ( )
inline

Return logstream for writing mem_debug log messages.

Definition at line 173 of file tpie_log.h.

173 {return get_log_by_level(LOG_MEM_DEBUG);}

References LOG_MEM_DEBUG.

◆ log_name()

const std::string& tpie::log_name ( )

Returns the file name of the log stream.

This assumes that init_default_log has been called.

◆ log_pipe_debug()

logstream& tpie::log_pipe_debug ( )
inline

Return logstream for writing pipe_debug log messages.

Definition at line 178 of file tpie_log.h.

178 {return get_log_by_level(LOG_PIPE_DEBUG);}

Referenced by tpie::merge_sorter< T, UseProgress, pred_t, store_t >::begin().

◆ log_warning()

logstream& tpie::log_warning ( )
inline

Return logstream for writing warning log messages.

Definition at line 158 of file tpie_log.h.

158 {return get_log_by_level(LOG_WARNING);}

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().

◆ make_unique()

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 313 of file memory.h.

313  {
314  return unique_ptr<T>(tpie_new<T>(std::forward<TT>(tt)...));
315 }

◆ operator<<() [1/2]

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 182 of file sysinfo.h.

182  {
183  return s
184  << "Hostname: " << info.hostname() << '\n'
185  << "Platform: " << info.platform() << '\n'
186  << "Git branch: " << info.refspec() << '\n'
187  << "Git commit: " << info.commit() << '\n'
188  << "Local time: " << info.localtime() << '\n'
189  << "Block size: " << info.blocksize() << '\n'
190  << "Parallel sort: "
191 #ifdef TPIE_PARALLEL_SORT
192  << "Enabled"
193 #else
194  << "Disabled"
195 #endif
196  << '\n'
197  << "Snappy: "
198 #ifdef TPIE_HAS_SNAPPY
199  << "Enabled"
200 #else
201  << "Disabled"
202 #endif
203  << '\n'
204  ;
205 }

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

◆ operator<<() [2/2]

TPIE_EXPORT 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.

◆ parallel_sort() [1/2]

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.

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 }

References sort().

◆ parallel_sort() [2/2]

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.

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 }

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

◆ pop_and_push_heap() [1/2]

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 178 of file util.h.

178  {
179  pop_and_push_heap(a,b, std::less<typename T::value_type>());
180 }

References pop_and_push_heap().

◆ pop_and_push_heap() [2/2]

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 149 of file util.h.

149  {
150  size_t i=0;
151  size_t n=(b-a);
152  while (true) {
153  size_t c=2*i+1;
154  if (c+1 >= n) {
155  if (c < n && lt(*(a+i), *(a+c)))
156  std::swap(*(a+c), *(a+i));
157  break;
158  }
159  if (lt(*(a+c+1), *(a+c))) {
160  if (lt(*(a+i), *(a+c))) {
161  std::swap(*(a+c), *(a+i));
162  i=c;
163  } else break;
164  } else {
165  if (lt(*(a+i), *(a+c+1))) {
166  std::swap(*(a+c+1), *(a+i));
167  i=c+1;
168  } else break;
169  }
170  }
171 }

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

◆ pretty_print_size()

TPIE_EXPORT std::string tpie::pretty_print_size ( stream_size_type  size)

pretty print a size

◆ ptr_cast()

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 155 of file memory.h.

155 { return reinterpret_cast<D>(__object_addr<T>()(t)); }

◆ serialize() [1/10]

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().

◆ serialize() [2/10]

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 226 of file serialization2.h.

226  {
227  using tpie::serialize;
228  serialize(dst, v.begin(), v.end());
229 }

References serialize().

◆ serialize() [3/10]

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 289 of file serialization2.h.

289  {
290  using tpie::serialize;
291  serialize(dst, v.size());
292  serialize(dst, v.c_str(), v.c_str() + v.size());
293 }

References serialize().

◆ serialize() [4/10]

template<typename D , typename T , typename U >
void tpie::serialize ( D &  dst,
const std::pair< T, U > &  v 
)

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

Definition at line 312 of file serialization2.h.

312  {
313  using tpie::serialize;
314  serialize(dst, v.first);
315  serialize(dst, v.second);
316 }

References serialize().

◆ serialize() [5/10]

template<typename D , typename... Ts>
void tpie::serialize ( D &  dst,
const std::tuple< Ts... > &  t 
)

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

Definition at line 332 of file serialization2.h.

332  {
333  tuple_for_each([&](const auto & el) {
334  using tpie::serialize;
335  serialize(dst, el);
336  }, t);
337 }

References serialize().

◆ serialize() [6/10]

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 244 of file serialization2.h.

244  {
245  using tpie::serialize;
246  serialize(dst, v.size());
247  serialize(dst, v.begin(), v.end());
248 }

References serialize().

◆ serialize() [7/10]

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 99 of file serialization2.h.

100  {
101  dst.write((const char *)&v, sizeof(T));
102 }

◆ serialize() [8/10]

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 208 of file serialization2.h.

208  {
209  using tpie::serialize;
210  serialize(dst, x, &x[size]);
211 }

References serialize().

◆ serialize() [9/10]

template<typename D , typename T >
void tpie::serialize ( D &  dst,
const tpie::array< T > &  v 
)

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

Definition at line 266 of file serialization2.h.

266  {
267  using tpie::serialize;
268  serialize(dst, v.size());
269  serialize(dst, v.begin(), v.end());
270 }

References tpie::array< T, Allocator >::begin(), tpie::array< T, Allocator >::end(), serialize(), and tpie::array< T, Allocator >::size().

◆ serialize() [10/10]

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 187 of file serialization2.h.

187  {
188  bits::array_encode_magic<D, T> magic;
189  magic(dst, start, end);
190 }

◆ serialized_size()

template<typename T >
size_t tpie::serialized_size ( const T &  v)

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

Definition at line 354 of file serialization2.h.

354  {
355  using tpie::serialize;
356  bits::counter c;
357  serialize(c, v);
358  return c.size;
359 }

References serialize().

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

◆ set_block_size()

TPIE_EXPORT 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.

◆ sort() [1/7]

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 }

◆ sort() [2/7]

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 }

◆ sort() [3/7]

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.

215  {
216  sort(instream, instream);
217 }

References sort().

◆ sort() [4/7]

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.

180  {
181  sort(instream, instream, comp, &indicator);
182 }

References sort().

◆ sort() [5/7]

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.

199  {
200  sort(instream, instream, &indicator);
201 }

References sort().

◆ sort() [6/7]

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.

142  {
143  bits::generic_sort<uncompressed_stream<T>, T, Compare>(instream, outstream, &comp, &indicator);
144 }

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().

◆ sort() [7/7]

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.

151  {
152  std::less<T> comp;
153  sort(instream, outstream, comp, indicator);
154 }

References sort().

◆ the_stream_buffer_pool()

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!

◆ tpie_delete()

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 271 of file memory.h.

271  {
272  if (p == 0) return;
273  get_memory_manager().register_deallocation(tpie_size(p), typeid(*p));
274  uint8_t * pp = ptr_cast<uint8_t *>(p);
275  p->~T();
276  if(!std::is_polymorphic<T>::value)
277  delete[] pp;
278  else
279  delete[] (pp - sizeof(size_t));
280 }

References get_memory_manager().

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().

◆ tpie_delete_array()

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 288 of file memory.h.

288  {
289  if (a == 0) return;
290  get_memory_manager().register_deallocation(sizeof(T) * size, typeid(T));
291  delete[] a;
292 }

References get_memory_manager().

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

◆ tpie_finish()

TPIE_EXPORT 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.

◆ tpie_init()

TPIE_EXPORT void tpie::tpie_init ( flags< subsystem subsystems = ALL)

Initialize the given subsystems of TPIE.

Parameters
subsystemsLogical OR of subsystem entries.

◆ tpie_new()

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 260 of file memory.h.

260  {
261  allocation_scope_magic<T> m;
262  new(m.allocate()) T(std::forward<Args>(args)...);
263  return m.finalize();
264 }

◆ tpie_new_array()

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 240 of file memory.h.

240  {
241  array_allocation_scope_magic<T> m(size);
242  m.allocate();
243  return m.finalize();
244 }

◆ tuple_for_each()

template<typename F , typename Tuple , size_t I = 0>
std::enable_if_t<I != std::tuple_size<typename std::remove_reference<Tuple>::type>::value> tpie::tuple_for_each ( f,
Tuple &&  t 
)

Calls a functor on element of a std::tuple in order.

Parameters
fThe functor that should be called
tThe tuple

Definition at line 36 of file tuple_utils.h.

36  {
37  f(std::get<I>(t));
38  tuple_for_each<F, Tuple, I + 1>(f, t);
39 }

◆ unserialize() [1/10]

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 199 of file serialization2.h.

199  {
200  bits::array_decode_magic<D, T> magic;
201  magic(dst, start, end);
202 }

◆ unserialize() [2/10]

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().

◆ unserialize() [3/10]

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 235 of file serialization2.h.

235  {
236  using tpie::unserialize;
237  unserialize(src, v.begin(), v.end());
238 }

References unserialize().

◆ unserialize() [4/10]

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 300 of file serialization2.h.

300  {
301  typename std::basic_string<T>::size_type s;
302  using tpie::unserialize;
303  unserialize(src, s);
304  v.resize(s);
305  unserialize(src, v.c_str(), v.c_str() + v.size());
306 }

◆ unserialize() [5/10]

template<typename S , typename T , typename U >
void tpie::unserialize ( S &  src,
std::pair< T, U > &  v 
)

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

Definition at line 322 of file serialization2.h.

322  {
323  using tpie::unserialize;
324  unserialize(src, v.first);
325  unserialize(src, v.second);
326 }

References unserialize().

◆ unserialize() [6/10]

template<typename S , typename... Ts>
void tpie::unserialize ( S &  src,
std::tuple< Ts... > &  t 
)

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

Definition at line 343 of file serialization2.h.

343  {
344  tuple_for_each([&](auto & el) {
345  using tpie::unserialize;
346  unserialize(src, el);
347  }, t);
348 }

References unserialize().

◆ unserialize() [7/10]

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 254 of file serialization2.h.

254  {
255  typename std::vector<T>::size_type s;
256  using tpie::unserialize;
257  unserialize(src, s);
258  v.resize(s);
259  unserialize(src, v.begin(), v.end());
260 }

◆ unserialize() [8/10]

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 108 of file serialization2.h.

109  {
110  src.read((char *)&v, sizeof(T));
111 }

◆ unserialize() [9/10]

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 217 of file serialization2.h.

217  {
218  using tpie::unserialize;
219  unserialize(src, x, &x[size]);
220 }

References unserialize().

◆ unserialize() [10/10]

template<typename S , typename T >
void tpie::unserialize ( S &  src,
tpie::array< T > &  v 
)

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

Definition at line 276 of file serialization2.h.

276  {
277  size_type s;
278  using tpie::unserialize;
279  unserialize(src, s);
280  v.resize(s);
281  unserialize(src, v.begin(), v.end());
282 }

References tpie::array< T, Allocator >::begin(), tpie::array< T, Allocator >::end(), tpie::array< T, Allocator >::resize(), and unserialize().

◆ unused()

template<typename T >
void tpie::unused ( const T &  x)
inline

Variable Documentation

◆ git_commit

const TPIE_EXPORT char* tpie::git_commit

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

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

◆ git_refspec

const TPIE_EXPORT 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().

tpie::access_write
@ access_write
Open a file for writing only, content is truncated.
Definition: access_type.h:33
tpie::ALL
@ ALL
Alias for all default subsystems.
Definition: tpie.h:60
tpie::sort
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
tpie::LOG_USER1
@ LOG_USER1
Logging levels to be further defined by user applications.
Definition: loglevel.h:62
tpie::get_memory_manager
TPIE_EXPORT memory_manager & get_memory_manager()
Return a reference to the memory manager.
tpie::FILE_MANAGER
@ FILE_MANAGER
Needed for working with files and implicitly by all TPIE algorithm and data structure implementations...
Definition: tpie.h:58
tpie::pop_and_push_heap
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:178
tpie::LOG_INFORMATIONAL
@ LOG_INFORMATIONAL
LOG_INFORMATIONAL is used for informational messagse.
Definition: loglevel.h:46
tpie::STREAM_USAGE_CURRENT
@ STREAM_USAGE_CURRENT
Amount currently in use.
Definition: stream_usage.h:34
tpie::LOG_FATAL
@ 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
tpie::serialize
void serialize(D &dst, const std::tuple< Ts... > &t)
tpie::serialize for std::tuples of serializable items.
Definition: serialization2.h:332
tpie::array::begin
iterator begin()
Return an iterator to the beginning of the array.
Definition: array.h:312
tpie::LOG_APP_DEBUG
@ LOG_APP_DEBUG
LOG_APP_DEBUG can be used by applications built on top of TPIE, for logging debugging information.
Definition: loglevel.h:50
tpie::PROGRESS
@ PROGRESS
Progress tracking.
Definition: tpie.h:47
tpie::DEFAULT_LOGGING
@ DEFAULT_LOGGING
TPIE logging framework.
Definition: tpie.h:45
tpie::access_random
@ access_random
Random access is intended.
Definition: cache_hint.h:40
tpie::TEMPFILE
@ TEMPFILE
Generate temporary files.
Definition: tpie.h:55
tpie::STREAM_USAGE_BUFFER
@ STREAM_USAGE_BUFFER
Max amount ever used by a buffer.
Definition: stream_usage.h:32
tpie::STREAMS
@ STREAMS
Enable support for streams.
Definition: tpie.h:53
tpie::unserialize
void unserialize(S &src, foo &v)
Sample tpie::unserialize prototype.
tpie::compression_normal
@ compression_normal
Compress some blocks according to available resources (time, memory).
Definition: scheme.h:40
tpie::serialize
void serialize(D &dst, const foo &v)
Sample tpie::serialize prototype.
tpie::sort
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
tpie::LOG_DEBUG
@ LOG_DEBUG
LOG_DEBUG is the lowest level and is used by the TPIE library for logging debugging information.
Definition: loglevel.h:54
tpie::array::end
iterator end()
Return an iterator to the end of the array.
Definition: array.h:326
tpie::access_normal
@ access_normal
Neither sequential access nor random access is intended.
Definition: cache_hint.h:31
tpie::LOG_ERROR
@ LOG_ERROR
LOG_ERROR is used for none fatal errors.
Definition: loglevel.h:40
tpie::MEMORY_MANAGER
@ MEMORY_MANAGER
Needed for tpie_new and tpie_delete and implicitly needed by all TPIE algorithm and data structure im...
Definition: tpie.h:43
tpie::compression_all
@ compression_all
Compress all blocks according to the preferred compression scheme which can be set using tpie::the_co...
Definition: scheme.h:44
tpie::CAPTURE_FRACTIONS
@ CAPTURE_FRACTIONS
Capture fractions.
Definition: tpie.h:51
tpie::access_sequential
@ access_sequential
Sequential access is intended.
Definition: cache_hint.h:36
tpie::compression_none
@ compression_none
No written blocks should be compressed.
Definition: scheme.h:37
tpie::array::resize
void resize(size_t size, const T &elm)
Change the size of the array.
Definition: array.h:490
tpie::LOG_WARNING
@ LOG_WARNING
LOG_WARNING is used for warnings.
Definition: loglevel.h:43
tpie::STREAM_USAGE_MAXIMUM
@ STREAM_USAGE_MAXIMUM
Max amount that will ever be used.
Definition: stream_usage.h:36
std::swap
void swap(tpie::uncompressed_stream< T > &a, tpie::uncompressed_stream< T > &b)
Enable std::swapping two tpie::file_streams.
Definition: uncompressed_stream.h:182
tpie::LOG_MEM_DEBUG
@ LOG_MEM_DEBUG
Logging level for warnings concerning memory allocation and deallocation.
Definition: loglevel.h:57
tpie::STREAM_USAGE_SUBSTREAM
@ STREAM_USAGE_SUBSTREAM
Maximum additional amount used by each substream created.
Definition: stream_usage.h:38
tpie::STREAM_USAGE_OVERHEAD
@ STREAM_USAGE_OVERHEAD
Overhead of the object without the buffer.
Definition: stream_usage.h:30
tpie::access_read_write
@ access_read_write
Open a file for reading or writing.
Definition: access_type.h:35
tpie::JOB_MANAGER
@ JOB_MANAGER
Job manager, for job.h and the parallel quick sort.
Definition: tpie.h:49
tpie::array::size
size_type size() const
Return the size of the array.
Definition: array.h:531
tpie::access_read
@ access_read
Open a file for reading.
Definition: access_type.h:31
tpie::unserialize
void unserialize(S &src, std::tuple< Ts... > &t)
tpie::unserialize for std::tuples of unserializable items.
Definition: serialization2.h:343