ROSE  0.9.9.109
Namespaces | Classes | Typedefs | Functions
Sawyer Namespace Reference

Description

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.
 

Classes

class  Cached
 Implements cache data members. More...
 
class  Callbacks
 
class  DefaultAllocator
 Default allocator. More...
 
class  LockGuard2
 Locks multiple mutexes. More...
 
class  LockGuard2< NullMutex >
 
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  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  SharedFromThis
 Creates SharedPointer from this. More...
 
class  SharedObject
 Base class for reference counted objects. More...
 
class  SharedPointer
 Reference-counting 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...
 

Typedefs

typedef PoolAllocatorBase< sizeof(void *), 4, 32, 40960, SingleThreadedTagUnsynchronizedPoolAllocator
 Small object allocation from memory pools. More...
 
typedef PoolAllocatorBase< sizeof(void *), 4, 32, 40960, MultiThreadedTagSynchronizedPoolAllocator
 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. More...
 
int pclose (FILE *)
 Semi-portable replacement for pclose. More...
 
std::string generateSequentialName (size_t length=3)
 Generate a sequential name. More...
 
void checkBoost ()
 Check for valid boost version or abort. More...
 
std::string thisExecutableName ()
 Return the name of this program obtained from the operating system. More...
 
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)
 Thread-safe random number generator. More...
 
template<class DependencyGraph , class Functor >
void workInParallel (const DependencyGraph &dependencies, size_t nWorkers, Functor functor)
 Performs work in parallel. More...
 

Typedef Documentation

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.

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.

Function Documentation

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   
)

Portable replacement for strtoll.

Microsoft doesn't define this function, so we define it in the Sawyer namespace.

boost::uint64_t Sawyer::strtoull ( const char *  ,
char **  ,
int   
)

Portable replacement for strtoull.

Microsoft doesn't define this function, so we define it in the Sawyer namespace.

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.

FILE* Sawyer::popen ( const std::string &  ,
const char *  how 
)

Semi-portable replacement for popen.

int Sawyer::pclose ( FILE *  )

Semi-portable replacement for pclose.

std::string Sawyer::generateSequentialName ( size_t  length = 3)

Generate a sequential name.

A new string is generated each time this is called.

void Sawyer::checkBoost ( )

Check for valid boost version or abort.

Referenced by Sawyer::Attribute::Storage<>::attributeOrElse(), and Sawyer::Attribute::Storage<>::getAttribute().

std::string Sawyer::thisExecutableName ( )

Return the name of this program obtained from the operating system.

template<class T >
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 282 of file SharedPointer.h.

size_t Sawyer::fastRandomIndex ( size_t  n)

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. This function uses the fastest available method for returning random numbers in a multi-threaded environment. This function is thread-safe.

template<class DependencyGraph , class Functor >
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.

The call does not return until all work has been completed.

Definition at line 267 of file ThreadWorkers.h.