Sawyer is a library for library writers. It's used by software such as ROSE and part of Sawyer is distributed with ROSE. The complete, canonical documentation for Sawyer is located here. Sawyer is a library that provides the following:
- Conditionally enable streams for program diagnostics. These are C++
std::ostreams
organized by software component and message importance and which can be enabled/disabled with a simple language. A complete plumbing system similar to Unix file I/O redirection but more flexible can do things like multiplexing messages to multiple locations (e.g., stderr and syslogd), rate-limiting, colorizing on ANSI terminals, and so on. See Sawyer::Message for details.
- Logic assertions in the same vein as
<cassert>
but using the diagnostic streams and multi-line output to make them more readable. See Sawyer::Assert for details.
- Progress bars for text-based output using the diagnostic streams so that progress bars interact sanely with other diagnostic output. See Sawyer::ProgressBar for details.
- Command-line parsing to convert program switches and their arguments into C++ objects with the goal of being able to support nearly any command-line style in use, including esoteric command switches from programs like tar and dd. Additionally, documentation can be provided in the C++ source code for each switch and Unix man pages can be produced. See Sawyer::CommandLine for details.
- Container classes: Graph, storing vertex and edge connectivity information along with user-defined values attached to each vertex and edge, sequential ID numbers, and constant time complexity for most operations; IndexedList, a combination list and vector having constant time insertion and erasure and constant time lookup-by-ID; Interval represents integral intervals including empty and whole intervals; IntervalSet and IntervalMap similar to STL's
std::set
and std::map
containers but optimized for cases when very large numbers of keys are adjacent; Map, similar to STL's std::map
but with an API that's consistent with other containers in this library; BitVector bit vectors with operations defined across index intervals. These and many others can be found in the Sawyer::Container namespace.
- Multi-threading support: Sawyer is designed to be used in multi-threaded programs. It also provides some capabilities not usually found in thread libraries, such as the ability to execute user-supplied functions concurrently subject to user-defined constraints on their execution order (see Sawyer::ThreadWorkers).
- Miscellaneous: PoolAllocator (synchronized and unsynchronized variants) to allocate memory from large pools rather than one object at a time; and SmallObject, a base class for objects that are only a few bytes; Stopwatch for high-resolution elapsed time; Optional for optional values.
Design goals for this library can be found in the Design goals page.
Installation instructions can be found on the Installation page.
Other things on the way but not yet ready:
- A simple, extensible, terse markup language that lets users write documentation that can be turned into TROFF, HTML, Doxygen, PerlDoc, TeX, etc. The markup language supports calling of C++ functors to transform the text as it is processed.
The Sawyer namespace is a good place to start for documentation.