Lunchbox  1.14.0
Multi-threaded C++ toolbox library for all application developers creating high-performance multi-threaded programs.
lunchbox Namespace Reference

Abstraction layer and common utilities for multi-threaded programming. More...

Classes

class  Any
 A class which can hold instances of any type. More...
 
class  Array
 A wrapper for C arrays without any memory management. More...
 
class  Atomic
 A variable with atomic semantics and standalone atomic operations. More...
 
class  bad_any_cast
 A specialization for exceptions thrown by an unsuccessful any_cast. More...
 
class  Buffer
 A simple memory buffer with some helper functions. More...
 
class  Clock
 A class for time measurements. More...
 
class  Condition
 A condition variable and associated lock. More...
 
class  DSO
 Helper to access dynamic shared objects (DSO) More...
 
class  Future
 A future represents a asynchronous operation. More...
 
class  Future< void >
 Future template specialization for void. More...
 
class  FutureBool
 A boolean future with a known value. More...
 
class  FutureFunction
 A Future implementation using a boost::function for fulfilment. More...
 
class  FutureImpl
 Base class to implement the wait method fulfilling the future. More...
 
class  FutureTimeout
 
struct  hashRefPtr
 A hash function for RefPtr keys. More...
 
class  IndexIterator
 Counter-based, as opposed to pointer-based, iterator for any container. More...
 
class  IntervalSet
 A container to store intervals of elements efficently. More...
 
class  Launcher
 The launcher executes a command from a separate process. More...
 
class  LFQueue
 A thread-safe, lock-free queue with non-blocking access. More...
 
class  LFVector
 STL-like vector implementation providing certain thread-safety guarantees. More...
 
class  LFVectorIterator
 An iterator for LFVector. More...
 
class  Lock
 A lock (mutex) primitive. More...
 
class  Lockable
 A convenience structure to hold data together with a lock for access. More...
 
class  Log
 The logging class. More...
 
class  MemoryMap
 Helper to map a file to a memory address (mmap). More...
 
class  Monitor
 A monitor primitive. More...
 
class  MTQueue
 A thread-safe queue with a blocking read access. More...
 
class  PerThread
 Implements thread-specific storage for C++ objects. More...
 
class  PerThreadRef
 Thread-specific storage for a RefPtr. More...
 
class  Plugin
 Manages a class deriving from a T interface. More...
 
class  PluginFactory
 Factory for Plugin classes. More...
 
class  PluginRegisterer
 Helper class to statically register derived plugin classes. More...
 
class  Pool
 An object allocation pool. More...
 
class  PtrHash
 A hash for pointer keys. More...
 
class  Referenced
 Base class for referenced objects. More...
 
class  RefPtr
 A smart reference pointer, aka boost::intrusive_ptr. More...
 
class  RefPtrHash
 A hash for RefPtr keys. More...
 
class  Request
 A Future implementation for a RequestHandler request. More...
 
class  RequestHandler
 A thread-safe request handler. More...
 
class  Result
 A result returns an error code and behaves like a boolean. More...
 
class  RNG
 A random number generator. More...
 
class  ScopedMutex
 A scoped mutex. More...
 
class  SpinLock
 A fast lock for uncontended memory access. More...
 
class  Thread
 Utility class to execute code in a separate execution thread. More...
 
class  ThreadID
 An utility class to wrap OS-specific thread identifiers. More...
 
class  TimedLock
 A mutex with timeout capabilities. More...
 
class  TLS
 Provides thread-local storage API used by PerThread and PerThreadRef. More...
 
class  UnregisteredRequest
 
class  Version
 Information about the current Lunchbox version. More...
 

Typedefs

typedef boost::mpl::list< int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, float, double, bool, std::string, servus::uint128_t > podTypes
 List of supported POD types for lunchbox::Any serialization. More...
 
typedef Future< bool > f_bool_t
 A boolean future. More...
 
typedef Monitor< bool > Monitorb
 A boolean monitor variable.
 
typedef Monitor< uint32_t > Monitoru
 An unsigned 32bit integer monitor.
 
typedef ScopedMutex< SpinLock, ReadOp > ScopedFastRead
 A scoped mutex for a fast uncontended read operation. More...
 
