rpa Namespace Reference

Id
atomic_condition.h,v 1.1 2007/02/11 09:20:25 f4ecw Exp
More...


Classes

class  thread_exec_lock
class  thread_fast_t
class  thread_fast_t< thread_crea, Mtx >
class  thread_fast_t< thread_join, Mtx >
 Same reason, 'thread_fast_t' is incompatible with 'thread_join'. More...
class  thread_repair_t
struct  thread_replace_t
class  thread_void_fail_t
struct  accumulate_args
 For storing the arguments of 'accumulate'. More...
struct  accumulate_args< RngIn, RetType, void_functor >
 Specialisation when there is no functor. That is, when 'operator+' is used. More...
class  accumulate_loop_t
class  accumulate_vec< Args, range_size< ItIn >, BinOp, ThrIter >
struct  coroutine_step
 Used only in the specialisation of accumulate_vec for range_step. More...
struct  coroutine_step< AccumulateVec, void_functor >
 If the original functor is in fact 'operator+'. More...
class  accumulate_vec< Args, range_step< ItIn, Mutex >, BinOp, ThrIter >
class  accumulate_vec< Args, range_jump< ItIn >, BinOp, ThrIter >
 This applies to interleave scheduling. More...
struct  accumulate_t
struct  remove_copy_if_args
 For storing the argument of the algorithm, as given by the calling program. More...
struct  remove_copy_if_seq_size_jump
 For static and interleaved scheduling (range_size and range_jump). More...
struct  remove_copy_if_seq_size_jump< RngIn, range_outp< obuf_iterator< IterOut, Buffer, IterBuf, void > >, Ftor >
 For static or interleaved scheduling, with unlimited buffers. More...
struct  remove_copy_if_seq_size_jump< RngIn, range_outp< obuf_iterator< IterOut, Buffer, IterBuf, Mutex > >, Ftor >
 For static or interleaved scheduling, and limited-size buffers. More...
struct  remove_copy_if_seq_step
struct  remove_copy_if_seq_step< RngIn, range_outp< obuf_iterator< IterOut, Buffer, IterBuf, void > >, Ftor >
struct  remove_copy_if_seq_step< RngIn, range_outp< obuf_iterator< IterOut, Buffer, IterBuf, Mutex > >, Ftor >
class  remove_copy_if_loop_thr
class  remove_copy_if_vec< Args, range_size< ItIn >, RngOut, UnaOp, ThrIter >
 Definition of the algorithm remove_copy_if if the input range is 'range_size'. More...
class  remove_copy_if_vec< Args, range_step< ItIn, Mutex >, RngOut, UnaOp, ThrIter >
 Definition of the algorithm remove_copy_if if the input range is 'range_step'. More...
class  remove_copy_if_vec< Args, range_jump< ItIn >, RngOut, UnaOp, ThrIter >
 Definition of 'remove_copy_if' for interleaved scheduling. More...
struct  remove_copy_if_t
 Represents the STL algorithm 'remove_copy_if', and its several execution modes. More...
class  transform_args
 For storing the argument of the algorithm, as given by the calling program. More...
struct  transform_seq_size_jump
 For static and interleaved scheduling (range_size and range_jump). More...
struct  transform_seq_size_jump< RngIn, range_outp< obuf_iterator< IterOut, Buffer, IterBuf, void > >, Ftor >
 For static or interleaved scheduling, with unlimited buffers. More...
struct  transform_seq_size_jump< RngIn, range_outp< obuf_iterator< IterOut, Buffer, IterBuf, Mutex > >, Ftor >
 For static or interleaved scheduling, and limited-size buffers. More...
struct  transform_seq_step
struct  transform_seq_step< RngIn, range_outp< obuf_iterator< IterOut, Buffer, IterBuf, void > >, Ftor >
struct  transform_seq_step< RngIn, range_outp< obuf_iterator< IterOut, Buffer, IterBuf, Mutex > >, Ftor >
class  transform_loop_thr
class  transform_vec< Args, range_size< ItIn >, RngOut, UnaOp, ThrIter >
 Definition of the algorithm transform if the input range is 'range_size'. More...
class  transform_vec< Args, range_step< ItIn, Mutex >, RngOut, UnaOp, ThrIter >
 Definition of the algorithm transform if the input range is 'range_step'. More...
class  transform_vec< Args, range_jump< ItIn >, RngOut, UnaOp, ThrIter >
 Definition of 'transform' for interleaved scheduling. More...
struct  transform_t
 Represents the STL algorithm 'transform', and its several execution modes. More...
class  atomic_condition
class  pthread_exception
 Used locally, to report threads runtime errors. More...
struct  posix_thread_exception
 Used locally, to report errors related to threads. More...
struct  posix_mutex_exception
 Used locally only, just to report mutex errors. More...
class  posix_thread_fast_t
class  posix_thread
class  posix_mutex
class  posix_condition
struct  atomic
 Models a couple of simple atomic operations for an arbitrary datatype. More...
struct  atomic_mutex
 For implementing atomic access to a datatype without atomic operations. More...
struct  cas1
 Default version of 'compare_and_swap', in order to be able to compile. More...
struct  cas2
 Default version of double compare_and_swap, in order to be able to compile. More...
struct  cas1_mutex
 Emulates a compare-and-swap with a mutex. More...
struct  cas2_mutex
 Emulates a double compare-and-swap with a mutex. More...
struct  resizer
 For reserving room in buffers. More...
struct  resizer< Cont & >
 The parameter may be a reference. More...
struct  resizer< Type[N] >
 For a C-style static array, it is not needed to do any resizing. More...
struct  functor_traits
 Models the fact that some algorithms have an implicit functor. More...
struct  void_functor
 We need a real type for specifying a kind of 'void' or 'default' functor. More...
struct  functor_traits< void >
 Specialization when there is no functor at all. More...
struct  threadify_t
 'threadify_t' transforms a 'threadable' functor, into a 'plain functor. More...
struct  threadify_t< Ftor, thread_tree< ThrSubIter, ThrMain > >
 Specialization for more than one level of sub-threads. More...
struct  threadify_t< void_functor, Thr >
struct  tuple2
 tuple2 holds two objects of arbitrary type. This is a subset of std::pair. More...
struct  true_t
 For debugging only. More...
struct  false_t
struct  container_traits
 For a container type, gives some type information. More...
struct  container_traits< Type[N] >
 If the so-called 'container' is a C-style fixed-size array. More...
struct  container_traits< Container & >
struct  container_traits< Type(&)[N] >
 This is a specialization of container_traits for C-style fixed arrays. More...
struct  insert_invalidates_iterators
 Tells whether an insertion into an container invalidates iterators or not. More...
struct  output_iterator_traits
struct  Carray_to_iterator
struct  Carray_to_iterator< Buffer[N] >
 If the iterator on buffers is a C-style array, we process it like a pointer. More...
class  fmt_output_to_buffer
class  obuf_base
 Just for storing some internal data types. More...
class  obuf_storage
class  obuf_storage< Type[N], IterBuf >
class  obuf_storage< Buffer, void >
class  obuf_storage< Type[N], void >
class  obuf_guard
 Encapsulates the mutex and the maximum size of per-threads buffers. More...
class  obuf_iterator
 'obuf_iterator' attempts to encapsulate output iterators, More...
class  obuf_iterator< IterOut, Buffer, void, Mutex >
 Specialization when there is no generator of buffers. More...
class  obuf_iterator< IterOut, Buffer, IterBuf, void >
 No mutex, so infinite-size buffer. More...
class  obuf_iterator< IterOut, Buffer, void, void >
 Specialization for when no iterator on available buffers is provided. More...
class  obuf_iterator< IterOut, Type[N], IterBuf, void >
struct  iterator_buffer_traits
 Given an iterator on buffers, this gives the datatype of individual buffers. More...
class  range_fwrd
 For forward_tag iterators if single-thread access. This is an output range. More...
class  iterator_lock
 To protect an output iterator. More...
class  iterator_lock< It, void >
 To specify that an output iterator is lock-free (NOT IMPLEMENTED YET). More...
class  range_outp
 General case, for thread-unsafe iterators. More...
class  range_outp< iterator_lock< It, Mutex > >
class  range_outp< iterator_lock< It, void > >
 Specialisation for an atomic output iterator. More...
class  obuf_slice_unbounded
 This represents the slice of an obuf_iterator with infinite-size buffers. More...
class  obuf_slice_bounded
 This is the slice used by an obuf_iterator whose buffers have a size limit. More...
