QuantumLibrary
Bloomberg::quantum Namespace Reference

Classes

struct  Allocator
 
struct  AllocatorTraits
 Allows application-wide settings for the various allocators used by Quantum. More...
 
struct  BoostAllocator
 
struct  BrokenPromiseException
 
class  Buffer
 Container which allows buffered access to a series of values. Values are pushed-in (written) by a producer(s) and pulled-out (read) by a consumer(s). More...
 
struct  BufferClosedException
 
struct  BufferingDataException
 
class  Capture
 Class allowing lambda parameter captures. More...
 
class  ConditionVariable
 This class represents a coroutine-compatible implementation of the std::condition_variable. Most methods of the latter have been recreated with the same behavior. This object will yield instead of blocking if called from a coroutine. More...
 
class  Configuration
 
class  Context
 Concrete class representing a coroutine or a thread context. More...
 
struct  ContiguousPoolManager
 Provides fast (quasi zero-time) in-place allocation for STL containers. Objects are allocated from a contiguous buffer (aka object pool). When the buffer is exhausted, allocation is delegated to the heap. The default buffer size is 1000. More...
 
struct  CoroContextTag
 
struct  CoroutinePoolAllocator
 Provides fast (quasi zero-time) in-place allocation for coroutines. Coroutine stacks are pre-allocated from separate (i.e. non-contiguous) heap blocks and maintained in a reusable list. More...
 
struct  CoroutinePoolAllocatorProxy
 
class  Dispatcher
 Parallel execution engine used to run coroutines or IO tasks asynchronously. This class is the main entry point into the library. More...
 
class  DispatcherCore
 Class implementing the dispatching logic unto worker threads. Used for both coroutines and IO tasks. More...
 
class  Function
 Similar implementation to std::function except that it allows capture of non-copyable types. More...
 
class  Function< RET(ARGS...)>
 
struct  Functions
 Contains typedefs for various functions. More...
 
class  Future
 Class representing a promised future. Can only be instantiated via a Promise object. More...
 
struct  FutureAlreadyRetrievedException
 
struct  FutureException
 Exception thrown by a Future or Promise object during various errors. More...
 
class  FutureJoiner
 Utility class that joins N futures into a single one. More...
 
struct  HeapAllocator
 Provides a heap-based object pool to the underlying ContiguousPoolManager. The default buffer size is 1000. More...
 
interface  IContextBase
 This interface exposes shared functionality between IThreadContext and ICoroContext. More...
 
interface  ICoroContext
 Exposes methods to manipulate the coroutine context. More...
 
interface  ICoroContextBase
 Exposes methods to manipulate the coroutine context, especially future wait methods. More...
 
interface  ICoroFuture
 Exposes methods to access a coroutine-compatible future. More...
 
interface  ICoroFutureBase
 Exposes methods to access a coroutine-compatible future. More...
 
interface  ICoroPromise
 Exposes methods to access and manipulate a coroutine-compatible promise. More...
 
interface  ICoroSync
 Provides an interface to facilitate 'implicit' coroutine yielding within other primitives such as mutexes and condition variables or to allow 'explicit' cooperative yielding by the user. More...
 
class  IoQueue
 Thread queue for executing IO tasks. More...
 
class  IoTask
 Long running or blocking task running in the IO thread pool. More...
 
interface  IPromiseBase
 Exposes methods to manipulate and access a promise. More...
 
interface  IQueue
 Interface to a task queue. For internal use only. More...
 
interface  IQueueStatistics
 Interface to access and manipulate a QueueStatistics object. More...
 
interface  ITask
 Interface to a task. For internal use only. More...
 
interface  ITaskAccessor
 Interface to a task accessor. For internal use only. More...
 
interface  ITaskContinuation
 Interface to a task continuation. For internal use only. More...
 
interface  ITerminate
 Represents an object which can be terminated. This interface allows certain objects to be explicitly disposed of before their destructors are called. More...
 
interface  IThreadContext
 Exposes methods to manipulate the thread context. More...
 
