RoveComm C++ 3.0.0
Welcome to the RoveComm C++ repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of RoveComm C++. The RoveComm C++ project is the RoveComm interface for high level systems and should not be used for microcontrollers.
Loading...
Searching...
No Matches
BS Namespace Reference

A namespace used by Barak Shoshany's projects. More...

Classes

struct  version
 A struct used to store a version number, which can be checked and compared at compilation time. More...
class  thread_pool
 A fast, lightweight, modern, and easy-to-use C++17/C++20/C++23 thread pool class. More...
class  move_only_function
class  move_only_function< R(Args...)>
 A simple polyfill for std::move_only_function, to be used if C++23 features are not available. Note that it does not have all the features of std::move_only_function, only the minimum needed for the thread pool library. More...
struct  pr_task
 A helper struct to store a task with an assigned priority. More...
class  multi_future
 A helper class to facilitate waiting for and/or getting the results of multiple futures at once. More...
class  blocks
 A helper class to divide a range into blocks. Used by detach_blocks(), submit_blocks(), detach_loop(), and submit_loop(). More...
struct  block_task
 A function object class used by detach_blocks() and submit_blocks() to execute a block function over a specified range of indices. More...
struct  loop_task
 A function object class used by detach_loop() and submit_loop() to execute a loop function over a specified range of indices. More...
struct  sequence_task
 A function object class used by detach_sequence() and submit_sequence() to execute a sequence function over a specified index. More...
struct  task_and_future
 A class that takes a function with a return value (but no arguments), and constructs a task with no return value along with a future used to retrieve the function's return value once the task is executed. Used by submit_task() and submit_bulk(). More...
class  this_thread
 A class used to obtain information about the current thread and, if native extensions are enabled, get/set its priority, affinity, or name. More...
struct  common_index_type
 A meta-programming template to determine the common type of two integer types. Unlike std::common_type, this template maintains correct signedness. More...
struct  common_index_type< T1, T2, std::enable_if_t< std::is_signed_v< T1 > &&std::is_signed_v< T2 > > >
struct  common_index_type< T1, T2, std::enable_if_t< std::is_unsigned_v< T1 > &&std::is_unsigned_v< T2 > > >
struct  common_index_type< T1, T2, std::enable_if_t<(std::is_signed_v< T1 > &&std::is_unsigned_v< T2 >)||(std::is_unsigned_v< T1 > &&std::is_signed_v< T2 >)> >
class  synced_stream
 A utility class to synchronize printing to one or more output streams by different threads. More...

Typedefs

using opt_t = std::uint8_t
 The type used for the bitmask template parameter of the thread pool.
using task_t = move_only_function<void()>
 The type of tasks in the task queue.
using thread_t = std::thread
 The type of threads to use. In C++17 we use std::thread.
using priority_t = std::int8_t
 A type used to indicate the priority of a task. Defined to be a signed integer with a width of exactly 8 bits (-128 to +127).
template<typename T1, typename T2>
using common_index_type_t = typename common_index_type<T1, T2>::type
 A helper type alias to obtain the common type from the template BS::common_index_type.
using light_thread_pool = thread_pool<tp::none>
 A fast, lightweight, modern, and easy-to-use C++17/C++20/C++23 thread pool class. This alias defines a thread pool with all optional features disabled.
using priority_thread_pool = thread_pool<tp::priority>
 A fast, lightweight, modern, and easy-to-use C++17/C++20/C++23 thread pool class. This alias defines a thread pool with task priority enabled.
using pause_thread_pool = thread_pool<tp::pause>
 A fast, lightweight, modern, and easy-to-use C++17/C++20/C++23 thread pool class. This alias defines a thread pool with pausing enabled.
using wdc_thread_pool = thread_pool<tp::wait_deadlock_checks>
 A fast, lightweight, modern, and easy-to-use C++17/C++20/C++23 thread pool class. This alias defines a thread pool with wait deadlock checks enabled.

Enumerations

enum class  tp : opt_t { none = 0 , priority = 1 << 0 , pause = 1 << 1 , wait_deadlock_checks = 1 << 2 }
 An enumeration class of flags to be used in the bitmask template parameter of BS::thread_pool to enable optional features. More...
enum  pr : priority_t {
  lowest = -128 , low = -64 , normal = 0 , high = +64 ,
  highest = +127
}
 An enum containing some pre-defined priorities for convenience. More...

Functions