class  range_outp< obuf_iterator< IterOut, Buffer, BufIter, void > >
 General case of buffering any iterator, with unbounded buffers. More...
class  range_outp< obuf_iterator< IterOut, Buffer, BufIter, Mutex > >
 General case of buffering any iterator, with bounded buffers. More...
class  range_lambda
class  range_void
class  chunk_t
 Used to store the minimum size of a chunk of elements, for efficiency. More...
class  range_size
class  range_step_base
class  range_step_aux
class  range_step
class  slice_generator
struct  slice_generator< void >
class  range_step< It, void >
class  iterator_jump_fllw
class  iterator_jump_lead
class  range_jump
struct  range_traits
struct  file_unlocker
class  file_unlocker_adapter
struct  cas1< RPA_LIST_ITERATOR_CONST(Type) >
struct  cas1< RPA_LIST_ITERATOR(Type) >
struct  cas2< RPA_LIST_ITERATOR_CONST(Type), size_t >
struct  cas2< const Type *, RPA_LIST_ITERATOR(Type) >
struct  cas2< RPA_LIST_ITERATOR_CONST(Type), RPA_LIST_ITERATOR(Type) >
struct  atomic< RPA_LIST_ITERATOR(Type) >
 This emulates with a mutex, the atomic manipulation of a list iterator. More...
struct  atomic< RPA_LIST_ITERATOR_CONST(Type) >
 This emulates with a mutex, the atomic use of a list const iterator. More...
class  rpa_list_head
struct  mover
 This template makes a destructive assignment, if 'swap' is available. More...
struct  mover< Type, false >
 This applies when the data type does not have 'swap'. More...
struct  swap_anything
 Brillant idea gratefully borrowed from David Abrahams, has_swap.hpp. More...
struct  no_swap
 no_swap::operator,('x') does not return a char, so sizeof returns 2. More...
class  pipe_itr
 Synchronized iterator for reading from a pipe_circular or pipe_archiver. More...
class  pipe_container
class  pipe_container< Type[CstNbElts] >
class  pipebase
class  pipe_circular
 A circular buffer based on any kind of container. More...
class  range_step< pipe_circular< Container, CondVar >, pipe_circular< Container, CondVar > >
 For reading ranges of elements from a pipe_circular. More...
class  pipe_circular< Container, void >
 This very simplified specialization is here only for completeness. More...
class  pipe_archiver
class  range_step< pipe_archiver< Container, CondVar >, pipe_archiver< Container, CondVar > >
class  pipe_arc_base
 Base class for pipe_archiver. Does not depend on the container type. More...
class  pipe_arc_aux
class  range_step_archiver
class  pipe_arc_aux< Container, CondVar, true >
class  range_step_archiver< Container, CondVar, true >
class  pipe_archiver< Container, void >
 This very simplified specialization is here only for completeness. More...
struct  augm_basic_streambuf
struct  augm_basic_stringbuf
struct  augm_basic_filebuf
class  row_notype
class  row_type
struct  effective_streambuf
struct  effective_streambuf< StrmBuf * >
struct  augm_selector
class  row_buffer
struct  buffer_setter< row_buffer< Type, DerivStrmBuf *, Augm > >
struct  resizer< row_buffer< Type, DerivStrmBuf, Augm > >
class  container_traits< row_buffer< Type, DerivStrmBuf, Augm > >
class  container_traits< const row_buffer< Type, DerivStrmBuf, Augm > >
 The properties of a container and a const-container are similar. More...
class  orow_iterator
 Provides output iterator semantics for streams. It is taken and adapted from the GCC library. For us, its role is to gather the ostream and the delimiter into a single object. We do not have the choice because there is no way to access to the internal components of a std::ostream_iterator. We had the same problem with obuf_iterator< std::back_inserter >. More...
class  dump_row_iterator
class  dump_row_iterator< Type, OutStrmBuf, row_buffer< Type, DerivStrmBuf, Augm > >
class  fmt_output_to_buffer< obuf_iterator< orow_iterator< Type, OutStrmBuf >, row_buffer< Type, BufDerivStrmBuf, Augm >, IterBuf, Mutex > >
class  obuf_base< orow_iterator< Type, OutStrmBuf >, Buffer >
class  range_outp< obuf_iterator< orow_iterator< Type, OutStrmBuf >, Buffer, BufIter, void > >
class  range_outp< obuf_iterator< orow_iterator< Type, OutStrmBuf >, Buffer, BufIter, Mutex > >
struct  cas1< RPA_SET_ITERATOR_CONST(Type) >
struct  cas1< RPA_SET_ITERATOR(Type) >
struct  cas2< RPA_SET_ITERATOR_CONST(Type), size_t >
struct  atomic< RPA_SET_ITERATOR(Type) >
struct  atomic< RPA_SET_ITERATOR_CONST(Type) >
class  streambuf_proxy_base
class  streambuf_proxy
 General template. More...
class  filgen_tmpnam
 For creating temporary file names, for test programs. More...
class  filgen_tmpfile
struct  filgen_mkstemp_default_template
class  filgen_mkstemp_base
class  filgen_mkstemp
class  filgen_name_to_FILE_base
class  filgen_name_to_FILE
class  filgen_name_to_fd_base
class  filgen_name_to_fd
class  filgen_fd_to_FILE_base
class  filgen_fd_to_FILE
class  filgen_FILE_to_fd
struct  cas1< RPA_VECTOR_ITERATOR_CONST(Type, Alloc) >
struct  cas1< RPA_VECTOR_ITERATOR(Type, Alloc) >
struct  cas2< RPA_VECTOR_ITERATOR_CONST(Type, Alloc), size_t >
struct  atomic< RPA_VECTOR_ITERATOR(Type, Alloc) >
struct  atomic< RPA_VECTOR_ITERATOR_CONST(Type, Alloc) >
class  cost_t
struct  thread_traits_def
 Thread behaviour types definitions. More...
struct  ThreadTraits
struct  ThreadTraits< thread_crea >
struct  ThreadTraits< thread_join >
struct  ThreadTraits< thread_tree< ThrIter, ThrMain > >
struct  ThreadTraits< thread_tree< void, ThrMain > >
struct  Comparer
struct  cas2< const Type *, size_t >
struct  BeginEnd
struct  BeginEnd< TypeOut[aNb] >
 Specialisation, if the container type is a plain C-style array. More...
struct  ContInBox
struct  ContInBox< Type[aNb] >
 Specialisation, if the input container is a plain C-style array. More...
class  EnumThr
class  unary_function_count
 Counts the number of times that a functor was called. More...
class  binary_function_count
class  mmap_ctrl
class  tmp_buffer
class  FILE_ctrl
class  fd_ctrl
struct  visitor
 Base class for copying a file descirptor into another. More...
class  streambuf_visitor
 For writing into an output streambuf. More...
class  FILE_visitor
 For writing memory segments into a POSIX file. More...
class  fd_visitor
 For writing memory segments into an integer file descriptor. More...
class  guard
 Used to be sure that mutex are properly unlocked after being locked. More...
class  iota_iterator
 A kind of 'iota, a value behaving like an iterator. For tests. More...
class  istream_iterator_delimiter
struct  thread_exception
 Signals when a thread could not be started. Specializable on the thread. More...
class  mutex_void
 'Do-nothing' mutex, to be used with fake threads, for testing purpose. More...
class  exception_errno
 A simple exception class for reporting 'errno' errors. More...
class  mutex_count_base
 Does the actual counting for the template class 'thread_count'. More...
struct  mutex_count
 Wraps a mutex to count the number of times it is un-/try/-locked. More...
struct  thread_crea
 Pseudo-parallel thread class for making deterministic tests. More...
class  thread_join
 Pseudo-parallel thread class for making deterministic tests. More...
class  thread_counter_base
 Implementation of the base class of all template 'thread_counter'. More...
class  thread_counter
 A class wrapper for threads compliant with RPA interface (create/join/cancel). More...
class  thread_pool
class  thread_tree_core
 The non-templatized part of thread_tree. More...
class  thread_tree_base
 Common class for all thread_tree. More...
class  thread_tree_base< ThrSub[ThrNb] >
 Specialization if sub-threads are stored in a C-array. For simple programs. More...
class  thread_tree_base< thread_pool< ThrPooled > >
 When specialized with 'thread_pool', actually creates a thread pool. More...
class  thread_copy
 This stays allocated as long as the thread is running. More...
class  thread_tree
 Models the sub-threads set given to functors, themselves called by sub-threads. More...
class  thread_tree< ThrIter, ThrMain * >
 Points on a main 'head' thread which is never copied but modified. More...