interface  IThreadContextBase
 Exposes methods to manipulate the thread context, especially future wait methods. More...
 
struct  IThreadFuture
 
struct  IThreadFutureBase
 
interface  IThreadPromise
 Exposes methods to access and manipulate a non-coroutine promise (i.e. used in a thread) More...
 
class  Mutex
 Coroutine-compatible implementation of a mutex. More...
 
struct  NoStateException
 
class  Promise
 Class representing a promised value. More...
 
struct  PromiseAlreadySatisfiedException
 
struct  PromiseNotSatisfiedException
 
class  QueueStatistics
 Provides various counters related to queues and task execution. More...
 
struct  ReturnOf
 
struct  SequenceKeyData
 
class  SequenceKeyStatistics
 Implementation of a statistics collection for a SequenceKey in Sequencer. More...
 
class  SequenceKeyStatisticsWriter
 
class  Sequencer
 Implementation of a key-based task sequencing with quantum. More...
 
class  SequencerConfiguration
 Implementation of a configuration class for Sequencer. More...
 
class  SharedState
 Shared state used between a Promise and a Future to exchange values. More...
 
class  SharedState< Buffer< T > >
 
class  SpinLock
 Coroutine-compatible spinlock. Used internally for mutexes since threads running coroutines cannot block. More...
 
struct  StackAllocator
 Provides a stack-based object pool to the underlying ContiguousPoolManager. The default buffer size is 1000. More...
 
struct  StackTraits
 Allows application-wide overrides for the coroutine stack traits which are used internally by boost::coroutines2. More...
 
struct  StackTraitsProxy
 
struct  StlAllocator
 
class  Task
 Runnable object representing a coroutine. More...
 
class  TaskQueue
 Thread queue for running coroutines. More...
 
struct  ThreadContextTag
 
struct  ThreadTraits
 Allows application-wide settings for the various thread settings used by Quantum. More...
 
struct  Traits
 Contains definitions for various traits used by this library. For internal use only. More...
 
struct  Util
 Utility to bind a user callable function unto a coroutine or an IO task. More...
 
struct  YieldingThreadDuration
 This class provides the same functionality as a coroutine yield when called from a thread context. More...
 

Typedefs

using ContextAllocator = StackAllocator< Context< int >, __QUANTUM_CONTEXT_ALLOC_SIZE >
 
using FutureAllocator = StackAllocator< Future< int >, __QUANTUM_FUTURE_ALLOC_SIZE >
 
using IoTaskAllocator = StackAllocator< IoTask, __QUANTUM_IO_TASK_ALLOC_SIZE >
 
using PromiseAllocator = StackAllocator< Promise< int >, __QUANTUM_PROMISE_ALLOC_SIZE >
 
using TaskAllocator = StackAllocator< Task, __QUANTUM_TASK_ALLOC_SIZE >
 
using IContextBasePtr = IContextBase::Ptr
 
template<class RET >
using CoroContext = ICoroContext< RET >
 
template<class RET >
using CoroContextPtr = typename ICoroContext< RET >::Ptr
 
using ICoroContextBasePtr = ICoroContextBase::Ptr
 
template<class T >
using CoroFuture = ICoroFuture< T >
 
template<class T >
using CoroFuturePtr = typename ICoroFuture< T >::Ptr
 
using ICoroFutureBasePtr = ICoroFutureBase::Ptr
 
template<class T >
using CoroPromise = ICoroPromise< Promise, T >
 
template<class T >
using CoroPromisePtr = typename ICoroPromise< Promise, T >::Ptr
 
using ICoroSyncPtr = ICoroSync::Ptr
 
using IPromiseBasePtr = IPromiseBase::Ptr
 
using IQueuePtr = IQueue::Ptr
 
using QueueListAllocator = StackAllocator< ITask::Ptr, __QUANTUM_QUEUE_LIST_ALLOC_SIZE >
 
using ITaskPtr = ITask::Ptr
 
using ITaskWeakPtr = ITask::WeakPtr
 
using ITaskAccessorPtr = ITaskAccessor::Ptr
 
