TPIE

v1.1rc1-6-g0c97303
tpie Namespace Reference

TPIE's namespace. More...

Namespaces

 ami
 The namespace within TPIE for the Access Method Interface elements.
 
 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...
 
class  auto_ptr
 like std::auto_ptr, but delete the object with tpie_delete. More...
 
struct  auto_ptr_ref
 
struct  binary_argument_swap
 A binary functor with the arguments swapped. More...
 
class  chaining_hash_table
 Hash table handling hash collisions by chaining. More...
 
class  cpu_timer
 
struct  default_unused
 
struct  default_unused< std::pair< T1, T2 > >
 
class  disjoint_sets
 Internal memory union find implementation. More...
 
struct  disjunction
 Class to compute the disjunction between two boost true/false types. 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  end_of_stream_exception
 
struct  exception
 
class  execution_time_predictor
 
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_stream
 Simple class acting both as file and a file::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 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...
 
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_trivially_serializable
 
struct  is_trivially_serializable_enable_if
 
struct  is_trivially_serializable_enable_if< true >
 
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...
 
class  linear_probing_hash_table
 Hash table handling hash collisions by linear probing. More...
 
class  log_stream_buf
 
struct  log_target
 
class  logmanip
 The logmanip template is based on the omanip template from iomanip.h in the libg++ sources. More...
 
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  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
 
class  op2TPIE_cmp
 Convert a class with a comparison operator < to a TPIE comparison object with a compare() function. More...
 
struct  out_of_memory_error
 Thrown when trying to allocate too much memory. 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...
 
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  queue
 Basic Implementation of I/O Efficient FIFO queue. More...
 
class  scoped_log_enabler
 
struct  serialization_error
 
class  serialization_reader
 
class  serialization_reverse_reader
 
class  serialization_reverse_writer
 
class  serialization_sort
 
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  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_crtp
 
struct  stream_exception
 
struct  stream_header_t
 
struct  sysinfo
 Class providing system and platform info. More...
 
class  temp_file
 Class representing the existence of 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  trivial_same_size
 
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 >
 

Typedefs

typedef packed_array< bool, 1 > bit_array
 Packed array of bits. More...
 
typedef boost::uint64_t time_type
 
typedef
file_accessor::raw_file_accessor 
default_raw_file_accessor
 
typedef
file_accessor::file_accessor 
default_file_accessor
 
typedef int merge_flag
 Intended to signal in a merge which of the input streams are non-empty. More...
 
typedef TPIE_OS_SIZE_T arity_t
 Intended to signal the number of input streams in a merge. More...
 
typedef boost::uint64_t hash_type
 
typedef boost::uint64_t stream_size_type
 
typedef boost::int64_t stream_offset_type
 
typedef ::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
 

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  log_level {
  LOG_FATAL = 0, LOG_ERROR, LOG_WARNING, LOG_INFORMATIONAL,
  LOG_APP_DEBUG, LOG_DEBUG, LOG_MEM_DEBUG
}
 TPIE logging levels, from higest priority to lowest. More...
 
enum  description_importance { IMPORTANCE_NONE, IMPORTANCE_LOG, IMPORTANCE_MINOR, IMPORTANCE_MAJOR }
 
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, ALL =MEMORY_MANAGER | DEFAULT_LOGGING | PROGRESS | PRIMEDB | JOB_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
boost::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...
 
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...
 
 TPIE_DEPRECATED (inline void increment_open_file_count())
 Deprecated; does nothing. More...
 
memory_size_type open_file_count ()
 Return the current number of open files. More...
 
memory_size_type available_files ()
 Return the additional number of files that can be opened before running out of file descriptors. 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)
 
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...
 
logstreammanip_level (logstream &tpl, log_level p)
 
logmanip< log_levelsetlevel (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 >
bool operator== (const tpie::allocator< T > &, const tpie::allocator< T > &)
 
template<typename T >
bool operator!= (const tpie::allocator< T > &, const tpie::allocator< T > &)
 
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 >
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 boost::enable_if< is_trivially_serializable< T > >::type *=0, typename boost::disable_if< boost::is_pointer< T > >::type *=0)
 tpie::serialize for POD/array types. More...
 