typedef ScopedMutex< SpinLock, WriteOp > ScopedFastWrite
 A scoped mutex for a fast uncontended write operation. More...
 
typedef ScopedMutex< Lock, ReadOp > ScopedRead
 A scoped mutex for a read operation. More...
 
typedef ScopedMutex< Lock, WriteOp > ScopedWrite
 A scoped mutex for a write operation. More...
 
typedef ScopedMutex< Condition, WriteOp > ScopedCondition
 A scoped mutex for a write operation on a condition. More...
 
typedef std::vector< std::string > Strings
 A vector of std::strings. More...
 
typedef Strings::const_iterator StringsCIter
 
typedef Strings::iterator StringsIter
 
typedef Atomic< int32_t > a_int32_t
 An atomic 32 bit integer variable.
 
typedef Atomic< ssize_t > a_ssize_t
 An atomic signed size variable.
 
typedef Buffer< uint8_t > Bufferb
 a byte buffer
 
typedef Future< uint32_t > f_uint32_t
 A future 32 bit unsigned promise.
 
typedef Future< ssize_t > f_ssize_t
 A future signed size promise.
 
typedef Future< void > f_void_t
 A future signed size promise.
 
typedef std::vector< DSO * > DSOs
 A vector of DSO. More...
 

Enumerations

enum  LogLevel {
  LOG_ERROR = 1, LOG_WARN = LOG_ERROR, LOG_INFO, LOG_DEBUG,
  LOG_VERB, LOG_ALL
}
 The logging levels. More...
 
enum  LogTopic { LOG_EXCEPTION = 0x01, LOG_BUG = 0x04, LOG_CUSTOM = 0x10, LOG_ANY = 0xffffu }
 The logging topics. More...
 
enum  VisitorResult { TRAVERSE_CONTINUE, TRAVERSE_TERMINATE, TRAVERSE_PRUNE }
 The result code from any visit operation. More...
 

Functions

template<typename T >
std::vector< T >::iterator find (std::vector< T > &container, const T &element)
 Find the element in the given vector. More...
 
template<typename T >
std::vector< T >::const_iterator find (const std::vector< T > &container, const T &element)
 Find the element in the given vector. More...
 
template<typename T , typename P >
std::vector< T >::iterator find_if (std::vector< T > &container, const P &predicate)
 Find the element matching the predicate. More...
 
template<typename T , typename P >
std::vector< T >::const_iterator find_if (std::vector< const T > &container, const P &predicate)
 Find the element matching the predicate. More...
 
template<typename C >
void usort (C &c)
 Uniquely sort and eliminate duplicates in a container. More...
 
template<typename ValueType >
ValueType * any_cast (Any *operand)
 Retrieve the value stored in an Any including type checking. More...
 
template<typename ValueType >
const ValueType * any_cast (const Any *operand)
 Retrieve the value stored in an Any including type checking. More...
 
template<typename ValueType >
ValueType any_cast (Any &operand)
 Retrieve the value stored in an Any including type checking. More...
 
template<typename ValueType >
ValueType any_cast (const Any &operand)
 Retrieve the value stored in an Any including type checking. More...
 
template<typename ValueType >
ValueType * unsafe_any_cast (Any *operand)
 Retrieve the value stored in an Any without type checking. More...
 
template<typename ValueType >
const ValueType * unsafe_any_cast (const Any *operand)
 Retrieve the value stored in an Any without type checking. More...
 
template<typename ValueType >
ValueType unsafe_any_cast (Any &operand)
 Retrieve the value stored in an Any without type checking. More...
 
template<typename ValueType >
ValueType unsafe_any_cast (const Any &operand)
 Retrieve the value stored in an Any without type checking. More...
 
template<class TypeList , class Archive >
void registerTypelist (Archive &ar)
 Registers the types from the given type list for serializing it inside a lunchbox::Any through the given archive.
 
template<class Archive , class Object , class Stream >
void serializeAny (Object &object, Stream &stream)
 Serializes the given object which can be a lunchbox::Any through the given archive type to/from the given stream.
 
template<class Archive , class Object , class Stream >
void saveAny (Object &object, Stream &stream)
 Saves the given object which can be a lunchbox::Any through the given archive type to/from the given stream.
 