using ITaskContinuationPtr = ITaskContinuation::Ptr
 
using ITaskContinuationWeakPtr = ITaskContinuation::WeakPtr
 
template<class RET >
using ThreadContext = IThreadContext< RET >
 
template<class RET >
using ThreadContextPtr = typename IThreadContext< RET >::Ptr
 
using IThreadContextBasePtr = IThreadContextBase::Ptr
 
template<class T >
using ThreadFuture = IThreadFuture< T >
 
template<class T >
using ThreadFuturePtr = typename IThreadFuture< T >::Ptr
 
using IThreadFutureBasePtr = IThreadFutureBase::Ptr
 
template<class T >
using ThreadPromise = IThreadPromise< Promise, T >
 
template<class T >
using ThreadPromisePtr = typename IThreadPromise< Promise, T >::Ptr
 
template<class RET >
using ContextPtr = typename Context< RET >::Ptr
 
using TaskDispatcher = Dispatcher
 
template<class T >
using FuturePtr = typename Future< T >::Ptr
 
using IoTaskPtr = IoTask::Ptr
 
using IoTaskWeakPtr = IoTask::WeakPtr
 
template<class T >
using PromisePtr = typename Promise< T >::Ptr
 
using TaskPtr = Task::Ptr
 
using TaskWeakPtr = Task::WeakPtr
 
using CoroStackAllocator = CoroutinePoolAllocatorProxy< StackTraitsProxy >
 
template<class T , class V >
using BufferType = std::enable_if_t< Traits::IsBuffer< T >::value &&!std::is_same< std::decay_t< V >, T >::value &&std::is_convertible< std::decay_t< V >, typename Traits::IsBuffer< T >::Type >::value >
 
template<class T , class V >
using NonBufferType = std::enable_if_t<!Traits::IsBuffer< T >::value &&std::is_convertible< std::decay_t< V >, T >::value >
 
template<class T >
using BufferRetType = std::enable_if_t< Traits::IsBuffer< T >::value, typename Traits::IsBuffer< T >::Type >
 
template<class T >
using NonBufferRetType = std::enable_if_t<!Traits::IsBuffer< T >::value, typename Traits::IsBuffer< T >::Type >
 
using YieldingThread = YieldingThreadDuration< std::chrono::microseconds >
 
using StatsPtr = std::shared_ptr< SequenceKeyStatisticsWriter >
 

Enumerations

enum  BufferStatus { BufferStatus::DataReceived, BufferStatus::DataPosted, BufferStatus::DataPending, BufferStatus::Closed }
 Defines the result of the operation on the buffer object. More...
 
enum  FutureState {
  FutureState::PromiseNotSatisfied = 1, FutureState::PromiseAlreadySatisfied, FutureState::BrokenPromise, FutureState::FutureAlreadyRetrieved,
  FutureState::NoState, FutureState::BufferingData, FutureState::BufferClosed
}
 Represents the internal state of a future/promise pair. Modeled after std::future_errc. More...
 

Functions

template<typename FUNC , typename ... ARGS>
Capture< FUNC, ARGS... > makeCapture (FUNC &&func, ARGS &&... args)
 
QueueStatistics operator+ (QueueStatistics lhs, const IQueueStatistics &rhs)
 
std::ostream & operator<< (std::ostream &out, const IQueueStatistics &stats)
 Overloads stream operator for IQueueStatistics object. More...
 
template<typename RET , typename FUNC , typename... ARGS, size_t... I, typename... T>
RET apply_impl (FUNC &&func, std::tuple< ARGS... > &&tuple, std::index_sequence< I... >, T &&...t)
 
template<typename RET , typename FUNC , typename... ARGS, typename... T>
RET apply (FUNC &&func, std::tuple< ARGS... > &&tuple, T &&...t)
 
void ThrowFutureException (FutureState state)
 
template<typename RET , typename CAPTURE >
int bindCoro (Traits::Yield &yield, std::shared_ptr< CoroContext< RET >> ctx, CAPTURE &&capture)
 