struct  thread_tree< void, void >
 Equivalent to void, but makes coding simpler, because homogeneous. More...
struct  thread_tree< ThrIter, void >
 Runs a functor with several sub-threads, but still controlled by the current thread. More...
class  thread_tree< void, ThrMain * >
 Executes the functor in a single sub-thread. More...
class  thread_tree< void, ThrMain >
 Executes the functor in a single sub-thread. More...
class  thread_array
 This makes simpler the allocation of a pool of threads. More...
struct  thread_array< void >
 This applies when there are no subthreads. More...
class  future
 Allows the execution of a functor in a thread. More...
class  present
 Holds all the data needed to start a thread with a functor into it. More...
class  spawn
class  target
class  thread_stack
 Base class for all the objects 'loop' of all algorithms. More...
struct  strsorter
struct  __assert_le
 Used to check whether an interval iterator is shorter or equal a given size. More...
struct  probe_aux
struct  probe_range_aux
 Does the same as 'probe', but repetitively on a range of iterators. More...
class  bound_check
class  profiler
 Created by testing programs to have the same output, and do monitorings. More...
struct  atomic< double_list_const_iter_t >
struct  atomic< double_vector_const_iter_t >
struct  cas1< double_list_const_iter_t >
struct  cas1< double_vector_const_iter_t >
struct  atomic< string_vector_const_iter_t >
struct  atomic< string_vector_iter_t >
struct  cas1< string_vector_const_iter_t >
struct  cas1< string_vector_iter_t >
struct  adv< Iter, std::forward_iterator_tag >
struct  adv< Iter, std::bidirectional_iterator_tag >
struct  adv< Iter, std::random_access_iterator_tag >
struct  output_iterator_traits< std::back_insert_iterator< Container > >
class  obuf_base< std::back_insert_iterator< Container >, Buffer >
struct  insert_invalidates_iterators< std::deque< Type, Alloc > >
struct  resizer< std::list< Type, Alloc > >
struct  insert_invalidates_iterators< std::list< Type, Alloc > >
class  streambuf_proxy< std::basic_stringbuf< Char, Traits > >
 If the template parameter is stringbuf, adds methods that a basic_streambuf misses. More...
class  streambuf_proxy< std::basic_filebuf< Char, Traits > >
struct  streambuf_name< std::basic_filebuf< Char, Traits > >
class  streambuf_tmp_name< std::basic_filebuf< Char, Traits >, NameGenerator >
struct  insert_invalidates_iterators< std::vector< Type, Alloc > >
struct  Comparer< BeginEndType, thread_traits_def::is_sequential, Rnguence >
struct  Comparer< BeginEndType, thread_traits_def::is_parallel, range_jump< Iter > >
struct  Comparer< BeginEndType, thread_traits_def::is_undeterministic, range_size< Iter > >
struct  Comparer< BeginEndType, thread_traits_def::is_undeterministic, range_step< Iter, Mutex > >
struct  Comparer< BeginEndType, thread_traits_def::is_undeterministic, range_jump< Iter > >
struct  cas2< RPA_VECTOR_ITERATOR_CONST(Type, std::allocator< Type >), RPA_LIST_ITERATOR(Type) >
struct  atomic< std::back_insert_iterator< Type > >
struct  __assert_le< std::output_iterator_tag >
 If the iterator is an output_iterator, we cannot check anything. More...
struct  probe_aux< Iter, std::output_iterator_tag >
 Testing the content of an output iterator is meaningless. More...
struct  probe_aux< Iter, std::input_iterator_tag >
struct  probe_range_aux< Iter, std::output_iterator_tag >
struct  probe_range_aux< Iter, std::input_iterator_tag >
struct  atomic< set< double >::const_iterator >
struct  atomic< deque< double >::const_iterator >
struct  cas1< set< double >::const_iterator >
struct  cas1< deque< double >::const_iterator >
class  obuf_base< std::back_insert_iterator< std::list< Type, Alloc > >, std::list< Type, Alloc > >
class  range_outp< obuf_iterator< std::back_insert_iterator< std::list< Type, Alloc > >, std::list< Type, Alloc >, BufIter, void > >
class  range_outp< obuf_iterator< std::back_insert_iterator< std::list< Type, Alloc > >, std::list< Type, Alloc >, BufIter, Mutex > >

Typedefs

typedef void *(*) thread_func_pthread (void *)
typedef void *(*) posix_fun_ptr (void *)
typedef int seqnum_t
 The sequence number of an output slice, to reorder results at reduction.
typedef long cost_int_t
typedef testing_mutex sample_mutex_type
 This mutex type is the one that the testing programs will use.
typedef unsigned long thr_nb_t
 A number of threads.
typedef void *(*) thread_func_t (void *)
 The kind of function pointer that a thread executes.
typedef thread_crea testing_thread
typedef mutex_void testing_mutex
typedef char SampleStr [RPA_INT_STR]

Functions

template<class Range, class Type, class BinOp>
accumulate_t< Range, Type,
BinOp > 
accumulate (Range aRng, Type aInit, BinOp aFunc)
 'Helper' function for creating a 'accumulate_t' object.
template<class Range, class Type>
accumulate_t< Range, Type,
void_functor
accumulate (Range aRng, Type aInit)
 Specialisation if we wish to use the builtins '+' operator.
template<class Range, class ItOut, class UnaOp>
remove_copy_if_t< Range, ItOut,
UnaOp > 
remove_copy_if (Range aRng, ItOut aOut, UnaOp aFunc)
 Helper function.
template<class Range, class ItOut, class UnaOp>
transform_t< Range, ItOut,
UnaOp > 
transform (Range aRng, ItOut aOut, UnaOp aFunc)
 Helper function.
template<class Object>
void resize (Object &anObj, size_t aSz)
 Helper function to resize a container, or quasi-container.
template<class Container, class IterIn>
size_t append (Container &refCont, IterIn itBeg, IterIn itEnd, size_t szReserve)
 Used for 'back_inserting' a whole lot of elements.
template<class IterA, class IterB>
bool __iterator_in (IterA aBeg, IterA aEnd, IterB anI, std::forward_iterator_tag)
 Checks that an interator is between to others.
template<class IterA, class IterB>
bool __iterator_in (IterA aBeg, IterA aEnd, IterB anI, std::bidirectional_iterator_tag)
 Checks that an interator is between two others. For debugging.
template<class IterA, class IterB>
bool __iterator_in (IterA aBeg, IterA aEnd, IterB anI, std::random_access_iterator_tag)
 Constant-time test to check that an iterator is in an interval.
template<class IterA, class IterB>
bool __iterator_in (IterA aBeg, IterA aEnd, IterB anI, std::input_iterator_tag)
template<class IterA, class IterB>
bool iterator_in (IterA aBeg, IterA aEnd, IterB anI)
 Checks that an interator is between two others. For debugging.
template<class Container, class Iterator>
size_t __ressz (const Container &aC, Iterator aEnd, std::random_access_iterator_tag)
 Returns the smallest number but bigger or equal to a container's size.
template<class Container, class Iterator>
size_t __ressz (const Container &aC, Iterator, std::forward_iterator_tag)
 Returns the smallest number but bigger or equal to a container's size.
template<class Container, class Iterator>
size_t __ressz (const Container &aC, Iterator, std::bidirectional_iterator_tag)
 Same as forward_iterator_category.
template<class Buffer>
size_t adjust (size_t aAskedSz)
 Adjusts the desired buffer'size to this buffer type's maximum.
template<class ContOut>
obuf_iterator< std::back_insert_iterator<
ContOut >, ContOut, void,
void > 
obuf_back_inserter (ContOut &aC)
 Helper function for creating obuf_iterator objects.
template<class ContOut, class IterBuf>
obuf_iterator< std::back_insert_iterator<
ContOut >, typename iterator_buffer_traits<
IterBuf >::buffer_type, IterBuf,
void > 
obuf_back_inserter (ContOut &aC, IterBuf aIterBuf)
 The buffer type is deduced from the type of the iterator on buffers.
template<class ContOut, class Mutex>
obuf_iterator< std::back_insert_iterator<
ContOut >, ContOut, void,
Mutex > 
obuf_back_inserter (ContOut &aC, Mutex *aMtxPtr, size_t aSzMax)
template<class ContOut, class IterBuf, class Mutex>
obuf_iterator< std::back_insert_iterator<
ContOut >, typename iterator_buffer_traits<
IterBuf >::buffer_type, IterBuf,
Mutex > 
obuf_back_inserter (ContOut &aC, IterBuf aIterBuf, Mutex *aMtxPtr, size_t aSzMax)
 The buffer type is deduced from the type of the iterator on buffers.
