Boost.AFIO    Boost C++ Libraries
Classes | Functions
Utilities

Classes

class  boost::afio::utils::secded_ecc< blocksize >
 Calculates the single error correcting double error detecting (SECDED) Hamming Error Correcting Code for a blocksize block of bytes. For example, a secdec_ecc<8> would be the very common 72,64 Hamming code used in ECC RAM, or secdec_ecc<4096> would be for a 32784,32768 Hamming code. More...
class  boost::afio::utils::page_allocator< T >
 An STL allocator which allocates large TLB page memory.If the operating system is configured to allow it, this type of memory is particularly efficient for doing large scale file i/o. This is because the kernel must normally convert the scatter gather buffers you pass into extended scatter gather buffers as the memory you see as contiguous may not, and probably isn't, actually be contiguous in physical memory. Regions returned by this allocator may be allocated contiguously in physical memory and therefore the kernel can pass through your scatter gather buffers unmodified. More...

Functions

BOOST_AFIO_DECL std::vector
< size_t > 
boost::afio::utils::page_sizes (bool only_actually_available=true) noexcept
 Returns the page sizes of this architecture which is useful for calculating direct i/o multiples.
size_t boost::afio::utils::file_buffer_default_size () noexcept
 Returns a reasonable default size for page_allocator, typically the closest page size from page_sizes() to 1Mb.
BOOST_AFIO_DECL void boost::afio::utils::random_fill (char *buffer, size_t bytes)
 Fills the buffer supplied with cryptographically strong randomness. Uses the OS kernel API.
size_t boost::afio::utils::to_hex_string (char *out, size_t outlen, const char *_in, size_t inlen)
 Converts a number to a hex string. Out buffer can be same as in buffer.
size_t boost::afio::utils::from_hex_string (char *out, size_t outlen, const char *in, size_t inlen)
 Converts a hex string to a number. Out buffer can be same as in buffer.
std::string boost::afio::utils::random_string (size_t randomlen)
 Returns a cryptographically random string capable of being used as a filename. Essentially random_fill() + to_hex_string().

Function Documentation

BOOST_AFIO_DECL std::vector<size_t> boost::afio::utils::page_sizes ( bool  only_actually_available = true)

Returns the page sizes of this architecture which is useful for calculating direct i/o multiples.

Parameters:
only_actually_availableOnly return page sizes actually available to the user running this process
Returns:
The page sizes of this architecture.

{Whatever the system API takes (one would hope constant time).} {Any error from the operating system or std::bad_alloc.}

Returns a reasonable default size for page_allocator, typically the closest page size from page_sizes() to 1Mb.

Returns:
A value of a TLB large page size close to 1Mb.

{Whatever the system API takes (one would hope constant time).} {Any error from the operating system or std::bad_alloc.}

Definition at line 5764 of file afio.hpp.

BOOST_AFIO_DECL void boost::afio::utils::random_fill ( char *  buffer,
size_t  bytes 
)

Fills the buffer supplied with cryptographically strong randomness. Uses the OS kernel API.

Parameters:
bufferA buffer to fill
bytesHow many bytes to fill

{Whatever the system API takes.} {Any error from the operating system.}

size_t boost::afio::utils::to_hex_string ( char *  out,
size_t  outlen,
const char *  _in,
size_t  inlen 
)

Converts a number to a hex string. Out buffer can be same as in buffer.

Note that the character range used is a 16 item table of:

0123456789abcdef

This lets one pack one byte of input into two bytes of output.

{O(N) where N is the length of the number.} {Throws exception if output buffer is too small for input.}

Definition at line 5808 of file afio.hpp.

size_t boost::afio::utils::from_hex_string ( char *  out,
size_t  outlen,
const char *  in,
size_t  inlen 
)

Converts a hex string to a number. Out buffer can be same as in buffer.

Note that this routine is about 43% slower than to_hex_string(), half of which is due to input validation.

{O(N) where N is the length of the string.} {Throws exception if output buffer is too small for input or input size is not multiple of two.}

Definition at line 5847 of file afio.hpp.

std::string boost::afio::utils::random_string ( size_t  randomlen)

Returns a cryptographically random string capable of being used as a filename. Essentially random_fill() + to_hex_string().

Parameters:
randomlenThe number of bytes of randomness to use for the string.
Returns:
A string representing the randomness at a 2x ratio, so if 32 bytes were requested, this string would be 64 bytes long.

{Whatever the system API takes.} {Any error from the operating system.}

Definition at line 5915 of file afio.hpp.


January, 2014

Copyright © 2013-2014 Niall Douglas, Cork, Ireland
Copyright © 2013 Paul Kirth, California
Documentation is generated by Doxygen