template<typename RET , typename CAPTURE >
int bindIo (std::shared_ptr< Promise< RET >> promise, CAPTURE &&capture)
 

Typedef Documentation

◆ BufferRetType

template<class T >
using Bloomberg::quantum::BufferRetType = typedef std::enable_if_t<Traits::IsBuffer<T>::value, typename Traits::IsBuffer<T>::Type>

◆ BufferType

template<class T , class V >
using Bloomberg::quantum::BufferType = typedef std::enable_if_t<Traits::IsBuffer<T>::value && !std::is_same<std::decay_t<V>,T>::value && std::is_convertible<std::decay_t<V>, typename Traits::IsBuffer<T>::Type>::value>

◆ ContextAllocator

using Bloomberg::quantum::ContextAllocator = typedef StackAllocator<Context<int>, __QUANTUM_CONTEXT_ALLOC_SIZE>

◆ ContextPtr

template<class RET >
using Bloomberg::quantum::ContextPtr = typedef typename Context<RET>::Ptr

◆ CoroContext

template<class RET >
using Bloomberg::quantum::CoroContext = typedef ICoroContext<RET>

◆ CoroContextPtr

template<class RET >
using Bloomberg::quantum::CoroContextPtr = typedef typename ICoroContext<RET>::Ptr

◆ CoroFuture

template<class T >
using Bloomberg::quantum::CoroFuture = typedef ICoroFuture<T>

◆ CoroFuturePtr

template<class T >
using Bloomberg::quantum::CoroFuturePtr = typedef typename ICoroFuture<T>::Ptr

◆ CoroPromise

template<class T >
using Bloomberg::quantum::CoroPromise = typedef ICoroPromise<Promise,T>

◆ CoroPromisePtr

template<class T >
using Bloomberg::quantum::CoroPromisePtr = typedef typename ICoroPromise<Promise,T>::Ptr

◆ CoroStackAllocator

◆ FutureAllocator

using Bloomberg::quantum::FutureAllocator = typedef StackAllocator<Future<int>, __QUANTUM_FUTURE_ALLOC_SIZE>

◆ FuturePtr

template<class T >
using Bloomberg::quantum::FuturePtr = typedef typename Future<T>::Ptr

◆ IContextBasePtr

◆ ICoroContextBasePtr

◆ ICoroFutureBasePtr

◆ ICoroSyncPtr

◆ IoTaskAllocator

using Bloomberg::quantum::IoTaskAllocator = typedef StackAllocator<IoTask, __QUANTUM_IO_TASK_ALLOC_SIZE>

◆ IoTaskPtr

◆ IoTaskWeakPtr

◆ IPromiseBasePtr

◆ IQueuePtr

◆ ITaskAccessorPtr

◆ ITaskContinuationPtr

◆ ITaskContinuationWeakPtr

◆ ITaskPtr

◆ ITaskWeakPtr

◆ IThreadContextBasePtr

◆ IThreadFutureBasePtr

◆ NonBufferRetType

template<class T >
using Bloomberg::quantum::NonBufferRetType = typedef std::enable_if_t<!Traits::IsBuffer<T>::value, typename Traits::IsBuffer<T>::Type>

◆ NonBufferType

template<class T , class V >
using Bloomberg::quantum::NonBufferType = typedef std::enable_if_t<!Traits::IsBuffer<T>::value && std::is_convertible<std::decay_t<V>,T>::value>

◆ PromiseAllocator

using Bloomberg::quantum::PromiseAllocator = typedef StackAllocator<Promise<int>, __QUANTUM_PROMISE_ALLOC_SIZE>

◆ PromisePtr

template<class T >
using Bloomberg::quantum::PromisePtr = typedef typename Promise<T>::Ptr

◆ QueueListAllocator

using Bloomberg::quantum::QueueListAllocator = typedef StackAllocator<ITask::Ptr, __QUANTUM_QUEUE_LIST_ALLOC_SIZE>

◆ StatsPtr

◆ TaskAllocator