template<class Iterator, class Mutex>
iterator_lock< Iterator, Mutex > hold_lock (const Iterator &anIter, Mutex &aMutex)
 Helper function which associates a mutex with an output iterator.
template<class Iterator>
iterator_lock< Iterator, void > lock_free (const Iterator &anIter)
 Helper functions specifying lock-free output iterators.
template<class It>
range_size< It > make_range_size (It aBeg, It aEnd, chunk_t aCM=chunk_t())
 Helper, if the element numbers can be deduced with the iterators.
template<class It>
range_size< It > make_range_size (It aBeg, It aEnd, size_t aSize, chunk_t aCM=chunk_t())
template<class It, class Mutex>
range_step< It, Mutex > make_range_step (It aBeg, It aEnd, size_t aStep, Mutex &aMtx, chunk_t aCM=chunk_t())
 This helper function creates a range_step, as expected.
template<class It>
range_step< It, void > make_range_step (It aBeg, It aEnd, size_t aStep, chunk_t aCM=chunk_t())
 Helper to create an atomic range_step (Dynamic scheduling), without mutex.
template<class It>
range_jump< It > make_range_jump (It aBeg, It aEnd)
 Helper function to easily create a 'range_jump'.
template<class Type, class Alloc, class IterIn>
size_t append (std::list< Type, Alloc > &aCont, IterIn itBeg, IterIn itEnd, size_t szReserve)
 RPA_DECLARE_POD_MOVE (bool)
 RPA_DECLARE_POD_MOVE (char)
 RPA_DECLARE_POD_MOVE (unsigned char)
 RPA_DECLARE_POD_MOVE (short)
 RPA_DECLARE_POD_MOVE (int)
 RPA_DECLARE_POD_MOVE (long)
 RPA_DECLARE_POD_MOVE (unsigned long long)
 RPA_DECLARE_POD_MOVE (float)
 RPA_DECLARE_POD_MOVE (double)
no_swap swap (swap_anything, swap_anything)
 The result value can be combined with no_swap::operator,.
template<class Type>
void move (Type &aDst, Type &aSrc)
 This makes a destructive assignment : It can change the input if is moved to the target.
template<class IterIn, class IterOut>
IterOut move_ranges (IterIn itBeg, IterIn itEnd, IterOut itOut)
template<class Container, class CondVar, class IterIn>
void append (pipe_circular< Container, CondVar > &refPipCirc, IterIn itBeg, IterIn itEnd, size_t szReserve)
template<class Container, class CondVar, class IterIn>
void append (pipe_archiver< Container, CondVar > &refPipArc, IterIn itBeg, IterIn itEnd, size_t szReserve)
template<class Char, class Traits>
void copy_flags_locale (std::basic_ostream< Char, Traits > &aSource, std::basic_ostream< Char, Traits > &aTarget)
template<class Type, class Alloc, class IterIn>
size_t append (std::vector< Type, Alloc > &aCont, IterIn itBeg, IterIn itEnd, size_t szReserve)
template<class IterOut>
void CompErr (IterOut aIterTst, IterOut aIterGoodBeg, IterOut aIterGoodEnd, size_t aSizeTst, size_t aSizeGood, const char *aNameRange, const char *aNameIterCatOut, const char *aNameContOut, const char *aNameIterNew)
 Displays all values if a difference is detected.
template<class BeginEndType>
bool EqualPlain (const BeginEndType &aContTst, const BeginEndType &aContOk)
template<class BeginEndType>
bool EqualSizeUndeterministic (size_t aNbThr, const BeginEndType &aContTst, const BeginEndType &aContOk, size_t aSizePerThr)
template<class BeginEndType>
bool EqualSizeUndeterministicNoOrder (size_t aNbThr, const BeginEndType &aContTst, const BeginEndType &aContOk, size_t aSizePerThr)
template<class BeginEndType>
bool EqualStepUndeterministic (size_t aNbThr, const BeginEndType &aContTst, const BeginEndType &aContOk, size_t aStep)
template<class BeginEndType>
bool EqualStepUndeterministicNoOrder (size_t aNbThr, const BeginEndType &aContTst, const BeginEndType &aContOk, size_t aStep)
template<class BeginEndType>
bool EqualJumpParallel (size_t aNbThr, const BeginEndType &aContTst, const BeginEndType &aContOk)
template<class BeginEndType>
bool EqualJumpUndeterministic (size_t aNbThr, const BeginEndType &aContTst, const BeginEndType &aContOk)
template<class BeginEndType>
bool EqualJumpUndeterministicNoOrder (size_t aNbThr, const BeginEndType &aContTst, const BeginEndType &aContOk)
template<class Ftor>
Ftor::result_type unary_function_to_pointer (const typename Ftor::argument_type &aArg)
 Transforms a functor into a function pointer, with a static functor.
template<class Ftor>
Ftor::result_type binary_function_to_pointer (const typename Ftor::first_argument_type &aX, const typename Ftor::second_argument_type &aY)
 Transforms a functor into a function pointer, with a static functor.
bool fexists (const char *aFile)
 Just tells whether a file exists. Debugging only.
off_t fposition (FILE *aF)
 This returns the current offset from the file beginning.
void fsetposition (FILE *aF, off_t aPos)
 This wraps a fseek with some error detection code.
off_t fposition (int aFd)
void fsetposition (int aFd, off_t aPos)
bool frewinded (FILE *myF)
 This tells whether a file is rewinded to its beginning.
bool frewinded (int aFilDes)
 This tells whether a file is rewinded to its beginning.
void frewind (int aFilDes)
 Rewinds a file to its beginning.
int fileno_nolock (FILE *aFilPtr)
 Returns the int file descriptor of the FILE ptr.
int ferror_nolock (FILE *aFilPtr)
 Does the same as 'ferror' but assumes an exclusive access to the file.
size_t fread_nolock (void *ptr, size_t size, size_t n, FILE *stream)
size_t fwrite_nolock (const void *ptr, size_t size, size_t n, FILE *stream)
static size_t rpa_getpagesize (void)
bool mmap_loop (FILE *aF, const visitor &aVisit, size_t aPagSiz)
 Moves data from shared memory to a POSIX file.
bool mmap_loop (int aFilDes, const visitor &aVisit, size_t aPagSiz)
 Moves data from shared memory to an integer file descriptor.
bool FILE_loop (FILE *aF, const visitor &aVisit, size_t aBufSiz)
 Moves data from a POSIX FILE to another.
bool fd_loop (int aFilDes, const visitor &aVisit, size_t aBufSiz)
 Moves data from an integer file descriptor to another.
void tmpnam_vconcat (char *aBuf, const char *aPattern,...)
 Handy function for creating temporary file names. For testing purpose.
bool dmp_sendfile (int aSrcFd, int aDstFd)
template<typename _Tp, typename _CharT, typename _Traits, typename _Dist>
bool operator== (const istream_iterator_delimiter< _Tp, _CharT, _Traits, _Dist > &__x, const istream_iterator_delimiter< _Tp, _CharT, _Traits, _Dist > &__y)
 Return true if x and y are both end or not end, or x and y are the same.
template<class _Tp, class _CharT, class _Traits, class _Dist>
bool operator!= (const istream_iterator_delimiter< _Tp, _CharT, _Traits, _Dist > &__x, const istream_iterator_delimiter< _Tp, _CharT, _Traits, _Dist > &__y)
 Return false if x and y are both end or not end, or x and y are the same.
template<class ThrIter>
thread_tree< ThrIter, void > make_thread_tree (size_t thrNb, ThrIter thrIter)
 When the master thread is 'void', the current thread controls the sub-threads.
template<class ThrIter, class ThrMain>
thread_tree< ThrIter, ThrMain * > make_thread_tree (size_t thrNb, const ThrIter &thrIter, ThrMain *ptrThrMain)
 Here, a thread is first started, which will later start the sub-threads.
template<class ThrIter, class ThrMain>
thread_tree< ThrIter, ThrMain > make_thread_tree (size_t thrNb, const ThrIter &thrIter, const ThrMain &refThrMain)
 Here, a thread is first started, which will later start the sub-threads.
template<class ThrMain>
thread_tree< void, ThrMain * > make_thread_tree (ThrMain *ptrThrMain)
 Here, a thread is first started, which will later start the sub-threads.
template<class ThrMain>
thread_tree< void, ThrMain > make_thread_tree (const ThrMain &refThrMain)
 Here, a thread is first started, which will later start the sub-threads.