template<class Archive , class Object , class Stream >
void loadAny (Object &object, Stream &stream)
 Loads the given object which can be a lunchbox::Any through the given archive type to/from the given stream.
 
template<class T >
std::ostream & operator<< (std::ostream &os, const Array< T > &array)
 Pretty-print all members of the array. More...
 
void memoryBarrier ()
 Perform a full memory barrier. More...
 
void memoryBarrierAcquire ()
 Perform a load-with-acquire memory barrier. More...
 
void memoryBarrierRelease ()
 Perform a store-with-release memory barrier. More...
 
template<class T >
int32_t getIndexOfLastBit (T value)
 
template<class T >
void byteswap (T &value)
 Swap the byte order of the given value. More...
 
bool daemonize ()
 Turn the calling process into a daemon. More...
 
void abort (bool dumpThreads=false)
 
void checkHeap ()
 
std::ostream & sysError (std::ostream &os)
 Print a textual description of the current system error. More...
 
std::string sysError ()
 
std::string backtrace (const size_t skipFrames)
 Get the current call stack. More...
 
std::ostream & backtrace (std::ostream &os)
 Print the current call stack. More...
 
std::string demangleTypeID (const char *mangled)
 
template<class T >
std::string className (const T *object)
 Print the RTTI name of the given class. More...
 
template<class T >
std::string className (const T &object)
 Print the RTTI name of the given class. More...
 
template<class T >
std::string format (const T *data, const size_t num)
 Format the given array in a human-readable form. More...
 
template<>
std::string format (const uint8_t *data, const size_t num)
 
template<>
std::string format (const void *data, const size_t num)
 
template<class T >
std::string format (const std::vector< T > &data)
 
Strings searchDirectory (const std::string &directory, const std::string &pattern)
 Retrieve a list of files in a directory matching a boost::regex pattern. More...
 
std::string getFilename (const std::string &filename)
 
std::string getDirname (const std::string &filename)
 
std::string getExecutableDir ()
 Get the absolute directory of the current executable. More...
 
std::string getExecutablePath ()
 
std::string getWorkDir ()
 
std::string getRootDir ()
 Get the absolute path to the root directory of the current executable. More...
 
std::string getRootPath ()
 
std::string getLibraryPath ()
 
Strings getLibraryPaths ()
 
bool saveBinary (const servus::Serializable &object, const std::string &filename)
 Save binary to file. More...
 
bool loadBinary (servus::Serializable &object, const std::string &filename)
 Load from binary file. More...
 
bool saveAscii (const servus::Serializable &object, const std::string &filename)
 Save ascii (JSON) to file. More...
 
bool loadAscii (servus::Serializable &object, const std::string &filename)
 Load from ascii (JSON) file. More...
 
bool init (const int argc, char **argv)
 Initialize the Lunchbox base classes. More...
 
bool exit ()
 De-initialize the Lunchbox base classes. More...
 
template<class T >
std::ostream & operator<< (std::ostream &os, const LFVector< T > &v)
 Output the vector and up to 256 items to the ostream. More...
 
template<class D , class L >
std::ostream & operator<< (std::ostream &os, const Lockable< D, L > &l)
 Print the data to the given output stream. More...
 
std::ostream & indent (std::ostream &os)
 Increases the indentation level of the Log stream, causing subsequent lines to be intended by four characters. More...
 
std::ostream & exdent (std::ostream &os)
 Decrease the indentation level of the Log stream. More...
 
std::ostream & disableFlush (std::ostream &os)
 Disable flushing of the Log stream. More...
 
std::ostream & enableFlush (std::ostream &os)
 Re-enable flushing of the Log stream. More...
 
std::ostream & forceFlush (std::ostream &os)
 Flush the Log stream regardless of the auto-flush state. More...
 
std::ostream & disableHeader (std::ostream &os)
 Disable printing of the Log header for subsequent lines. More...
 
std::ostream & enableHeader (std::ostream &os)
 Re-enable printing of the Log header. More...
 
std::ostream & startBlock (std::ostream &os)
 Indent, disable flush and header for block printing. More...
 
