DUDS
Distributed Update of Data from Something
DataSize.hpp File Reference
#include <duds/general/Errors.hpp>
#include <cstdint>
Include dependency graph for DataSize.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  duds::general::DataSize< Bits >
 A class to assist with specifiying the sizes of data with scaling units, much like std::chrono::duration does with time. More...
 
struct  duds::general::DataSizeConversionError
 Used to report a failure to make an exact conversion of a size represented by a DataSize object. More...
 

Namespaces

 duds
 
 duds::general
 General use library code that isn't actually specific to the DUDS family of libraries, but were developed along with DUDS.
 

Macros

#define THROW_DATASIZE_CONVERSION_ERROR(bits, trgbits, blocks)
 Throws a DataSizeConversionError exception and adds in error metadata. More...
 

Typedefs

typedef DataSize< 1 > duds::general::Bits
 DataSize type for a size in bits. More...
 
typedef DataSize< 8 > duds::general::Bytes
 DataSize type for a size in bytes. More...
 
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. More...
 
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. More...
 
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. More...
 
typedef DataSize< 1000000000 > duds::general::Gigabits
 DataSize type for a size in gigabits. More...
 
typedef DataSize< 1000 > duds::general::Kilobits
 DataSize type for a size in kilobits. More...
 
typedef DataSize< 1024 *8 > duds::general::Kilobytes
 DataSize type for a size in kilobytes. More...
 
typedef DataSize< 1000000 > duds::general::Megabits
 DataSize type for a size in megabits. More...
 
typedef DataSize< 1024 *1024 *8 > duds::general::Megabytes
 DataSize type for a size in megabytes. More...
 
typedef DataSize< 4 > duds::general::Nibbles
 DataSize type for a size in nibbles. More...
 

Macro Definition Documentation

◆ THROW_DATASIZE_CONVERSION_ERROR

#define THROW_DATASIZE_CONVERSION_ERROR (   bits,
  trgbits,
  blocks 
)
Value:
throw boost::enable_current_exception(DataSizeConversionError()) << \
DataSizeSourceUnit(bits) << DataSizeTargetUnit(trgbits) << \
DataSizeBlocks(blocks) << \
boost::throw_function(BOOST_CURRENT_FUNCTION) << \
boost::throw_file(__FILE__) << ::boost::throw_line((int)__LINE__) << \
duds::general::StackTrace(boost::stacktrace::stacktrace())
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.
Definition: DataSize.hpp:36
boost::error_info< struct Info_Stacktrace, boost::stacktrace::stacktrace > StackTrace
Includes stack trace information in an exception.
Definition: Errors.hpp:76

Throws a DataSizeConversionError exception and adds in error metadata.

This is used instead of DUDS_THROW_EXCEPTION or BOOST_THROW_EXCEPTION because they are seen as void type expressions rather than a throw exception, and the DataSize template class needs them to be seen as a throw to be used within constexpr funcions.

Parameters
bitsThe bits per block in the source.
trgbitsThe bits per block in the target.
blocksThe number of blocks that could not be converted.

Definition at line 57 of file DataSize.hpp.

Referenced by duds::general::DataSize< Bits >::size().