void SampleBuild (SampleStr *aStr, char **aPtr, size_t aNb)
 For creating input samples.
std::ostream & stream_log (const char *aFileName, int aLine)
 This implementation is based on the pthread library.
std::ostream & stream_log_this (const std::type_info &aTypeInfo, const void *aThis, const char *aFileName, int aLine)
void Asrt (bool aCond)
void stream_check (const std::basic_ios< char > &aIStr)
 Simply checks the internal state of a stream.
template<class Iter>
void assert_le_aux (Iter Beg, Iter End, size_t aN)
template<class Iter>
void probe (const Iter &anIt)
 This checks whether the input iterator is dereferenceable.
template<class Iter>
void probe_range (const Iter &aBeg, const Iter &aEnd)
 This helper function is there to choose the right template.
template<class Iter>
void probe_range (const Iter &aBeg, size_t aDist)
 This other function will test 'aDist' elements after the 'gebin'.
template<class Iter>
ptrdiff_t __distance_safe (Iter aBeg, Iter aEnd, std::random_access_iterator_tag)
template<class Iter>
ptrdiff_t __distance_safe (Iter aBeg, Iter aEnd, std::forward_iterator_tag)
 As expected, this specialization runs in linear time.
template<class Iter>
ptrdiff_t __distance_safe (Iter aBeg, Iter aEnd, std::bidirectional_iterator_tag)
 Same implementation as for a forward_iterator.
template<class Iter>
ptrdiff_t __distance_safe (Iter aBeg, Iter aEnd, std::input_iterator_tag)
 This cannot return any significant value.
template<class Iter>
ptrdiff_t distance_safe (Iter aBeg, Iter aEnd)
template<class Iter>
void check_distance_if (Iter aBeg, Iter aEnd, ptrdiff_t aSz)
template<class Iterator>
bound_check< Iterator > bound_checker (Iterator anIt, size_t aN)
 Helper for creating a bound_check object.
template<class Container>
static void Display (const Container &aCont, const char *aMsg="", bool mustCrash=true)
template<class Cont>
void SampleCmp (size_t aArgC, const char *const *aArgV, const Cont &aVecStr)
void Rewind (std::istream &myInStr)
template<class DataOut>
void _CmpStreams (const DataOut *aPtr, size_t aSz, const char *aRangeName, const char *aDelim, std::basic_streambuf< char > &aStreamBuf)
 Simply compares the output result of an parallel 'transform' execution,.
void CmpStreams (const int *aPtr, int aSz, const char *aRangeName, const char *aDelim, std::basic_streambuf< char > &aStreamBuf)
 This function is explicitly instantiated.
void CmpStreams (const long *aPtr, int aSz, const char *aRangeName, const char *aDelim, std::basic_streambuf< char > &aStreamBuf)
 This function is explicitly instantiated.
typedef RPA_LIST_ITERATOR_CONST (double) double_list_const_iter_t
typedef RPA_VECTOR_ITERATOR_CONST (double, std::allocator< double >) double_vector_const_iter_t
typedef RPA_VECTOR_ITERATOR_CONST (string, std::allocator< string >) string_vector_const_iter_t
typedef RPA_VECTOR_ITERATOR (string, std::allocator< string >) string_vector_iter_t

Variables

static const thread_func_t cstFuncExit = (thread_func_t)1
static const thread_func_t cstFuncNoOp = (thread_func_t)3
static volatile const posix_fun_ptr ThreadFuncNop = posix_fun_ptr( 0 )
static volatile const posix_fun_ptr ThreadFuncEnd = posix_fun_ptr( 1 )
 If the function pointer has this value, the thread must terminate.


Detailed Description

Id
atomic_condition.h,v 1.1 2007/02/11 09:20:25 f4ecw Exp

Adapters of the synchronization of the POSIX pthread library (threads, mutexes and spinlocks) to the required interface for mutexes and threads.


Typedef Documentation

typedef void*(*) rpa::thread_func_pthread(void *)

typedef void*(*) rpa::posix_fun_ptr(void *)

typedef int rpa::seqnum_t

The sequence number of an output slice, to reorder results at reduction.

typedef long rpa::cost_int_t

cost_t

Used to quantify the resources used by an algorithm. Each component in the processing chain will have a function called 'cost', returning the number of objects creations (In fact, 'cost_t' is a class which can contain the number of creations, deletions, etc...) This function 'cost' :

To set only some counters, this class can be used this way : return cost_t( cost_t::copy, 123 ) + cost_t( cost_t::dtor, 456 );

typedef testing_mutex rpa::sample_mutex_type

This mutex type is the one that the testing programs will use.

typedef unsigned long rpa::thr_nb_t

A number of threads.

typedef void*(*) rpa::thread_func_t(void *)

The kind of function pointer that a thread executes.

typedef thread_crea rpa::testing_thread

typedef mutex_void rpa::testing_mutex

typedef char rpa::SampleStr[RPA_INT_STR]


Function Documentation

template<class Range, class Type, class BinOp>
accumulate_t< Range, Type, BinOp > rpa::accumulate ( Range  aRng,
Type  aInit,
BinOp  aFunc 
)

'Helper' function for creating a 'accumulate_t' object.

template<class Range, class Type>
accumulate_t< Range, Type, void_functor > rpa::accumulate ( Range  aRng,
Type  aInit 
)

Specialisation if we wish to use the builtins '+' operator.

template<class Range, class ItOut, class UnaOp>
remove_copy_if_t< Range, ItOut, UnaOp > rpa::remove_copy_if ( Range  aRng,
ItOut  aOut,
UnaOp  aFunc 
)

Helper function.

template<class Range, class ItOut, class UnaOp>
transform_t< Range, ItOut, UnaOp > rpa::transform ( Range  aRng,
ItOut  aOut,
UnaOp  aFunc 
)

Helper function.

template<class Object>
void rpa::resize ( Object &  anObj,
size_t  aSz 
)

Helper function to resize a container, or quasi-container.

It goes to the right functor based on the object type. The size is never shrinked, but can only get bigger or identical.

template<class Container, class IterIn>
size_t rpa::append ( Container &  refCont,
IterIn  itBeg,
IterIn  itEnd,
size_t  szReserve 
)

Used for 'back_inserting' a whole lot of elements.

A parameter is given, equal or greater than the needed number. The reason is that the library could get this number in constant time. The implementation of 'append' is free to use this 'reservation size'. The following implementation is the most general case, not very efficient. The integer is equal or greater than the number of elements to insert. Several optimizations may be :

In the general case, there is nothing we can do with the reserve size, but ensuring it is bigger than the actual needed size.

template<class IterA, class IterB>
bool rpa::__iterator_in ( IterA  aBeg,
IterA  aEnd,
IterB  anI,
std::forward_iterator_tag   
)

Checks that an interator is between to others.

For debugging purpose, checks whether an iterator is in the inclusive interval defined by two other iterators. There are several specializations based on the iterator category.

template<class IterA, class IterB>
bool rpa::__iterator_in ( IterA  aBeg,
IterA  aEnd,
IterB  anI,
std::bidirectional_iterator_tag   
)

Checks that an interator is between two others. For debugging.

This works like for forward_iterator_category. The execution time is linear with the interval size.

template<class IterA, class IterB>
bool rpa::__iterator_in ( IterA  aBeg,
IterA  aEnd,
IterB  anI,
std::random_access_iterator_tag   
)

Constant-time test to check that an iterator is in an interval.

template<class IterA, class IterB>
bool rpa::__iterator_in ( IterA  aBeg,
IterA  aEnd,
IterB  anI,
std::input_iterator_tag   
)

We cannot make any check on input iterators, because it would modifiy their content. So, we optimistically assume that things are OK.

template<class IterA, class IterB>
bool rpa::iterator_in ( IterA  aBeg,
IterA  aEnd,
IterB  anI 
)

Checks that an interator is between two others. For debugging.

template<class Container, class Iterator>
size_t rpa::__ressz ( const Container &  aC,
Iterator  aEnd,
std::random_access_iterator_tag   
)

Returns the smallest number but bigger or equal to a container's size.

ressz is used to return in constant time, the smallest possible number, but bigger or equal to the container's size. This number is used to reserve memory for copying. What is necessary is to copy only from the beginning of the container, to the iterator 'aEnd', not the end of the container.

Theorically, should be std::distance( beg, end), but useless.

template<class Container, class Iterator>
size_t rpa::__ressz ( const Container &  aC,
Iterator  ,
std::forward_iterator_tag   
)