constexpr version thread_pool_version (BS_THREAD_POOL_VERSION_MAJOR, BS_THREAD_POOL_VERSION_MINOR, BS_THREAD_POOL_VERSION_PATCH)
 The version of the thread pool library.
constexpr tp operator~ (const tp value) noexcept

Variables

constexpr bool thread_pool_module = false
 A flag indicating whether the thread pool library was compiled as a C++20 module.
constexpr bool thread_pool_import_std = false
 A flag indicating whether the thread pool library imported the C++23 Standard Library module using import std.
constexpr bool thread_pool_native_extensions = false
 A flag indicating whether the thread pool library's native extensions are enabled.

Detailed Description

A namespace used by Barak Shoshany's projects.

Typedef Documentation

◆ common_index_type_t

template<typename T1, typename T2>
using BS::common_index_type_t = typename common_index_type<T1, T2>::type

A helper type alias to obtain the common type from the template BS::common_index_type.

Template Parameters
T1The first type.
T2The second type.

◆ light_thread_pool

A fast, lightweight, modern, and easy-to-use C++17/C++20/C++23 thread pool class. This alias defines a thread pool with all optional features disabled.

◆ opt_t

using BS::opt_t = std::uint8_t

The type used for the bitmask template parameter of the thread pool.

◆ pause_thread_pool

A fast, lightweight, modern, and easy-to-use C++17/C++20/C++23 thread pool class. This alias defines a thread pool with pausing enabled.

◆ priority_t

using BS::priority_t = std::int8_t

A type used to indicate the priority of a task. Defined to be a signed integer with a width of exactly 8 bits (-128 to +127).

◆ priority_thread_pool

A fast, lightweight, modern, and easy-to-use C++17/C++20/C++23 thread pool class. This alias defines a thread pool with task priority enabled.

◆ task_t

using BS::task_t = move_only_function<void()>

The type of tasks in the task queue.

◆ thread_t

using BS::thread_t = std::thread

The type of threads to use. In C++17 we use std::thread.

◆ wdc_thread_pool

A fast, lightweight, modern, and easy-to-use C++17/C++20/C++23 thread pool class. This alias defines a thread pool with wait deadlock checks enabled.

Enumeration Type Documentation

◆ pr

An enum containing some pre-defined priorities for convenience.

Enumerator
lowest 
low 
normal 
high 
highest 
398{
399 lowest = -128,
400 low = -64,
401 normal = 0,
402 high = +64,
403 highest = +127
404};
@ lowest
Definition BS_thread_pool.hpp:399
@ high
Definition BS_thread_pool.hpp:402
@ highest
Definition BS_thread_pool.hpp:403
@ low
Definition BS_thread_pool.hpp:400
@ normal
Definition BS_thread_pool.hpp:401

◆ tp

enum class BS::tp : opt_t
strong

An enumeration class of flags to be used in the bitmask template parameter of BS::thread_pool to enable optional features.

Enumerator
none 

No optional features enabled.

priority 

Enable task priority.

pause 

Enable pausing.

wait_deadlock_checks 

Enable wait deadlock checks.

250{
254 none = 0,
255
259 priority = 1 << 0,
260
264 pause = 1 << 1,
265
269 wait_deadlock_checks = 1 << 2
270};
@ none
No optional features enabled.
Definition BS_thread_pool.hpp:254
@ wait_deadlock_checks
Enable wait deadlock checks.
Definition BS_thread_pool.hpp:269
@ priority
Enable task priority.
Definition BS_thread_pool.hpp:259
@ pause
Enable pausing.
Definition BS_thread_pool.hpp:264

Function Documentation

◆ operator~()

tp BS::operator~ ( const tp value)
constexprnoexcept
289{
290 return static_cast<tp>(~static_cast<std::underlying_type_t<tp>>(value));
291}
tp
An enumeration class of flags to be used in the bitmask template parameter of BS::thread_pool to enab...
Definition BS_thread_pool.hpp:250

◆ thread_pool_version()

The version of the thread pool library.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ thread_pool_import_std

bool BS::thread_pool_import_std = false
inlineconstexpr

A flag indicating whether the thread pool library imported the C++23 Standard Library module using import std.

◆ thread_pool_module

bool BS::thread_pool_module = false
inlineconstexpr

A flag indicating whether the thread pool library was compiled as a C++20 module.

◆ thread_pool_native_extensions

bool BS::thread_pool_native_extensions = false
inlineconstexpr

A flag indicating whether the thread pool library's native extensions are enabled.