std::ostream & stopBlock (std::ostream &os)
 Exdent, denable flush and header to stop block print. More...
 
std::ostream & operator<< (std::ostream &os, const MemoryMap &m)
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const Monitor< T > &monitor)
 Print the monitor to the given output stream. More...
 
static void setZero (void *ptr, const size_t size)
 OS-independent call to bzero(3). More...
 
std::string getHostname ()
 
template<class T >
void perThreadDelete (T *object)
 Default PerThread destructor deleting the object. More...
 
template<class T >
void perThreadNoDelete (T *)
 Empty PerThread destructor. More...
 
Future< bool > makeTrueFuture ()
 
Future< bool > makeFalseFuture ()
 
template<class T >
std::ostream & operator<< (std::ostream &os, RefPtr< T > rp)
 Print the reference pointer to the given output stream. More...
 
template<class T >
std::string className (const RefPtr< T > &rp)
 
std::ostream & operator<< (std::ostream &, const RequestHandler &)
 
std::ostream & operator<< (std::ostream &os, const Result &result)
 
void sleep (const uint32_t milliSeconds)
 Sleep the current thread for a number of milliseconds. More...
 
std::ostream & operator<< (std::ostream &, const Thread::Affinity)
 Output the affinity setting in human-readable form. More...
 
std::ostream & operator<< (std::ostream &, const ThreadID &)
 Print the thread to the given output stream. More...
 
std::ostream & operator<< (std::ostream &os, const VisitorResult &result)
 

Detailed Description

Abstraction layer and common utilities for multi-threaded programming.

Lunchbox provides C++ classes to abstract the underlying operating system and to implement common utilities for multi-threaded C++ programs. Classes with non-virtual destructors are not intended to be subclassed.

Typedef Documentation

typedef std::vector< DSO* > lunchbox::DSOs

A vector of DSO.

Version
1.11.0

Definition at line 248 of file types.h.

typedef Future< bool > lunchbox::f_bool_t

A boolean future.

A future with a boolean return value.

Definition at line 123 of file future.h.

typedef boost::mpl::list< int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, float, double, bool, std::string, servus::uint128_t > lunchbox::podTypes

List of supported POD types for lunchbox::Any serialization.

Definition at line 49 of file anySerialization.h.

A scoped mutex for a write operation on a condition.

Version
1.3.6

Definition at line 126 of file scopedMutex.h.

A scoped mutex for a fast uncontended read operation.

Version
1.1.2

Definition at line 114 of file scopedMutex.h.

A scoped mutex for a fast uncontended write operation.

Version
1.1.2

Definition at line 117 of file scopedMutex.h.

A scoped mutex for a read operation.

Version
1.1.5

Definition at line 120 of file scopedMutex.h.

typedef ScopedMutex< Lock, WriteOp > lunchbox::ScopedWrite

A scoped mutex for a write operation.

Version
1.1.5

Definition at line 123 of file scopedMutex.h.

typedef std::vector< std::string > lunchbox::Strings

A vector of std::strings.

Version
1.0

Definition at line 215 of file types.h.

Enumeration Type Documentation

The logging levels.

Version
1.0
Enumerator
LOG_ERROR 

Output critical errors and warnings.

LOG_WARN 
Deprecated:
LOG_INFO 

Output informational messages.

LOG_DEBUG 

Output debugging information.

LOG_VERB 

Be noisy.

Definition at line 43 of file log.h.

The logging topics.

Version
1.0
Enumerator
LOG_EXCEPTION 

Log exception within LBTHROW.

LOG_BUG 

Log potential bugs.

LOG_CUSTOM 

Log topics for other namespaces start here.

LOG_ANY 

Log all Lunchbox topics.

Definition at line 54 of file log.h.

The result code from any visit operation.

Enumerator
TRAVERSE_CONTINUE 

continue the traversal

TRAVERSE_TERMINATE 

abort the traversal

TRAVERSE_PRUNE 

do not traverse current entity downwards

Definition at line 29 of file visitorResult.h.

Function Documentation

template<typename ValueType >
ValueType* lunchbox::any_cast ( Any operand)

Retrieve the value stored in an Any including type checking.

Returns
the value stored in the given Any, 0 if types are not matching
Version
1.5.0