Returns the smallest number but bigger or equal to a container's size.

The elements between 'aEnd' and the end of the container will not be copied, but it is faster to reserve a bit of too much memory. Otherwise, we would have to scan the iterators range.

template<class Container, class Iterator>
size_t rpa::__ressz ( const Container &  aC,
Iterator  ,
std::bidirectional_iterator_tag   
)

Same as forward_iterator_category.

template<class Buffer>
size_t rpa::adjust ( size_t  aAskedSz  ) 

Adjusts the desired buffer'size to this buffer type's maximum.

A buffer type may have a maximum possible size, smaller than the requested buffer'size. It will return the minimum of the two. Very important, for example if the buffer type is a fixed-size C-style array, but the requested buffer size is bigger.

A negative or zero buffer size is meaningless. If it is bigger than a 'reasonable' number, meaningless too.

The maximum size may be constant (2**32) but it may be the size of a real fixed-size buffer which must not be overflowed.

Note that a small buffer size is really a bad thing, and should be spotted.

template<class ContOut>
obuf_iterator< std::back_insert_iterator< ContOut >, ContOut, void, void> rpa::obuf_back_inserter ( ContOut &  aC  ) 

Helper function for creating obuf_iterator objects.

Problem : How can we differentiate back_insert from front_insert ? back_insert is the most often used case. Maybe we could wrap the output iterator with a 'reverse_iterator' ? anyway, this is not very urgent. With this minimal 'obuf_iterator', the user assumes that :

template<class ContOut, class IterBuf>
obuf_iterator< std::back_insert_iterator< ContOut >, typename iterator_buffer_traits<IterBuf>::buffer_type, IterBuf, void> rpa::obuf_back_inserter ( ContOut &  aC,
IterBuf  aIterBuf 
)

The buffer type is deduced from the type of the iterator on buffers.

It cannot be another data type.

template<class ContOut, class Mutex>
obuf_iterator< std::back_insert_iterator< ContOut >, ContOut, void, Mutex> rpa::obuf_back_inserter ( ContOut &  aC,
Mutex *  aMtxPtr,
size_t  aSzMax 
)

With this minimal 'obuf_iterator', the user assumes that no mutex is necessary. The type of the internal buffer is the same as the output container (The container on whcih the std::back_inserter points to).

template<class ContOut, class IterBuf, class Mutex>
obuf_iterator< std::back_insert_iterator< ContOut >, typename iterator_buffer_traits<IterBuf>::buffer_type, IterBuf, Mutex> rpa::obuf_back_inserter ( ContOut &  aC,
IterBuf  aIterBuf,
Mutex *  aMtxPtr,
size_t  aSzMax 
)

The buffer type is deduced from the type of the iterator on buffers.

It cannot be another data type. We use 'output_iterator_traits' instead of 'stditerator_traits' because, if IterBuf is a std::back_inserter, value_type would then be 'void'.

template<class Iterator, class Mutex>
iterator_lock< Iterator, Mutex > rpa::hold_lock ( const Iterator &  anIter,
Mutex &  aMutex 
)

Helper function which associates a mutex with an output iterator.

template<class Iterator>
iterator_lock< Iterator, void > rpa::lock_free ( const Iterator &  anIter  ) 

Helper functions specifying lock-free output iterators.

If there is already a mutex protecting the output iterator, no need to explicitly add one mutex.

template<class It>
range_size< It > rpa::make_range_size ( It  aBeg,
It  aEnd,
chunk_t  aCM = chunk_t() 
)

Helper, if the element numbers can be deduced with the iterators.

template<class It>
range_size< It > rpa::make_range_size ( It  aBeg,
It  aEnd,
size_t  aSize,
chunk_t  aCM = chunk_t() 
)

This helper if we know in advance the size of the input range. It saves time if these are not random_access iterators.

template<class It, class Mutex>
range_step< It, Mutex > rpa::make_range_step ( It  aBeg,
It  aEnd,
size_t  aStep,
Mutex &  aMtx,
chunk_t  aCM = chunk_t() 
)

This helper function creates a range_step, as expected.

template<class It>
range_step< It, void > rpa::make_range_step ( It  aBeg,
It  aEnd,
size_t  aStep,
chunk_t  aCM = chunk_t() 
)

Helper to create an atomic range_step (Dynamic scheduling), without mutex.

NOTE: We can have an input iterator, whose container has a known size, without having to increment it freely like a random_access_iterator. For example, a file, a socket if the number of messages to read is known. In such a case, it is not possible to use static scheduling (range_size), but simply dynamic scheduling (range_step).

template<class It>
range_jump< It > rpa::make_range_jump ( It  aBeg,
It  aEnd 
)

Helper function to easily create a 'range_jump'.

template<class Type, class Alloc, class IterIn>
size_t rpa::append ( std::list< Type, Alloc > &  aCont,
IterIn  itBeg,
IterIn  itEnd,
size_t  szReserve 
)

Used for 'back_inserting' a whole lot of elements. This is the most general case. 'IterIn' should not be a list::iterator, otherwise it would be ridiculous not to use 'splice'. However, this method is provided for completeness of tests.

We may reserve elements in advance, but the benefit would not be big, due to the structure of lists : One allocation is necessary any per node. This should never be called by our specialized range. ==== SO MAYBE THIS WILL BE NEVER USED ??? => But maybe called by pipelines which do not have these specialized ranges ? ==== WHICH IS A BIT SELF-CONTRADICTORY BECAUSE IF WE INSERT THE FILE ==== THIS SEQUENCE WILL BE USED. THE ONLY WAY WOULD BE TO FORBID ==== EXPLICITELY THE USE OF THIS SEQUENCE

BEWARE: We assume that the size cannot be calculated in constant time. Check what C++ standard says about that. If it does, use a plain std::copy. std::copy( itBeg, itEnd, std::back_inserter( aCont ) );

TODO: Depending on the data type, use push_back if this is a small object, or (1) pushes an empty object, then (2) swaps with the source iterator.

rpa::RPA_DECLARE_POD_MOVE ( bool   ) 

rpa::RPA_DECLARE_POD_MOVE ( char   ) 

rpa::RPA_DECLARE_POD_MOVE ( unsigned  char  ) 

rpa::RPA_DECLARE_POD_MOVE ( short   ) 

rpa::RPA_DECLARE_POD_MOVE ( int   ) 

rpa::RPA_DECLARE_POD_MOVE ( long   ) 

rpa::RPA_DECLARE_POD_MOVE ( unsigned long  long  ) 

rpa::RPA_DECLARE_POD_MOVE ( float   ) 

rpa::RPA_DECLARE_POD_MOVE ( double   ) 

no_swap rpa::swap ( swap_anything  ,
swap_anything   
)

The result value can be combined with no_swap::operator,.

template<class Type>
void rpa::move ( Type &  aDst,
Type &  aSrc 
)

This makes a destructive assignment : It can change the input if is moved to the target.

Uses std::swap or rpa::swap, which combine differently with operator',' std::swap returns void, so theresult of ',' will be char.

See Alexei Alexandrescu (I think) for many, many interesting ideas about the semantics of 'moving' instead of assigning (C++ Users Journal).

template<class IterIn, class IterOut>
IterOut rpa::move_ranges ( IterIn  itBeg,
IterIn  itEnd,
IterOut  itOut 
)

template<class Container, class CondVar, class IterIn>
void rpa::append ( pipe_circular< Container, CondVar > &  refPipCirc,
IterIn  itBeg,
IterIn  itEnd,
size_t  szReserve 
)

This is used when an insertion iterator into a pipe_circular is created with a rpa::obuf_iterator, which makes 'flushes' of the output buffer of each sub-thread into the output. This function receives :

template<class Container, class CondVar, class IterIn>
void rpa::append ( pipe_archiver< Container, CondVar > &  refPipArc,
IterIn  itBeg,
IterIn  itEnd,
size_t  szReserve 
)

This is used when an insertion iterator into a pipe_archiver is created with a rpa::obuf_iterator, which makes 'flushes' of the output buffer of each sub-thread into the output. This function receives :

template<class Char, class Traits>
void rpa::copy_flags_locale ( std::basic_ostream< Char, Traits > &  aSource,
std::basic_ostream< Char, Traits > &  aTarget 
)

Used in row_buffer_impl.h for implementing row_notype, and used in tests programs too. Copies all formatting flags and locale information.

template<class Type, class Alloc, class IterIn>
size_t rpa::append ( std::vector< Type, Alloc > &  aCont,
IterIn  itBeg,
IterIn  itEnd,
size_t  szReserve 
)

