C++ DAT

Hyper::Util Hyper::Sodium Hyper::Core::Memory

Hyper::Util

Buffer<T>

A class that provides some convenient methods for managing buffers.

OPERATORS

Operator Description
= Assign one buffer to another.
== Determine if two buffers values are equal.
!= Determine if two buffers values are not equal.
<< Allow buffers to interface with streams. The value of the buffer will be represented as hex in a angle-bracket delimited string.
[] Provides access of the buffer via index.

CONSTRUCTORS

Constructs a buffer from an initializer list.

Buffer<T>(initializer_list<T> list)
Parameter Default Description
list

Constructs an empty buffer.

Buffer<T>()

Constructs a buffer with a value of size.

Buffer<T>(size_t size)
Parameter Default Description
size The size initially allocated for the buffer value.

Constructs a buffer from a string.

Buffer<T>(const string& str)
Parameter Default Description
str

Constructs a buffer from another buffer.

Buffer<T>(const Buffer& buf)
Parameter Default Description
buf

METHODS

toString

Get the value of of the buffer as a string.

toString()
Return Type Description
std::string undefined

toString

Get the value of of the buffer as a string.

toString(const std::string& encoding, size_t start = 0, size_t end = 0)
Return Type Description
std::string undefined
Parameter Default Description
encoding type.
start 0
end 0

length

Get the size of the buffer in by bytes.

length()
Return Type Description
int undefined

concat

Concatinate this buffer with a list of buffers.

concat(initializer_list<T>& list)
Return Type Description
Buffer Returns a new combined buffer.
Parameter Default Description
list A list of buffers to be joined.

copy

Copies this buffer (or part of it) into another buffer.

copy(Buffer& target, size_t targetStart, size_t sourceStart, size_t sourceEnd)
Return Type Description
size_t Returns how many bytes were written to this buffer.
Parameter Default Description
target A Buffer to copy into.
targetStart The offset within target at which to begin writing.
sourceStart The offset within buf from which to begin copying.
sourceEnd The offset within buf at which to stop. copying (not inclusive).

slice

provides a new buffer that represents a slice of this one.

slice(size_t from, size_t to)
Return Type Description
Buffer undefined
Parameter Default Description
from Where the new Buffer will start. Default: 0.
to Where the new Buffer will end (not inclusive). Default: buf.length.

PROPERTIES

Type Name Description
vector value Contains a vector of the type the constructor was specialized with.

Hyper::Util

ctz

Counts the number of trailing zeros of a binary number.

ctz(size_t v)
Return Type Description
size_t Returns the number of trailing zeros.
Parameter Default Description
v The binary number to analyze.

Hyper::Sodium

randomBytes

https://libsodium.gitbook.io/doc/generating_random_data#usage

randomBytes(size_t size)
Return Type Description
std::string returns std::string of random bytes.
Parameter Default Description
size the total number of random bytes produced.

base64Encode

base64 encodes a string.

base64Encode(const std::string& str)
Return Type Description
std::string provides the base64 encoded string.
Parameter Default Description
str the string to be encoded.

base64Decode

decodes a base64 encoded string.

base64Decode(const std::string& str)
Return Type Description
std::string provides the decoded string.
Parameter Default Description
str the string to be decoded.

Hyper::Core::Memory

Page

Contains a buffer of a fixed size.

CONSTRUCTORS

constructs a new instance of the page class.

Page(int i, Buffer<uint8_t> Buf)
Parameter Default Description
i
Buf

PROPERTIES

Type Name Description
Buffer buffer The underlying source of the page.

Pager

Access memory using small fixed sized buffers.

CONSTRUCTORS

Creates a new instance of the Pager class.

Pager(int pageSize, PageOptions opts = {})
Parameter Default Description
pageSize Determines how large the backing vector will be.
opts {} Contains deduplication info.