Definition at line 235 of file any.h.

References lunchbox::Any::type().

+ Here is the call graph for this function:

template<typename ValueType >
const ValueType* lunchbox::any_cast ( const Any operand)
inline

Retrieve the value stored in an Any including type checking.

Returns
the value stored in the given Any, 0 if types are not matching
Version
1.5.0

Definition at line 254 of file any.h.

References lunchbox::Any::any_cast.

template<typename ValueType >
ValueType lunchbox::any_cast ( Any operand)

Retrieve the value stored in an Any including type checking.

Returns
the value stored in the given Any
Exceptions
bad_any_castif types are not matching
Version
1.5.0

Definition at line 267 of file any.h.

References lunchbox::Any::any_cast, and lunchbox::Any::type().

+ Here is the call graph for this function:

template<typename ValueType >
ValueType lunchbox::any_cast ( const Any operand)
inline

Retrieve the value stored in an Any including type checking.

Returns
the value stored in the given Any
Exceptions
bad_any_castif types are not matching
Version
1.5.0

Definition at line 287 of file any.h.

References lunchbox::Any::any_cast.

std::string lunchbox::backtrace ( const size_t  skipFrames)

Get the current call stack.

May not be implemented on all platforms.

Parameters
skipFramesthe number of most recent stack frames to ignore.
Version
1.9.1

Referenced by lunchbox::Referenced::ref().

+ Here is the caller graph for this function:

std::ostream& lunchbox::backtrace ( std::ostream &  os)

Print the current call stack.

Version
1.0
template<class T >
std::string lunchbox::className ( const T *  object)
inline

Print the RTTI name of the given class.

Version
1.0

Definition at line 74 of file debug.h.

Referenced by format(), lunchbox::PerThread< T, D >::operator*(), lunchbox::RefPtr< FutureImpl< void > >::operator*(), lunchbox::RefPtr< FutureImpl< void > >::operator->(), and operator<<().

+ Here is the caller graph for this function:

template<class T >
std::string lunchbox::className ( const T &  object)
inline

Print the RTTI name of the given class.

Version
1.0

Definition at line 78 of file debug.h.

bool lunchbox::daemonize ( )
inline

Turn the calling process into a daemon.

Only the forked child process returns from this function. A new session is created and the standard file descriptors are closed. The current working directory is unchanged, and the Log output is not redirected to a file.

Returns
true on success, false on error.
Version
1.5.1

Definition at line 39 of file daemon.h.

References exit(), LBWARN, and sysError().

+ Here is the call graph for this function:

std::ostream& lunchbox::disableFlush ( std::ostream &  os)

Disable flushing of the Log stream.

Version
1.0

Referenced by lunchbox::Referenced::getRefCount(), operator<<(), and startBlock().

+ Here is the caller graph for this function:

std::ostream& lunchbox::disableHeader ( std::ostream &  os)

Disable printing of the Log header for subsequent lines.

Version
1.0

Referenced by lunchbox::Referenced::getRefCount(), and startBlock().

+ Here is the caller graph for this function:

std::ostream& lunchbox::enableFlush ( std::ostream &  os)

Re-enable flushing of the Log stream.

Version
1.0

Referenced by lunchbox::Referenced::getRefCount(), operator<<(), and stopBlock().

+ Here is the caller graph for this function:

std::ostream& lunchbox::enableHeader ( std::ostream &  os)

Re-enable printing of the Log header.

Version
1.0

Referenced by lunchbox::Referenced::getRefCount(), and stopBlock().

+ Here is the caller graph for this function:

std::ostream& lunchbox::exdent ( std::ostream &  os)

Decrease the indentation level of the Log stream.

Version
1.0

Referenced by stopBlock().

+ Here is the caller graph for this function:

bool lunchbox::exit ( )

De-initialize the Lunchbox base classes.

Returns
true if the library was successfully de-initialised, false otherwise
Version
1.0

Referenced by daemonize(), and lunchbox::Thread::init().

+ Here is the caller graph for this function:

template<typename T >
std::vector< T >::iterator lunchbox::find ( std::vector< T > &  container,
const T &  element 
)

Find the element in the given vector.