Used for 'back_inserting' a whole lot of elements. This is used when an insertion iterator into a pipeline_circular is created with a rpa::obuf_iterator, which makes 'flushes' of the output buffer of each sub-thread into the output. This function receives :

TODO: Uses resize() then rpa::move_ranges ! Several possibilities:

template<class IterOut>
void rpa::CompErr ( IterOut  aIterTst,
IterOut  aIterGoodBeg,
IterOut  aIterGoodEnd,
size_t  aSizeTst,
size_t  aSizeGood,
const char *  aNameRange,
const char *  aNameIterCatOut,
const char *  aNameContOut,
const char *  aNameIterNew 
)

Displays all values if a difference is detected.

template<class BeginEndType>
bool rpa::EqualPlain ( const BeginEndType &  aContTst,
const BeginEndType &  aContOk 
)

Simple comparison between two sets of values. It should be possible to optimize this by taking into account the number of elements (Which is always known) and the data type, if this is a pointer.

True, except for std::set : We will see that later.

template<class BeginEndType>
bool rpa::EqualSizeUndeterministic ( size_t  aNbThr,
const BeginEndType &  aContTst,
const BeginEndType &  aContOk,
size_t  aSizePerThr 
)

template<class BeginEndType>
bool rpa::EqualSizeUndeterministicNoOrder ( size_t  aNbThr,
const BeginEndType &  aContTst,
const BeginEndType &  aContOk,
size_t  aSizePerThr 
)

template<class BeginEndType>
bool rpa::EqualStepUndeterministic ( size_t  aNbThr,
const BeginEndType &  aContTst,
const BeginEndType &  aContOk,
size_t  aStep 
)

template<class BeginEndType>
bool rpa::EqualStepUndeterministicNoOrder ( size_t  aNbThr,
const BeginEndType &  aContTst,
const BeginEndType &  aContOk,
size_t  aStep 
)

template<class BeginEndType>
bool rpa::EqualJumpParallel ( size_t  aNbThr,
const BeginEndType &  aContTst,
const BeginEndType &  aContOk 
)

The difficulty is that we may not have a container with random access iterators.

At the end, we have recreated exactly the sub-ranges, with the right order.

This checks that all elements are compared once.

There must be nothing left to compare.

template<class BeginEndType>
bool rpa::EqualJumpUndeterministic ( size_t  aNbThr,
const BeginEndType &  aContTst,
const BeginEndType &  aContOk 
)

Called if we use real threads (And not pseudo-threads for testing). We do not know in which order they start. On the other hand, we are sure that they process one element out of 'NbThreads' elements. So, to make the tests, we just need to find the beginning of the place where each thread writes, and that is where we must start comparing. But, for this, we must search from the beginning of the container.

Same as EqualJumpParallel, but the slices lose the original order. So we have to rescal from the beginning, which is much slower.

This helps checking that all elements are compared.

Searches the sequence from the beginning.

template<class BeginEndType>
bool rpa::EqualJumpUndeterministicNoOrder ( size_t  aNbThr,
const BeginEndType &  aContTst,
const BeginEndType &  aContOk 
)

template<class Ftor>
Ftor::result_type rpa::unary_function_to_pointer ( const typename Ftor::argument_type &  aArg  ) 

Transforms a functor into a function pointer, with a static functor.

Used to test whether it is possible to pass to algorithms, a function pointer instead of a functor.

template<class Ftor>
Ftor::result_type rpa::binary_function_to_pointer ( const typename Ftor::first_argument_type &  aX,
const typename Ftor::second_argument_type &  aY 
)

Transforms a functor into a function pointer, with a static functor.

Used to test whether it is possible to pass to algorithms, a function pointer instead of a functor.

bool rpa::fexists ( const char *  aFN  ) 

Just tells whether a file exists. Debugging only.

It is better to use 'stat' than a simple fopen, because we can analyse errors such as protection problems, etc...

off_t rpa::fposition ( FILE *  aF  ) 

This returns the current offset from the file beginning.

void rpa::fsetposition ( FILE *  aF,
off_t  aPos 
)

This wraps a fseek with some error detection code.

off_t rpa::fposition ( int  aFd  ) 

This returns the current offset from the file beginning. It would be more straightforward to use tell instead of lseek but 'tell' is not defined on Cygwin. It seems that in some situation, the position can be beyond the last written piece of data, and this makes that it is impossible to read all the buffer.

void rpa::fsetposition ( int  aFd,
off_t  aPos 
)

bool rpa::frewinded ( FILE *  aF  ) 

This tells whether a file is rewinded to its beginning.

This tells whether the file points at its beginning. Intentionaly, the file offsets and positions are hidden to the calling program. So, the programs do not have to deal with large file issues.

bool rpa::frewinded ( int  aFilDes  ) 

This tells whether a file is rewinded to its beginning.

It would be more straightforward to use 'tell' instead of lseek, but this is not defined on Cygwin.

void rpa::frewind ( int  aFilDes  ) 

Rewinds a file to its beginning.

int rpa::fileno_nolock ( FILE *  aFilPtr  ) 

Returns the int file descriptor of the FILE ptr.

Stream FILE ptr changed into an int file descriptor. The fileno_unlocked function is equivalent to the fileno function except that it does not implictly lock the stream if the state is FSETLOCKING_INTERNAL. It should not be necessary because the streams are unlocked before being used.

int rpa::ferror_nolock ( FILE *  aFilPtr  ) 

Does the same as 'ferror' but assumes an exclusive access to the file.

This returns the error code of the file, and is used only when we are sure that only one thread can access this file at this time. It uses if possible a non-portable call, which nakes things faster.

size_t rpa::fread_nolock ( void *  ptr,
size_t  size,
size_t  n,
FILE *  stream 
)

This makes a plain read from a file assuming that only one thread can acces it at this time. Some platforms offer a specific call for exclusive access. This is not portable but helps performance.

There are no '::' colons because it is a macro on Linux when optimizing, with gcc 4.x.

size_t rpa::fwrite_nolock ( const void *  ptr,
size_t  size,
size_t  n,
FILE *  stream 
)

This makes a plain write from a file assuming that only one thread can acces it at this time. Some platforms offer a specific call for exclusive access. This is not portable but helps performance.

There are no '::' colons because it is a macro on Linux when optimizing, with gcc 4.x.

static size_t rpa::rpa_getpagesize ( void   )  [static]

This is equivalent to getpagesize which is optional in POSIX. This is used for file copies.

bool rpa::mmap_loop ( FILE *  aF,
const visitor &  aVisit,
size_t  aPagSiz 
)

Moves data from shared memory to a POSIX file.

This read all data from the beginning of the file to the place where the current pointer is, and writes the data to the visitor. The file is read by mapping its content into memory, by small segments.

bool rpa::mmap_loop ( int  aFilDes,
const visitor &  aVisit,
size_t  aPagSiz 
)

Moves data from shared memory to an integer file descriptor.

The default page size is zero. If this is the default page size, then takes the system page size.

bool rpa::FILE_loop ( FILE *  aF,
const visitor &  aVisit,
size_t  aBufSiz 
)

Moves data from a POSIX FILE to another.

This read all data from the beginning of the file to the place where the current pointer is, and writes the data to the visitor. The file is read by using POSIX function 'fread'.

bool rpa::fd_loop ( int  aFilDes,
const visitor &  aVisit,
size_t  aBufSiz 
)

Moves data from an integer file descriptor to another.

This helper avoids to expose the class 'fd_ctrl', and therefore helps separate compilation.

void rpa::tmpnam_vconcat ( char *  aBuf,
const char *  aPattern,
  ... 
)

Handy function for creating temporary file names. For testing purpose.

Handy function for creating temporary file names. It appends to the result of 'tmpnam', a format string and a variable number of arguments. For tests only because 'tmpnam' has a security loophole. Example : tmpnam_vconcat( aBuf, ".Pid=%d.txt", getpid() ) will write in the buffer something like : "/tmp/xyz012345.Pid=12345.txt"

bool rpa::dmp_sendfile ( int  aSrcFd,
int  aDstFd 
)

This runs the function 'sendfile', and makes more adaptations due to the difference between operating systems.

template<typename _Tp, typename _CharT, typename _Traits, typename _Dist>
bool rpa::operator== ( const istream_iterator_delimiter< _Tp, _CharT, _Traits, _Dist > &  __x,
const istream_iterator_delimiter< _Tp, _CharT, _Traits, _Dist > &  __y 
) [inline]

Return true if x and y are both end or not end, or x and y are the same.

