module
MemoryProvides a stream library and memory utilities.
Files
- file any_value.hpp
- Class cubos::
core:: memory:: AnyValue. - file any_vector.hpp
- Class cubos::
core:: memory:: AnyVector. - file buffer_stream.hpp
- Class cubos::
core:: memory:: BufferStream. - file endianness.hpp
- Endianness utility functions.
- file function.hpp
- Class cubos::
core:: memory:: Function. - file guards.hpp
- Classes cubos::
core:: memory:: ReadGuard and cubos:: core:: memory:: WriteGuard. - file move.hpp
- Functions cubos::
core:: memory:: move and cubos:: core:: memory:: forward. - file opt.hpp
- Class cubos::
core:: memory:: Opt. - file standard_stream.hpp
- Class cubos::
core:: memory:: StandardStream. - file stream.hpp
- Class cubos::
core:: memory:: Stream. - file type_map.hpp
- Class cubos::
core:: memory:: TypeMap. - file unordered_bimap.hpp
- Class cubos::
core:: memory:: UnorderedBimap.
Classes
- class cubos::core::memory::AnyValue
- Stores a blob of a given reflected type.
- class cubos::core::memory::AnyVector
- Stores a dynamically sized array of blobs of a given reflected type.
- class cubos::core::memory::BufferStream
- Stream implementation which writes to/reads from a buffer.
-
template<typename>class cubos::core::memory::Function
- Generic function pointer which can also store capturing lambda functions.
-
template<typename T, typename Lock>class cubos::core::memory::ReadGuard
- Provides safe read-only access to an object using a lock.
-
template<typename T, typename Lock>class cubos::core::memory::WriteGuard
- Provides safe read-write access to an object using a lock.
-
template<typename T>class cubos::core::memory::Opt
- Wrapper for reference types to indicate that the given argument type is optional.
- class cubos::core::memory::StandardStream
- Stream implementation which wraps a
libc
file pointer. - class cubos::core::memory::Stream
- Interface class for memory streams. Abstracts away sources or destinations of data.
-
template<typename V>class cubos::core::memory::TypeMap
- A map that stores values of type
V
, using reflection types as keys. -
template<typename L, typename R, typename LHash = std::hash<L>, typename RHash = std::hash<R>>class cubos::core::memory::UnorderedBimap
- A bidirectional hash table.
Enums
- enum class SeekOrigin { Begin, Current, End }
- Stream seek origin.
Functions
-
template<typename T>auto swapBytes(T value) -> T
- Swaps the bytes of a value, changing its endianness.
- auto isLittleEndian() -> bool
- Checks if the current platform is little endian.
-
template<typename T>auto fromLittleEndian(T value) -> T
- Converts a value from little endianness to local endianness.
-
template<typename T>auto toLittleEndian(T value) -> T
- Converts a value from local endianness to little endianness.
-
template<typename T>auto fromBigEndian(T value) -> T
- Converts a value from big endianness to local endianness.
-
template<typename T>auto toBigEndian(T value) -> T
- Converts a value from local endianness to big endianness.
-
template<typename T>auto move(T&& value) -> RemoveReference<T>::Type&& noexcept
- Returns an R-value reference to the given value.
-
template<typename T>auto forward(typename RemoveReference<T>::Type& argument) -> T&& noexcept
- Used to cast a templated function parameter to the value category the caller used to pass it, which allows rvalues to be passed as rvalues and lvalues as lvalues.
Enum documentation
enum class SeekOrigin
#include <core/memory/stream.hpp>
Stream seek origin.
Function documentation
#include <core/memory/endianness.hpp>
template<typename T>
T swapBytes(T value)
Swaps the bytes of a value, changing its endianness.
Template parameters | |
---|---|
T | Value type. |
Parameters | |
value | Value to swap. |
Returns | Swapped value. |
bool isLittleEndian()
#include <core/memory/endianness.hpp>
Checks if the current platform is little endian.
Returns | Whether its little endian. |
---|
#include <core/memory/endianness.hpp>
template<typename T>
T fromLittleEndian(T value)
Converts a value from little endianness to local endianness.
Template parameters | |
---|---|
T | Value type. |
Parameters | |
value | Value to convert. |
Returns | Converted value. |
#include <core/memory/endianness.hpp>
template<typename T>
T toLittleEndian(T value)
Converts a value from local endianness to little endianness.
Template parameters | |
---|---|
T | Value type. |
Parameters | |
value | Value to convert. |
Returns | Converted value. |
#include <core/memory/endianness.hpp>
template<typename T>
T fromBigEndian(T value)
Converts a value from big endianness to local endianness.
Template parameters | |
---|---|
T | Value type. |
Parameters | |
value | Value to convert. |
Returns | Converted value. |
#include <core/memory/endianness.hpp>
template<typename T>
T toBigEndian(T value)
Converts a value from local endianness to big endianness.
Template parameters | |
---|---|
T | Value type. |
Parameters | |
value | Value to convert. |
Returns | Converted value. |
#include <core/memory/move.hpp>
template<typename T>
RemoveReference<T>::Type&& move(T&& value) noexcept
Returns an R-value reference to the given value.
Template parameters | |
---|---|
T | Value type. |
Parameters | |
value | Value to move. |
Returns | Moved value. |
#include <core/memory/move.hpp>
template<typename T>
T&& forward(typename RemoveReference<T>::Type& argument) noexcept
Used to cast a templated function parameter to the value category the caller used to pass it, which allows rvalues to be passed as rvalues and lvalues as lvalues.
Template parameters | |
---|---|
T | Argument type. |
Parameters | |
argument | Argument to forward. |
Returns | Forwarded argument. |