Version
1.0

Definition at line 43 of file algorithm.h.

template<typename T >
std::vector< T >::const_iterator lunchbox::find ( const std::vector< T > &  container,
const T &  element 
)

Find the element in the given vector.

Version
1.0

Definition at line 48 of file algorithm.h.

template<typename T , typename P >
std::vector< T >::iterator lunchbox::find_if ( std::vector< T > &  container,
const P &  predicate 
)

Find the element matching the predicate.

Version
1.0

Definition at line 53 of file algorithm.h.

template<typename T , typename P >
std::vector<T>::const_iterator lunchbox::find_if ( std::vector< const T > &  container,
const P &  predicate 
)

Find the element matching the predicate.

Version
1.0

Definition at line 58 of file algorithm.h.

std::ostream& lunchbox::forceFlush ( std::ostream &  os)

Flush the Log stream regardless of the auto-flush state.

Version
1.0
template<class T >
std::string lunchbox::format ( const T *  data,
const size_t  num 
)
inline

Format the given array in a human-readable form.

Depending on the data type, a different formatting may be used.

Parameters
dataThe pointer to the data to print.
numThe number of elements of T to print, for T==void the number of bytes.
Version
1.9.1

Definition at line 93 of file debug.h.

References className().

Referenced by operator<<().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string lunchbox::getDirname ( const std::string &  filename)
Returns
the directory name part of a path.
Version
1.0
std::string lunchbox::getExecutableDir ( )

Get the absolute directory of the current executable.

On Mac OS X, this returns the path to the app bundle, i.e., the directory where the Foo.app is located, not Foo.app/Contents/MacOS.

Returns
the absolute directory of the current executable.
Version
1.11

Referenced by getExecutablePath().

+ Here is the caller graph for this function:

std::string lunchbox::getExecutablePath ( )
inline
Deprecated:

Definition at line 61 of file file.h.

References getExecutableDir(), getRootDir(), and getWorkDir().

+ Here is the call graph for this function:

std::string lunchbox::getFilename ( const std::string &  filename)
Returns
the file name part of a path.
Version
1.0
std::string lunchbox::getHostname ( )
Returns
the local hostname.
Version
1.9.2

Referenced by setZero().

+ Here is the caller graph for this function:

std::string lunchbox::getLibraryPath ( )
Returns
the absolute path to the libraries of the current executable.
Version
1.11

Referenced by getRootPath().

+ Here is the caller graph for this function:

Strings lunchbox::getLibraryPaths ( )
Returns
the search paths to libraries of the current executable.
Version
1.11

Referenced by getRootPath().

+ Here is the caller graph for this function:

std::string lunchbox::getRootDir ( )

Get the absolute path to the root directory of the current executable.

On all platforms, this returns the root directory of the installation/distribution of the current executable. Can be empty, if getExecutableDir() is empty.

On Linux and Mac OS X, this returns the directory one level up of getExecutableDir(). On Windows, this returns the directory one or two levels up of getExecutableDir(), depending if ${BuildType} is in the path.

Returns
the absolute root directory of the current executable.
Version
1.12

Referenced by getExecutablePath(), and getRootPath().

+ Here is the caller graph for this function:

std::string lunchbox::getRootPath ( )
inline
Deprecated:

Definition at line 85 of file file.h.

References getLibraryPath(), getLibraryPaths(), getRootDir(), loadAscii(), loadBinary(), saveAscii(), and saveBinary().

+ Here is the call graph for this function:

std::string lunchbox::getWorkDir ( )
Returns
the absolute directory of the current working directory
Version
1.14

Referenced by getExecutablePath().

+ Here is the caller graph for this function:

std::ostream& lunchbox::indent ( std::ostream &  os)

Increases the indentation level of the Log stream, causing subsequent lines to be intended by four characters.

Version
1.0

Referenced by startBlock().

+ Here is the caller graph for this function:

bool lunchbox::init ( const int  argc,
char **  argv 
)

Initialize the Lunchbox base classes.

exit() should be called independent of the return value of this function. The following arguments are parsed:

  • -v[v]: Increase log verbosity
  • –lb-logfile [filename]: redirect log to the given file or to ApplicationName.log
