ROSE
0.11.96.11
|
Name space for the entire library.
All Sawyer functionality except for some C preprocessor macros exists inside this namespace. Most of the macros begin with the string "SAWYER_".
Namespaces | |
Assert | |
Run-time logic assertions. | |
Attribute | |
Attributes attached to other objects. | |
Boost | |
Boost Graph Library API for Sawyer::Container::Boost. | |
CommandLine | |
Parses program command line switches and arguments. | |
Container | |
Container classes that store user-defined values. | |
Document | |
Documentation-related entities. | |
FileSystem | |
File system utilities. | |
Message | |
Formatted diagnostic messages emitted to various backends. | |
ProgressBarSettings | |
Global settings for progress bars. | |
Tree | |
Tree data structure. | |
Type | |
Data types. | |
Classes | |
class | BitFlags |
Stores a vector of enum bit flags. More... | |
class | Cached |
Implements cache data members. More... | |
class | Callbacks |
class | DefaultAllocator |
Default allocator. More... | |
class | Error |
Error value. More... | |
class | Error< char[N]> |
struct | is_invocable |
class | LockGuard2 |
Locks multiple mutexes. More... | |
class | LockGuard2< NullMutex > |
class | MultiInstanceTls |
Thread local data per object instance. More... | |
struct | MultiThreadedTag |
Tag indicating that an algorithm or API should assume multiple threads. More... | |
class | Nothing |
Represents no value. More... | |
class | NullBarrier |
class | NullLockGuard |
class | NullMutex |
class | Ok |
Success value. More... | |
class | Ok< char[N]> |
class | Optional |
Holds a value or nothing. More... | |
class | PoolAllocatorBase |
Small object allocation from memory pools. More... | |
class | ProgressBar |
Progress bars. More... | |
class | ProgressBarImpl |
class | ProxyAllocator |
Allocator proxy. More... | |
class | Result |
Result containing a value or an error. More... | |
class | SharedFromThis |
Creates SharedPointer from this. More... | |
class | SharedObject |
Base class for reference counted objects. More... | |
class | SharedPointer |
Reference-counting intrusive smart pointer. More... | |
struct | SingleThreadedTag |
Tag indicating that an algorithm or API can assume only a single thread. More... | |
class | SmallObject |
Small object support. More... | |
class | StackAllocator |
Stack-like allocator. More... | |
class | Stopwatch |
Simple elapsed time. More... | |
struct | SynchronizationTraits |
Traits for thread synchronization. More... | |
struct | SynchronizationTraits< MultiThreadedTag > |
struct | SynchronizationTraits< SingleThreadedTag > |
class | TemporaryCallback |
class | ThreadWorkers |
Work list with dependencies. More... | |
class | WorkFifo |
First-in-first-out work queue. More... | |
Typedefs | |
typedef PoolAllocatorBase< sizeof(void *), 4, 32, 40960, SingleThreadedTag > | UnsynchronizedPoolAllocator |
Small object allocation from memory pools. More... | |
typedef PoolAllocatorBase< sizeof(void *), 4, 32, 40960, MultiThreadedTag > | SynchronizedPoolAllocator |
Small object allocation from memory pools. More... | |
Functions | |
template<typename T , typename U > | |
bool | operator== (const Optional< T > &lhs, const U &rhs) |
template<typename T , typename U > | |
bool | operator!= (const Optional< T > &lhs, const U &rhs) |
bool | initializeLibrary (size_t vmajor=0, size_t vminor=1, size_t vpatch=0, bool withThreads=0) |
Explicitly initialize the library. More... | |
boost::int64_t | strtoll (const char *, char **, int) |
Portable replacement for strtoll. More... | |
boost::uint64_t | strtoull (const char *, char **, int) |
Portable replacement for strtoull. More... | |
std::string | readOneLine (FILE *) |
Reads one line of input from a file. More... | |
FILE * | popen (const std::string &, const char *how) |
Semi-portable replacement for popen. | |
int | pclose (FILE *) |
Semi-portable replacement for pclose. | |
std::string | generateSequentialName (size_t length=3) |
Generate a sequential name. More... | |
void | checkBoost () |
Check for valid boost version or abort. | |
std::string | thisExecutableName () |
Return the name of this program obtained from the operating system. | |
template<class Pointer > | |
Pointer::Pointee * | getRawPointer (Pointer &ptr) |
template<class T > | |
void | clear (SharedPointer< T > &ptr) |
Make pointer point to nothing. More... | |
std::ostream & | operator<< (std::ostream &, const Stopwatch &) |
Sawyer::SynchronizationTraits< Sawyer::SingleThreadedTag >::RecursiveMutex & | bigMutex () |
size_t | fastRandomIndex (size_t n, size_t seed=0) |
Thread-safe random number generator. More... | |
template<class WorkItems , class Functor > | |
void | processWorkList (WorkItems &workList, size_t maxWorkers, Functor f) |
Process work from a work list in parallel. More... | |
typedef PoolAllocatorBase<sizeof(void*), 4, 32, 40960, SingleThreadedTag> Sawyer::UnsynchronizedPoolAllocator |
Small object allocation from memory pools.
Thread safety: This allocator is not thread safe; the caller must synchronize to prevent concurrent calls.
See PoolAllocatorBase for details.
Definition at line 514 of file PoolAllocator.h.
typedef PoolAllocatorBase<sizeof(void*), 4, 32, 40960, MultiThreadedTag> Sawyer::SynchronizedPoolAllocator |
Small object allocation from memory pools.
Thread safety: This allocator is thread safe.
See PoolAllocatorBase for details.
Definition at line 521 of file PoolAllocator.h.
bool Sawyer::initializeLibrary | ( | size_t | vmajor = 0 , |
size_t | vminor = 1 , |
||
size_t | vpatch = 0 , |
||
bool | withThreads = 0 |
||
) |
Explicitly initialize the library.
This initializes any global objects provided by the library to users. This happens automatically for many API calls, but sometimes needs to be called explicitly. It can be called as often as desired; each call checks caller-callee consistency (version number and configuration), but only the first call does any initialization. The function always returns true.
Referenced by Sawyer::CommandLine::SwitchGroup::SwitchGroup().
boost::int64_t Sawyer::strtoll | ( | const char * | , |
char ** | , | ||
int | |||
) |
boost::uint64_t Sawyer::strtoull | ( | const char * | , |
char ** | , | ||
int | |||
) |
std::string Sawyer::readOneLine | ( | FILE * | ) |
Reads one line of input from a file.
Returns one line, including any line termination. Returns an empty string at the end of the file.
std::string Sawyer::generateSequentialName | ( | size_t | length = 3 | ) |
Generate a sequential name.
A new string is generated each time this is called.
void Sawyer::clear | ( | SharedPointer< T > & | ptr | ) |
Make pointer point to nothing.
Clears the pointer so it points to no object. A cleared pointer is like a default-constructed pointer.
Definition at line 325 of file SharedPointer.h.
size_t Sawyer::fastRandomIndex | ( | size_t | n, |
size_t | seed = 0 |
||
) |
Thread-safe random number generator.
Generates uniformly distributed pseudo-random size_t values. The returned value is greater than zero and less than n
, where n
must be greater than zero except when seeding the sequence. To seed the sequence, call with n
equal to zero and a non-zero seed
; all other calls must supply a zero seed
value. This function uses the fastest available method for returning random numbers in a multi-threaded environment. This function is thread-safe.
Referenced by Rose::Combinatorics::shuffle().
void Sawyer::workInParallel | ( | const DependencyGraph & | dependencies, |
size_t | nWorkers, | ||
Functor | functor | ||
) |
Performs work in parallel.
Creates up to the specified number of worker threads to run the tasks described in the dependencies
graph (at least one thread, but not more than the number of items on which to work). The dependencies is a graph whose vertices represent individual tasks to be performed by worker threads, and whose edges represent dependencies between the task. An edge from task a to task b means that task b must complete before task a can begin. If the dependencies graph contains cycles then as much work as possible is performed and then a ContainsCycle exception is thrown.
The functor
can be a class with operator()
, a function pointer, or a lambda expression. If a class is used, it must be copyable and each worker thread will be given its own copy. The functor is invoked with two arguments: the ID number of the task being processed, and a reference to a copy of the task (vertex value) in the dependency graph. The ID number is the vertex ID number in the dependencies
graph.
If a monitor
is provided, it will be called once every period
milliseconds with the following arguments: the dependencies
graph, number
of work items that have been completed, and the set of dependencies
vertex IDs (std::set<size_t>
) that are currently running.
The call does not return until all work has been completed.
Definition at line 316 of file ThreadWorkers.h.
void Sawyer::workInParallel | ( | const DependencyGraph & | dependencies, |
size_t | nWorkers, | ||
Functor | functor, | ||
Monitor | monitor, | ||
boost::chrono::milliseconds | period | ||
) |
Performs work in parallel.
Creates up to the specified number of worker threads to run the tasks described in the dependencies
graph (at least one thread, but not more than the number of items on which to work). The dependencies is a graph whose vertices represent individual tasks to be performed by worker threads, and whose edges represent dependencies between the task. An edge from task a to task b means that task b must complete before task a can begin. If the dependencies graph contains cycles then as much work as possible is performed and then a ContainsCycle exception is thrown.
The functor
can be a class with operator()
, a function pointer, or a lambda expression. If a class is used, it must be copyable and each worker thread will be given its own copy. The functor is invoked with two arguments: the ID number of the task being processed, and a reference to a copy of the task (vertex value) in the dependency graph. The ID number is the vertex ID number in the dependencies
graph.
If a monitor
is provided, it will be called once every period
milliseconds with the following arguments: the dependencies
graph, number
of work items that have been completed, and the set of dependencies
vertex IDs (std::set<size_t>
) that are currently running.
The call does not return until all work has been completed.
Definition at line 323 of file ThreadWorkers.h.
References Sawyer::ThreadWorkers< DependencyGraph, Functor >::nFinished(), Sawyer::ThreadWorkers< DependencyGraph, Functor >::runningTasks(), Sawyer::ThreadWorkers< DependencyGraph, Functor >::start(), and Sawyer::ThreadWorkers< DependencyGraph, Functor >::tryWaitFor().
void Sawyer::processWorkList | ( | WorkItems & | workList, |
size_t | maxWorkers, | ||
Functor | f | ||
) |
Process work from a work list in parallel.
Processes each item in the work list by passing the item and the list of pending work to the provided functor. Up to maxWorkers
work items are processed in parallel. The workList
is responsible for holding the list of outstanding work items and hands them out one at a time according some priority. The WorkFifo is an example class that satisfies the WorkItems
interface and hands out work items in the same order they were created. Since the functor is given a reference to the workList, wihch contains all pending work (work that hasn't started yet), the functor is able to modify the work list, such as adding additional work items.
Definition at line 69 of file WorkList.h.