template<class _Tp, class _CharT, class _Traits, class _Dist>
bool rpa::operator!= ( const istream_iterator_delimiter< _Tp, _CharT, _Traits, _Dist > &  __x,
const istream_iterator_delimiter< _Tp, _CharT, _Traits, _Dist > &  __y 
) [inline]

Return false if x and y are both end or not end, or x and y are the same.

template<class ThrIter>
thread_tree< ThrIter, void > rpa::make_thread_tree ( size_t  thrNb,
ThrIter  thrIter 
)

When the master thread is 'void', the current thread controls the sub-threads.

Helper function for returning the most common type of thread tree.

template<class ThrIter, class ThrMain>
thread_tree< ThrIter, ThrMain * > rpa::make_thread_tree ( size_t  thrNb,
const ThrIter &  thrIter,
ThrMain *  ptrThrMain 
)

Here, a thread is first started, which will later start the sub-threads.

The thread tree still points to the head thread which will be changed.

template<class ThrIter, class ThrMain>
thread_tree< ThrIter, ThrMain > rpa::make_thread_tree ( size_t  thrNb,
const ThrIter &  thrIter,
const ThrMain &  refThrMain 
)

Here, a thread is first started, which will later start the sub-threads.

The thread_tree keeps a private copy of the main thread (Which may be a proxy)

template<class ThrMain>
thread_tree< void, ThrMain * > rpa::make_thread_tree ( ThrMain *  ptrThrMain  ) 

Here, a thread is first started, which will later start the sub-threads.

No sub-thread is started, the job is done by the head thread. Used for pipelining several tasks which cannot be parallelised. The thread tree still points to the head thread which will be changed.

template<class ThrMain>
thread_tree< void, ThrMain > rpa::make_thread_tree ( const ThrMain &  refThrMain  ) 

Here, a thread is first started, which will later start the sub-threads.

No sub-thread is started, the job is done by the head thread. Used for pipelining several tasks which cannot be parallelised. The thread_tree keeps a private copy of the main thread (Which may be a proxy)

void rpa::SampleBuild ( SampleStr aStr,
char **  aPtr,
size_t  aNb 
)

For creating input samples.

std::ostream & rpa::stream_log ( const char *  aFileName,
int  aLine 
)

This implementation is based on the pthread library.

This function returns a ostream for printing logging messages. Before returning, it writes some data to this stream (thread id, etc...), plus the input parameters.

std::ostream & rpa::stream_log_this ( const std::type_info &  aTypeInfo,
const void *  aThis,
const char *  aFileName,
int  aLine 
)

This function returns a ostream for printing logging messages. Before returning, it writes some data to this stream (thread id, etc...), plus the input parameters.

void rpa::Asrt ( bool  aCond  ) 

This replaces 'assert', and saves some compilation time. 'errno' is printed for informational purpose only because the error may not be related to errno at all.

void rpa::stream_check ( const std::basic_ios< char > &  aInStr  ) 

Simply checks the internal state of a stream.

Now we want to now the real type of the stream buffer.

First check the buffer's state.

It would be very convenient to be able to demangle the result of type_info::name().

template<class Iter>
void rpa::assert_le_aux ( Iter  Beg,
Iter  End,
size_t  aN 
)

This checks whether the distance between two iterators is less than or equal a given number. This helper functions uses the iterator category to choose the right function.

template<class Iter>
void rpa::probe ( const Iter &  anIt  ) 

This checks whether the input iterator is dereferenceable.

template<class Iter>
void rpa::probe_range ( const Iter &  aBeg,
const Iter &  aEnd 
)

This helper function is there to choose the right template.

template<class Iter>
void rpa::probe_range ( const Iter &  aBeg,
size_t  aDist 
)

This other function will test 'aDist' elements after the 'gebin'.

template<class Iter>
ptrdiff_t rpa::__distance_safe ( Iter  aBeg,
Iter  aEnd,
std::random_access_iterator_tag   
)

distance_safe displays a distance between two iterators, for debugging. If these are input_iterators, do not read them !!! Except for this case, it does the same as std::distance.

template<class Iter>
ptrdiff_t rpa::__distance_safe ( Iter  aBeg,
Iter  aEnd,
std::forward_iterator_tag   
)

As expected, this specialization runs in linear time.

template<class Iter>
ptrdiff_t rpa::__distance_safe ( Iter  aBeg,
Iter  aEnd,
std::bidirectional_iterator_tag   
)

Same implementation as for a forward_iterator.

template<class Iter>
ptrdiff_t rpa::__distance_safe ( Iter  aBeg,
Iter  aEnd,
std::input_iterator_tag   
)

This cannot return any significant value.

Testing the content of an output iterator is meaningless. If we read, for testing, the content of an input_iterator, such as a istream_iterator, its content will be destroyed. So we just return a 'realistic value' that will pass the tests.

template<class Iter>
ptrdiff_t rpa::distance_safe ( Iter  aBeg,
Iter  aEnd 
)

Helper function for choosing the right template, based on the iterator category.

template<class Iter>
void rpa::check_distance_if ( Iter  aBeg,
Iter  aEnd,
ptrdiff_t  aSz 
)

For debugging purpose only, to check that the assumed distance between two iterators is the good one. But it cannot work for input_iterator_tag, so there is a work-around. Note that this test will give bad answers if the distance is *really* UNDEFINED_DISTANCE. Not really worth to change this debugging code.

template<class Iterator>
bound_check< Iterator > rpa::bound_checker ( Iterator  anIt,
size_t  aN 
)

Helper for creating a bound_check object.

template<class Container>
static void rpa::Display ( const Container &  aCont,
const char *  aMsg = "",
bool  mustCrash = true 
) [static]

Just for displaying the content of a container, and then quits. Little helper function used when a comparison of results was unsuccesful.

template<class Cont>
void rpa::SampleCmp ( size_t  aArgC,
const char *const *  aArgV,
const Cont &  aVecStr 
)

The input array must be SORTED. This comparison does not need to allocate memory at all.

void rpa::Rewind ( std::istream &  myInStr  ) 

template<class DataOut>
void rpa::_CmpStreams ( const DataOut aPtr,
size_t  aSz,
const char *  aRangeName,
const char *  aDelim,
std::basic_streambuf< char > &  aStreamBuf 
)

Simply compares the output result of an parallel 'transform' execution,.

Simply compares the output result of an parallel 'transform' execution, to what the result should have been done. If errors are detected, simply prints the offending results, then exits with a core dump. This method is called after the method execution. The input sample must be SORTED !! This is not templatized on the character and the char_traits, but this rare case is not tested yet anyway. NOT TESTED IF 'aDelim' = '
'.

Go back to the beginning of the stream buffer.

This reads the output result of the algorithm, and checks whether it exists in the sample or not. The data type must be deserializable given the delimiter.

Now that we have rebuilt a container with the input stream, it is compared against the input container. They should be equal.

Go back to the beginning of the stream buffer.

void rpa::CmpStreams ( const int *  aPtr,
int  aSz,
const char *  aRangeName,
const char *  aDelim,
std::basic_streambuf< char > &  aStreamBuf 
)

This function is explicitly instantiated.

This is the only instantiation we need for the moment. This avoids to inline the code many times. Performance at less important for test code. NOTE: I could NOT find the way to explicitely instantiate a function...

void rpa::CmpStreams ( const long *  aPtr,
int  aSz,
const char *  aRangeName,
const char *  aDelim,
std::basic_streambuf< char > &  aStreamBuf 
)

This function is explicitly instantiated.

typedef rpa::RPA_LIST_ITERATOR_CONST ( double   )  const

typedef rpa::RPA_VECTOR_ITERATOR_CONST ( double  ,
std::allocator< double >   
) const

typedef rpa::RPA_VECTOR_ITERATOR_CONST ( string  ,
std::allocator< string >   
) const

typedef rpa::RPA_VECTOR_ITERATOR ( string  ,
std::allocator< string >   
)


Variable Documentation

const thread_func_t rpa::cstFuncExit = (thread_func_t)1 [static]

const thread_func_t rpa::cstFuncNoOp = (thread_func_t)3 [static]

volatile const posix_fun_ptr rpa::ThreadFuncNop = posix_fun_ptr( 0 ) [static]

When the function pointer has this value, it means that there is nothing to do, and that the thread can wait.

volatile const posix_fun_ptr rpa::ThreadFuncEnd = posix_fun_ptr( 1 ) [static]

If the function pointer has this value, the thread must terminate.


Generated on Tue Sep 25 10:20:31 2007 for rpa by  doxygen 1.4.7