using Bloomberg::quantum::TaskAllocator = typedef StackAllocator<Task, __QUANTUM_TASK_ALLOC_SIZE>

◆ TaskDispatcher

◆ TaskPtr

◆ TaskWeakPtr

◆ ThreadContext

template<class RET >
using Bloomberg::quantum::ThreadContext = typedef IThreadContext<RET>

◆ ThreadContextPtr

template<class RET >
using Bloomberg::quantum::ThreadContextPtr = typedef typename IThreadContext<RET>::Ptr

◆ ThreadFuture

template<class T >
using Bloomberg::quantum::ThreadFuture = typedef IThreadFuture<T>

◆ ThreadFuturePtr

template<class T >
using Bloomberg::quantum::ThreadFuturePtr = typedef typename IThreadFuture<T>::Ptr

◆ ThreadPromise

template<class T >
using Bloomberg::quantum::ThreadPromise = typedef IThreadPromise<Promise,T>

◆ ThreadPromisePtr

template<class T >
using Bloomberg::quantum::ThreadPromisePtr = typedef typename IThreadPromise<Promise,T>::Ptr

◆ YieldingThread

using Bloomberg::quantum::YieldingThread = typedef YieldingThreadDuration<std::chrono::microseconds>

Enumeration Type Documentation

◆ BufferStatus

Defines the result of the operation on the buffer object.

Enumerator
DataReceived 

Data has been successfully read from the buffer.

DataPosted 

Data has been successfully written to the buffer.

DataPending 

Buffer is empty and more data is on the way.

Closed 

Buffer is closed. Push operations are not allowed. Pull operations are allowed until buffer is emtpy.

◆ FutureState

Represents the internal state of a future/promise pair. Modeled after std::future_errc.

Enumerator
PromiseNotSatisfied 

Future value has not yet been set.

PromiseAlreadySatisfied 

Future value has been set but not yet consumed.

BrokenPromise 

Promise could not be fulfilled.

FutureAlreadyRetrieved 

Future value has been consumed. In the case of a buffer, no pulling is allowed.

NoState 

Shared state between Promise and Future is invalid.

BufferingData 

Buffered future is being streamed.

BufferClosed 

Buffer is closed for pushing data. Data can still be pulled.

Function Documentation

◆ apply()

template<typename RET , typename FUNC , typename... ARGS, typename... T>
RET Bloomberg::quantum::apply ( FUNC &&  func,
std::tuple< ARGS... > &&  tuple,
T &&...  t 
)

◆ apply_impl()

template<typename RET , typename FUNC , typename... ARGS, size_t... I, typename... T>
RET Bloomberg::quantum::apply_impl ( FUNC &&  func,
std::tuple< ARGS... > &&  tuple,
std::index_sequence< I... >  ,
T &&...  t 
)

◆ bindCoro()

template<typename RET , typename CAPTURE >
int Bloomberg::quantum::bindCoro ( Traits::Yield yield,
std::shared_ptr< CoroContext< RET >>  ctx,
CAPTURE &&  capture 
)

◆ bindIo()

template<typename RET , typename CAPTURE >
int Bloomberg::quantum::bindIo ( std::shared_ptr< Promise< RET >>  promise,
CAPTURE &&  capture 
)

◆ makeCapture()

template<typename FUNC , typename ... ARGS>
Capture< FUNC, ARGS... > Bloomberg::quantum::makeCapture ( FUNC &&  func,
ARGS &&...  args 
)

◆ operator+()

QueueStatistics Bloomberg::quantum::operator+ ( QueueStatistics  lhs,
const IQueueStatistics rhs 
)
inline

◆ operator<<()

std::ostream & Bloomberg::quantum::operator<< ( std::ostream &  out,
const IQueueStatistics stats 
)
inline

Overloads stream operator for IQueueStatistics object.

Parameters
[in]outOutput stream.
[in]statsStatistics object to stream.
Returns
Reference to the same input stream.

◆ ThrowFutureException()

void Bloomberg::quantum::ThrowFutureException ( FutureState  state)
inline