template<typename S , typename T >
void unserialize (S &src, T &v, typename boost::enable_if< is_trivially_serializable< T > >::type *=0, typename boost::disable_if< boost::is_pointer< T > >::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 , 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 (file_stream< T > &instream, file_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 (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 (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 (file_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)
 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...
 
std::ostream & operator<< (std::ostream &s, const sysinfo &info)
 Report default system info to the specified ostream. More...
 
void tpie_init (int subsystems=ALL)
 Initialize the given subsystems of TPIE. More...
 
void tpie_finish (int 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 ()
 Returns the only logstream object. More...
 
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...
 
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...
 
logstream log_singleton
 
const char directory_delimiter = '/'
 

Detailed Description

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 59 of file merge.h.

typedef packed_array<bool, 1> tpie::bit_array

Packed array of bits.

Definition at line 31 of file bit_array.h.

typedef int tpie::merge_flag

Intended to signal in a merge which of the input streams are non-empty.

Definition at line 57 of file merge.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

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.

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

ALL 

Alias for all default subsystems.

Definition at line 38 of file tpie.h.

38  {
45  PROGRESS=4,
47  PRIMEDB=8,
49  JOB_MANAGER=16,
54 };
Needed for tpie_new and tpie_delete and implicitly needed by all TPIE algorithm and data structure im...
Definition: tpie.h:41
Alias for all default subsystems.
Definition: tpie.h:53
Prime number database, for prime.h.
Definition: tpie.h:47
Capture fractions.
Definition: tpie.h:51
Job manager, for job.h and the parallel quick sort.
Definition: tpie.h:49
TPIE logging framework.
Definition: tpie.h:43
Progress tracking.
Definition: tpie.h:45

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

References get_memory_manager(), and unused().

187  {
188 #ifndef TPIE_NDEBUG
189  get_memory_manager().register_pointer(p, size, t);
190 #else
191  unused(p);
192  unused(size);
193  unused(t);
194 #endif
195 }
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 201 of file memory.h.

References get_memory_manager(), and unused().

Referenced by tpie_delete(), and tpie_delete_array().

201  {
202 #ifndef TPIE_NDEBUG
203  get_memory_manager().unregister_pointer(p, size, t);
204 #else
205  unused(p);
206  unused(size);
207  unused(t);
208 #endif
209 }
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 215 of file memory.h.

References get_memory_manager(), and unused().

215  {
216 #ifndef TPIE_NDEBUG
217  if (p)
218  get_memory_manager().assert_tpie_ptr(p);
219 #else
220  unused(p);
221 #endif
222 }
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.
memory_size_type tpie::available_files ( )

Return the additional number of files that can be opened before running out of file descriptors.

Referenced by tpie::ami::stream< T >::available_streams().

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.

Referenced by tpie::ami::main_mem_merge(), tpie::ami::merge(), and tpie::ami::partition_and_merge().

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

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

177  {
178  T t;
179  std::swap(v, t);
180 }
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.

logstream& tpie::get_log ( )
inline

Returns the only logstream object.

Definition at line 94 of file tpie_log.h.

Referenced by log_app_debug(), log_debug(), log_error(), log_fatal(), log_info(), log_mem_debug(), and log_warning().

94 {return log_singleton;}
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 >::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.

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

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

logstream& tpie::log_app_debug ( )
inline

Return logstream for writing app_debug log messages.

Definition at line 119 of file tpie_log.h.

References get_log(), and LOG_APP_DEBUG.

119 {return get_log() << setlevel(LOG_APP_DEBUG);}
logstream & get_log()
Returns the only logstream object.
Definition: tpie_log.h:94
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 124 of file tpie_log.h.

References get_log(), and LOG_DEBUG.

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

124 {return get_log() << setlevel(LOG_DEBUG);}
logstream & get_log()
Returns the only logstream object.
Definition: tpie_log.h:94
LOG_DEBUG is the lowest level and is used by the TPIE library for logging debugging information...
Definition: loglevel.h:54
logstream& tpie::log_error ( )
inline
logstream& tpie::log_fatal ( )
inline

Return logstream for writing fatal log messages.

Definition at line 99 of file tpie_log.h.

References get_log(), and LOG_FATAL.

99 {return get_log() << setlevel(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 & get_log()
Returns the only logstream object.
Definition: tpie_log.h:94
logstream& tpie::log_info ( )
inline

Return logstream for writing info log messages.

Definition at line 109 of file tpie_log.h.

References get_log(), and LOG_INFORMATIONAL.

109 {return get_log() << setlevel(LOG_INFORMATIONAL);}
logstream & get_log()
Returns the only logstream object.
Definition: tpie_log.h:94
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 129 of file tpie_log.h.

References get_log(), and LOG_MEM_DEBUG.

129 {return get_log() << setlevel(LOG_MEM_DEBUG);}
Logging level for warnings concerning memory allocation and deallocation.
Definition: loglevel.h:57
logstream & get_log()
Returns the only logstream object.
Definition: tpie_log.h:94
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 114 of file tpie_log.h.

References get_log(), and LOG_WARNING.

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

114 {return get_log() << setlevel(LOG_WARNING);}
LOG_WARNING is used for warnings.
Definition: loglevel.h:43
logstream & get_log()
Returns the only logstream object.
Definition: tpie_log.h:94
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.
memory_size_type tpie::open_file_count ( )

Return the current number of open files.

Returns
The current number of open files.
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  ;
197 }
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 295 of file parallel_sort.h.

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

298  {
299 #ifdef TPIE_PARALLEL_SORT
300  parallel_sort_impl<iterator_type, comp_type, Progress> s(&pi);
301  s(a,b,comp);
302 #else
303  pi.init(1);
304  std::sort(a,b,comp);
305  pi.done();
306 #endif
307 }
void sort(file_stream< T > &instream, file_stream< T > &outstream, Compare comp, progress_indicator_base &indicator)
Sort elements of a stream using the given STL-style comparator object.
Definition: sort.h:59
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 317 of file parallel_sort.h.

References sort().

319  {
320 #ifdef TPIE_PARALLEL_SORT
321  parallel_sort_impl<iterator_type, comp_type, false> s(0);
322  s(a,b,comp);
323 #else
324  std::sort(a, b, comp);
325 #endif
326 }
void sort(file_stream< T > &instream, file_stream< T > &outstream, Compare comp, progress_indicator_base &indicator)
Sort elements of a stream using the given STL-style comparator object.
Definition: sort.h:59
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< std::pair< T, size_t >, tpie::merger::predwrap >::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 250 of file memory.h.

Referenced by tpie_delete().

250 { 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 boost::enable_if< is_trivially_serializable< T > >::type *  = 0,
typename boost::disable_if< boost::is_pointer< T > >::type *  = 0 
)

tpie::serialize for POD/array types.

Definition at line 108 of file serialization2.h.

110  {
111  dst.write((const char *)&v, sizeof(T));
112 }
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 , 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 213 of file serialization2.h.

References serialize().

213  {
214  using tpie::serialize;
215  serialize(dst, v.size());
216  serialize(dst, v.begin(), v.end());
217 }
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 236 of file serialization2.h.

References serialize().

236  {
237  using tpie::serialize;
238  serialize(dst, v.size());
239  serialize(dst, v.begin(), v.end());
240 }
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 259 of file serialization2.h.

References serialize().

Referenced by tpie::serialization_bits::internal_sort< T, pred_t >::push().

259  {
260  using tpie::serialize;
261  bits::counter c;
262  serialize(c, v);
263  return c.size;
264 }
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 once TPIE has been initialized.

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

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

Definition at line 59 of file sort.h.

References tpie::sort_manager< T, I, M >::sort().

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(), sort(), and tpie::sort_manager< T, I, M >::sort().

60  {
61 
62  ami::Internal_Sorter_Obj<T,Compare> myInternalSorter(comp);
63  ami::merge_heap_obj<T,Compare> myMergeHeap(comp);
64  sort_manager< T, ami::Internal_Sorter_Obj<T,Compare>, ami::merge_heap_obj<T,Compare> >
65  mySortManager(&myInternalSorter, &myMergeHeap);
66 
67  mySortManager.sort(&instream, &outstream, &indicator);
68 }
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 74 of file sort.h.

References sort().

75  {
76  std::less<T> comp;
77  sort(instream, outstream, comp, *indicator);
78 }
void sort(file_stream< T > &instream)
Sort elements of a stream in-place using the less-than operator and no progress indicator.
Definition: sort.h:112
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 93 of file sort.h.

References sort().

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

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

Definition at line 102 of file sort.h.

References sort().

103  {
104  sort(instream, instream, &indicator);
105 }
void sort(file_stream< T > &instream)
Sort elements of a stream in-place using the less-than operator and no progress indicator.
Definition: sort.h:112
template<typename T >
void tpie::sort ( file_stream< T > &  instream)

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

Definition at line 112 of file sort.h.

References sort().

112  {
113  sort(instream, instream);
114 }
void sort(file_stream< T > &instream)
Sort elements of a stream in-place using the less-than operator and no progress indicator.
Definition: sort.h:112
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 380 of file memory.h.

References __unregister_pointer(), get_memory_manager(), ptr_cast(), and tpie::memory_manager::register_deallocation().

Referenced by tpie::pipelining::bits::delayed_buffer_output_t< dest_t >::end(), tpie::pipelining::bits::reverser_output_t< dest_t >::end(), and tpie::ami::partition_and_merge().

380  {
381  if (p == 0) return;
383  uint8_t * pp = ptr_cast<uint8_t *>(p);
384  __unregister_pointer(pp, tpie_size(p), typeid(*p));
385  p->~T();
386  if(!boost::is_polymorphic<T>::value)
387  delete[] pp;
388  else
389  delete[] (pp - sizeof(size_t));
390 }
void __unregister_pointer(void *p, size_t size, const std::type_info &t)
Definition: memory.h:201
void register_deallocation(size_t bytes)
memory_manager & get_memory_manager()
Return a reference to the memory manager.
D ptr_cast(T *t)
Cast between pointer types.
Definition: memory.h:250
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 398 of file memory.h.

References __unregister_pointer(), get_memory_manager(), and tpie::memory_manager::register_deallocation().

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

398  {
399  if (a == 0) return;
400  get_memory_manager().register_deallocation(sizeof(T) * size);
401  __unregister_pointer(a, sizeof(T) * size, typeid(T) );
402  delete[] a;
403 }
void __unregister_pointer(void *p, size_t size, const std::type_info &t)
Definition: memory.h:201
void register_deallocation(size_t bytes)
memory_manager & get_memory_manager()
Return a reference to the memory manager.
tpie::TPIE_DEPRECATED ( inline void   increment_open_file_count())

Deprecated; does nothing.

Definition at line 33 of file file_count.h.

33  {
34  // Does nothing.
35 }
void tpie::tpie_finish ( int  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 ( int  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.
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 338 of file memory.h.

338  {
339  array_allocation_scope_magic<T> m(size);
340  m.allocate();
341  return m.finalize();
342 }
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 boost::enable_if< is_trivially_serializable< T > >::type *  = 0,
typename boost::disable_if< boost::is_pointer< T > >::type *  = 0 
)

tpie::unserialize for POD/array types.

Definition at line 118 of file serialization2.h.

120  {
121  src.read((char *)&v, sizeof(T));
122 }
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 , 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 223 of file serialization2.h.

References unserialize().

223  {
224  typename std::vector<T>::size_type s;
225  using tpie::unserialize;
226  unserialize(src, s);
227  v.resize(s);
228  unserialize(src, v.begin(), v.end());
229 }
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 247 of file serialization2.h.

References unserialize().

247  {
248  typename std::basic_string<T>::size_type s;
249  using tpie::unserialize;
250  unserialize(src, s);
251  v.resize(s);
252  unserialize(src, v.begin(), v.end());
253 }
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 T >
void tpie::unused ( const T &  x)
inline

Declare that a variable is unused on purpose.

Used to suppress warnings about unused variables.

Parameters
xThe variable that is unused on purpose

Definition at line 42 of file util.h.

Referenced by __register_pointer(), __unregister_pointer(), assert_tpie_ptr(), tpie::progress_indicator_null::init(), tpie::dummy_fraction_progress::init(), tpie::dummy_progress_indicator::init(), tpie::ami::stream< T >::new_substream(), tpie::queue< T >::queue(), tpie::progress_indicator_null::set_range(), and tpie::ami::stack< T >::stack().

42 {(void)x;}

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