|
DUDS
|
Distributed Update of Data from Something
|
General use library code that isn't actually specific to the DUDS family of libraries, but were developed along with DUDS. More...
Classes | |
| class | BitFlags |
| A type-safe bit flag storage class. More... | |
| struct | ChecksumError |
| A bad checksum value was found. More... | |
| struct | CrcError |
| An incorrect cyclic redundancy code (CRC) value was found. More... | |
| class | DataSize |
| A class to assist with specifiying the sizes of data with scaling units, much like std::chrono::duration does with time. More... | |
| struct | DataSizeConversionError |
| Used to report a failure to make an exact conversion of a size represented by a DataSize object. More... | |
| struct | DimensionMismatchError |
| A specified position has a different number of dimensions than the array. More... | |
| struct | EmptyDimensionError |
| A specified dimension is zero. More... | |
| struct | FileIoError |
| An I/O error involving a file. More... | |
| class | IntegerBiDirIterator |
| A bidirectional iterator intended to work with sequential integers. More... | |
| struct | IoError |
| A general I/O error. More... | |
| struct | LanguageTaggedString |
| Holds a string and its associated language. More... | |
| class | NddArray |
| N-Dimensional Dynamic Array. More... | |
| struct | NddArrayError |
| Base class for exceptions thrown by NddArray. More... | |
| struct | ObjectDestructedError |
| An error indicating an attempt to use an already destructed object. More... | |
| struct | OutOfRangeError |
| A specified dimension is beyond the range of the array. More... | |
| class | Spinlock |
| A simple spinlock following the lockable and timed lockable concepts so that it can be used with std::lock_guard, std::unique_lock, and std::lock. More... | |
| class | SpinlockYieldingWrapper |
| A simple wrapper around a Spinlock object that implements the timed lockable concept such that attempts to lock an already locked Spinlock will always yield before trying again. More... | |
| struct | UnimplementedError |
| Indicates that the requested operation or called function is not implemented. More... | |
| struct | ZeroSizeError |
| An empty array, one with zero dimensions, cannot be indexed. More... | |
Typedefs | |
| typedef DataSize< 1 > | Bits |
| DataSize type for a size in bits. More... | |
| typedef DataSize< 8 > | Bytes |
| DataSize type for a size in bytes. More... | |
| typedef boost::error_info< struct Info_DataSizeBlocks, std::size_t > | DataSizeBlocks |
| The number of blocks from a DataSize object that cannot be converted. More... | |
| typedef boost::error_info< struct Info_DataSizeSourceUnit, std::size_t > | DataSizeSourceUnit |
| The number of bits that make up the size unit of the source DataSize object. More... | |
| typedef boost::error_info< struct Info_DataSizeTargetUnit, std::size_t > | DataSizeTargetUnit |
| The number of bits that make up the size unit of the target DataSize object. More... | |
| typedef DataSize< 1000000000 > | Gigabits |
| DataSize type for a size in gigabits. More... | |
| typedef DataSize< 1000 > | Kilobits |
| DataSize type for a size in kilobits. More... | |
| typedef DataSize< 1024 *8 > | Kilobytes |
| DataSize type for a size in kilobytes. More... | |
| typedef std::map< std::string, std::string > | LanguageTaggedStringMap |
| typedef DataSize< 1000000 > | Megabits |
| DataSize type for a size in megabits. More... | |
| typedef DataSize< 1024 *1024 *8 > | Megabytes |
| DataSize type for a size in megabytes. More... | |
| typedef DataSize< 4 > | Nibbles |
| DataSize type for a size in nibbles. More... | |
| typedef std::lock_guard< duds::general::Spinlock > | SpinLockGuard |
| A convenience typedef for a std::lock_guard using the Spinlock object. More... | |
| typedef boost::error_info< struct Info_Stacktrace, boost::stacktrace::stacktrace > | StackTrace |
| Includes stack trace information in an exception. More... | |
| typedef std::unique_lock< duds::general::Spinlock > | UniqueSpinLock |
| A convenience typedef for a std::unique_lock using the Spinlock object. More... | |
| typedef std::unique_lock< duds::general::SpinlockYieldingWrapper > | UniqueYieldingSpinLock |
| A convenience typedef for a std::unique_lock using the Spinlock yielding wrapper. More... | |
| typedef std::lock_guard< duds::general::SpinlockYieldingWrapper > | YieldingSpinLockGuard |
| A convenience typedef for a std::lock_guard using the Spinlock yielding wrapper. More... | |
Functions | |
| template<class T , class B > | |
| std::size_t | hash_value (const duds::general::BitFlags< T, B > &bf) |
| Generates a hash value for use with Boost containers, like boost::multi_index::multi_index_container templates. More... | |
| template<typename Integer > | |
| constexpr bool | IsPowerOf2 (Integer i) |
| Returns true only if the given value is a power of 2. More... | |
| template<typename Integer > | |
| Integer | ReverseBits (Integer i) |
| Reverses the bits in a given value. More... | |
| constexpr std::uint8_t | ReverseBits (const std::uint8_t i) |
| Reverse the bits of a given byte. More... | |
| template<unsigned B, typename T > | |
| std::make_signed< T >::type | SignedMagnitudeToTwosComplement (const T x) |
| Converts a signed magnitude value to two's complement. More... | |
| template<unsigned B, typename T > | |
| std::make_signed< T >::type | SignExtend (const T x) |
| Performs a sign extention operation. More... | |
| template<class T > | |
| void | swap (NddArray< T > &one, NddArray< T > &two) |
| Makes NddAray meet the requirements of Swappable to assist in using std::swap(). More... | |
| template<class Duration > | |
| void | YieldingWait (Duration duration) |
| Waits for a minumum period of time by calling std::this_thread::yield() in a loop. More... | |
| void | YieldingWait (int nano) |
| Waits for a minumum period of time in nanoseconds by calling std::this_thread::yield() in a loop. More... | |
General use library code that isn't actually specific to the DUDS family of libraries, but were developed along with DUDS.
The code in this namespace must not be specific to DUDS.
| typedef DataSize<1> duds::general::Bits |
DataSize type for a size in bits.
Definition at line 374 of file DataSize.hpp.
| typedef DataSize<8> duds::general::Bytes |
DataSize type for a size in bytes.
Definition at line 384 of file DataSize.hpp.
| typedef boost::error_info<struct Info_DataSizeBlocks, std::size_t> duds::general::DataSizeBlocks |
The number of blocks from a DataSize object that cannot be converted.
The represented size is the number of blocks multiplied by the bit size of the DataSize template parameter.
Definition at line 44 of file DataSize.hpp.
| typedef boost::error_info<struct Info_DataSizeSourceUnit, std::size_t> duds::general::DataSizeSourceUnit |
The number of bits that make up the size unit of the source DataSize object.
Definition at line 30 of file DataSize.hpp.
| typedef boost::error_info<struct Info_DataSizeTargetUnit, std::size_t> duds::general::DataSizeTargetUnit |
The number of bits that make up the size unit of the target DataSize object.
Definition at line 36 of file DataSize.hpp.
| typedef DataSize<1000000000> duds::general::Gigabits |
DataSize type for a size in gigabits.
Definition at line 409 of file DataSize.hpp.
| typedef DataSize<1000> duds::general::Kilobits |
DataSize type for a size in kilobits.
Definition at line 399 of file DataSize.hpp.
| typedef DataSize<1024*8> duds::general::Kilobytes |
DataSize type for a size in kilobytes.
Definition at line 389 of file DataSize.hpp.
| typedef std::map<std::string, std::string> duds::general::LanguageTaggedStringMap |
Definition at line 69 of file LanguageTaggedString.hpp.
| typedef DataSize<1000000> duds::general::Megabits |
DataSize type for a size in megabits.
Definition at line 404 of file DataSize.hpp.
| typedef DataSize<1024*1024*8> duds::general::Megabytes |
DataSize type for a size in megabytes.
Definition at line 394 of file DataSize.hpp.
| typedef DataSize<4> duds::general::Nibbles |
DataSize type for a size in nibbles.
Definition at line 379 of file DataSize.hpp.
| typedef std::lock_guard<duds::general::Spinlock> duds::general::SpinLockGuard |
A convenience typedef for a std::lock_guard using the Spinlock object.
Definition at line 216 of file Spinlock.hpp.
| typedef boost::error_info< struct Info_Stacktrace, boost::stacktrace::stacktrace> duds::general::StackTrace |
Includes stack trace information in an exception.
This is included in exceptions that are thrown with DUDS_THROW_EXCEPTION when DUDS_ERRORS_VERBOSE is defined. The build normally defines DUDS_ERRORS_VERBOSE for debug builds when the required libraries are available and usable; see DUDS_THROW_EXCEPTION for more info.
Definition at line 76 of file Errors.hpp.
| typedef std::unique_lock<duds::general::Spinlock> duds::general::UniqueSpinLock |
A convenience typedef for a std::unique_lock using the Spinlock object.
Definition at line 221 of file Spinlock.hpp.
| typedef std::unique_lock<duds::general::SpinlockYieldingWrapper> duds::general::UniqueYieldingSpinLock |
A convenience typedef for a std::unique_lock using the Spinlock yielding wrapper.
Definition at line 280 of file Spinlock.hpp.
| typedef std::lock_guard<duds::general::SpinlockYieldingWrapper> duds::general::YieldingSpinLockGuard |
A convenience typedef for a std::lock_guard using the Spinlock yielding wrapper.
Definition at line 273 of file Spinlock.hpp.
|
inline |
Generates a hash value for use with Boost containers, like boost::multi_index::multi_index_container templates.
These refuse to use std::hash as of Boost 1.65, so this implementation is required.
Definition at line 331 of file BitFlags.hpp.
|
inline |
Returns true only if the given value is a power of 2.
| Integer | The integer type of the value. |
| i | The integer value to check. |
Definition at line 9 of file ReverseBits.hpp.
Referenced by ReverseBits().
|
inline |
Reverses the bits in a given value.
From http://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel, with some reformatting and changed to a C++ template. The code is in the public domain.
| Integer | The integer type of the value. |
| i | The integer value to reverse. |
Definition at line 26 of file ReverseBits.hpp.
Referenced by duds::hardware::devices::displays::HD44780::setGlyph(), and duds::hardware::devices::displays::ST7920::writeBlock().
|
inline |
Reverse the bits of a given byte.
From http://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith64BitsDiv, with some reformatting into a constexpr function. The code is in the public domain.
| i | The integer value to reverse. |
Definition at line 52 of file ReverseBits.hpp.
|
inline |
Converts a signed magnitude value to two's complement.
Also has the effect of a sign extention on the input value.
| B | The number of bits used in the input. The value of x must be positioned (shifted) such that a positive value is already correct. The sign bit will be the MSb indicated by this value (1 << B). More significant bits than B bits are ignored. |
| T | The supplied integer type. A negative value will be properly represented in the signed variation of the type in the returned value. T may be signed or unsigned. |
| x | A signed magnitude value from a potentially limited number of bits that may not fill T. |
Definition at line 24 of file SignedMagnitudeToTwosComplement.hpp.
|
inline |
Performs a sign extention operation.
From http://graphics.stanford.edu/~seander/bithacks.html#FixedSignExtend, with some reformatting, a swap of the template parameters, and an update to take advantage of C++11. The code is in the public domain.
| B | The number of bits used in the input. The value of x must be positioned (shifted) such that a positive value is already correct. |
| T | The supplied integer type. A negative value will be properly represented in the signed variation of the type in the returned value. T may be signed or unsigned. |
| x | A signed value from a limited number of bits that does not fill T. |
Definition at line 24 of file SignExtend.hpp.
Makes NddAray meet the requirements of Swappable to assist in using std::swap().
Definition at line 1211 of file NddArray.hpp.
Referenced by duds::ui::graphics::BppImage::swap(), and duds::general::NddArray< double >::swap().
| void duds::general::YieldingWait | ( | Duration | duration | ) |
Waits for a minumum period of time by calling std::this_thread::yield() in a loop.
This can be closer to the requested time for periods under a millisecond than calling std::this_thread::sleep_for() with the same duration when running on Linux, even on a fast computer. Calling yield prevents the wait from monopolizing a processor.
| Duration | The type used for the duration. It must be a variation of std::chrono::duration. |
| duration | The minimum time to wait. |
Definition at line 28 of file YieldingWait.hpp.
Referenced by duds::hardware::devices::displays::HD44780::sendByte(), duds::hardware::devices::displays::ST7920::sendByte(), duds::hardware::devices::displays::HD44780::wait(), duds::hardware::devices::displays::ST7920::wait(), and YieldingWait().
|
inline |
Waits for a minumum period of time in nanoseconds by calling std::this_thread::yield() in a loop.
This can be closer to the requested time for periods under a millisecond than calling std::this_thread::sleep_for() with the same duration when running on Linux, even on a fast computer. Calling yield prevents the wait from monopolizing a processor.
| nano | The minimum time to wait in nanoseconds. |
Definition at line 45 of file YieldingWait.hpp.