Parameters
argcthe command line argument count.
argvthe command line argument values.
Returns
true if the library was successfully initialised, false otherwise
Version
1.0
bool lunchbox::loadAscii ( servus::Serializable &  object,
const std::string &  filename 
)

Load from ascii (JSON) file.

Returns
true on success, false otherwise.

Referenced by getRootPath().

+ Here is the caller graph for this function:

bool lunchbox::loadBinary ( servus::Serializable &  object,
const std::string &  filename 
)

Load from binary file.

Returns
true on success, false otherwise.

Referenced by getRootPath().

+ Here is the caller graph for this function:

Future< bool > lunchbox::makeFalseFuture ( )
inline
Returns
a boolean future being false.

Definition at line 39 of file readyFuture.h.

Future< bool > lunchbox::makeTrueFuture ( )
inline
Returns
a boolean future being true.

Definition at line 35 of file readyFuture.h.

void lunchbox::memoryBarrier ( )
inline

Perform a full memory barrier.

Definition at line 38 of file atomic.h.

Referenced by memoryBarrierAcquire(), memoryBarrierRelease(), lunchbox::Atomic< T >::operator!=(), lunchbox::Atomic< T >::operator=(), and lunchbox::Atomic< T >::operator==().

+ Here is the caller graph for this function:

void lunchbox::memoryBarrierAcquire ( )
inline

Perform a load-with-acquire memory barrier.

Definition at line 54 of file atomic.h.

References memoryBarrier().

Referenced by lunchbox::Atomic< T >::addAndGet(), lunchbox::Atomic< T >::getAndAdd(), lunchbox::Atomic< T >::getAndSub(), lunchbox::Atomic< T >::operator T(), and lunchbox::Atomic< T >::subAndGet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void lunchbox::memoryBarrierRelease ( )
inline

Perform a store-with-release memory barrier.

Definition at line 65 of file atomic.h.

References memoryBarrier().

Referenced by lunchbox::Atomic< T >::addAndGet(), lunchbox::Atomic< T >::getAndAdd(), lunchbox::Atomic< T >::getAndSub(), and lunchbox::Atomic< T >::subAndGet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T >
std::ostream& lunchbox::operator<< ( std::ostream &  os,
const Array< T > &  array 
)
inline

Pretty-print all members of the array.

Version
1.9.1

Definition at line 47 of file array.h.

References format().

Referenced by lunchbox::MemoryMap::getAddress(), lunchbox::Result::getString(), lunchbox::Thread::init(), and lunchbox::RequestHandler::registerRequest().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class D , class L >
std::ostream& lunchbox::operator<< ( std::ostream &  os,
const Lockable< D, L > &  l 
)
inline

Print the data to the given output stream.

Definition at line 68 of file lockable.h.

References disableFlush(), and enableFlush().

+ Here is the call graph for this function:

std::ostream& lunchbox::operator<< ( std::ostream &  ,
const ThreadID  
)

Print the thread to the given output stream.

template<class T >
std::ostream& lunchbox::operator<< ( std::ostream &  os,
RefPtr< T >  rp 
)
inline

Print the reference pointer to the given output stream.

Definition at line 182 of file refPtr.h.

References className(), disableFlush(), enableFlush(), and lunchbox::RefPtr< T >::get().

+ Here is the call graph for this function:

std::ostream& lunchbox::operator<< ( std::ostream &  ,
const Thread::Affinity   
)

Output the affinity setting in human-readable form.

Version
1.7.1
template<class T >
std::ostream & lunchbox::operator<< ( std::ostream &  os,
const LFVector< T > &  v 
)

Output the vector and up to 256 items to the ostream.

Version
0.1

Definition at line 423 of file lfVector.ipp.

References className().

+ Here is the call graph for this function:

template<typename T >
std::ostream& lunchbox::operator<< ( std::ostream &  os,
const Monitor< T > &  monitor 
)
inline

Print the monitor to the given output stream.

Version
1.0

Definition at line 423 of file monitor.h.

References lunchbox::Condition::broadcast(), lunchbox::Monitor< T >::get(), lunchbox::Monitor< T >::Monitor(), lunchbox::Monitor< T >::operator++(), lunchbox::Monitor< T >::operator--(), and lunchbox::Monitor< T >::operator|=().

+ Here is the call graph for this function:

template<class T >
void lunchbox::perThreadDelete ( T *  object)

Default PerThread destructor deleting the object.

Version
1.1.2

Definition at line 30 of file perThread.h.

template<class T >
void lunchbox::perThreadNoDelete ( T *  )

Empty PerThread destructor.

Version
1.1.2

Definition at line 33 of file perThread.h.

bool lunchbox::saveAscii ( const servus::Serializable &  object,
const std::string &  filename 
)

Save ascii (JSON) to file.

Returns
true on success, false otherwise.

Referenced by getRootPath().

+ Here is the caller graph for this function:

bool lunchbox::saveBinary ( const servus::Serializable &  object,
const std::string &  filename 
)

Save binary to file.

Returns
true on success, false otherwise.

Referenced by getRootPath().

+ Here is the caller graph for this function:

Strings lunchbox::searchDirectory ( const std::string &  directory,
const std::string &  pattern 
)

Retrieve a list of files in a directory matching a boost::regex pattern.

Returns
all file names matching the given pattern in the given directory.
Version
1.0
1.7.1 using boost::regex for matching

Referenced by lunchbox::PluginFactory< T >::load().

+ Here is the caller graph for this function:

static void lunchbox::setZero ( void *  ptr,
const size_t  size 
)
inlinestatic

OS-independent call to bzero(3).

Version
1.7.1

Definition at line 74 of file os.h.

References getHostname().

Referenced by lunchbox::LFVector< T, nSlots >::getWriteLock(), and lunchbox::LFVector< T, nSlots >::LFVector().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void lunchbox::sleep ( const uint32_t  milliSeconds)

Sleep the current thread for a number of milliseconds.

Version
1.0
Deprecated:
Use boost::this_thread::sleep()
std::ostream& lunchbox::startBlock ( std::ostream &  os)
inline

Indent, disable flush and header for block printing.

Version
1.9.1

Definition at line 178 of file log.h.

References disableFlush(), disableHeader(), and indent().

+ Here is the call graph for this function:

std::ostream& lunchbox::stopBlock ( std::ostream &  os)
inline

Exdent, denable flush and header to stop block print.

Version
1.9.1

Definition at line 181 of file log.h.

References enableFlush(), enableHeader(), and exdent().

+ Here is the call graph for this function:

std::ostream& lunchbox::sysError ( std::ostream &  os)

Print a textual description of the current system error.

The current system error is OS-specific, e.g., errno or GetLastError().

Version
1.0

Referenced by daemonize().

+ Here is the caller graph for this function:

std::string lunchbox::sysError ( )
Returns
a textual description of the current system error.
Version
1.9.1
template<typename ValueType >
ValueType* lunchbox::unsafe_any_cast ( Any operand)
inline

Retrieve the value stored in an Any without type checking.

Returns
the value stored in the given Any
Version
1.5.0

Definition at line 301 of file any.h.

template<typename ValueType >
const ValueType* lunchbox::unsafe_any_cast ( const Any operand)
inline

Retrieve the value stored in an Any without type checking.

Returns
the value stored in the given Any
Version
1.5.0

Definition at line 314 of file any.h.

References lunchbox::Any::unsafe_any_cast.

template<typename ValueType >
ValueType lunchbox::unsafe_any_cast ( Any operand)

Retrieve the value stored in an Any without type checking.

Returns
the value stored in the given Any
Version
1.5.0

Definition at line 326 of file any.h.

References lunchbox::Any::unsafe_any_cast.

template<typename ValueType >
ValueType lunchbox::unsafe_any_cast ( const Any operand)

Retrieve the value stored in an Any without type checking.

Returns
the value stored in the given Any
Version
1.5.0

Definition at line 339 of file any.h.

References lunchbox::Any::unsafe_any_cast.

template<typename C >
void lunchbox::usort ( C &  c)

Uniquely sort and eliminate duplicates in a container.

Version
1.9.1

Definition at line 62 of file algorithm.h.

Referenced by lunchbox::PluginFactory< T >::deregisterAll(), and usort().

+ Here is the caller graph for this function: