Foundation
|
Allocators, Data Structures and introspection implementations. More...
Classes | |
class | Allocator |
General Purpose Allocator (GPA) interface. More... | |
struct | Arena |
A memory arena allocated from an Allocator. More... | |
class | HeapAllocator |
General purpose heap allocator. More... | |
class | Pool |
Unbounded object pool with O(1) value mapping. More... | |
struct | ScopedArena |
RAII wrapper for an arena allocated from an Allocator. More... | |
class | Span |
std::span with relaxed constructors for pointer-aliasing types and common containers. More... | |
class | StackAllocator |
Implements an atomic stack-based bump allocator. More... | |
struct | StackArena |
A fixed-size stack memory arena. More... | |
class | StlAllocator |
std::allocator adaptor for Foundation::Core::Allocator More... | |
struct | StlDeleter |
Custom deleter for Foundation::Core::UniquePtr and Foundation::Core::SharedPtr that uses a Foundation::Core::Allocator to deallocate memory. More... | |
Typedefs | |
using | size_type = std::size_t |
using | pointer = void * |
template<typename T > | |
using | UniquePtr = std::unique_ptr< T, StlDeleter< T > > |
std::unique_ptr with custom deleter that uses a Foundation::Core::Allocator to deallocate memory. | |
template<typename T > | |
using | SharedPtr = std::shared_ptr< T > |
std::shared_ptr with custom deleter that uses a Foundation::Core::Allocator to deallocate memory. | |
template<typename T > | |
using | Optional = std::optional< T > |
Alias for std::optional | |
template<typename First , typename Second > | |
using | Pair = std::pair< First, Second > |
Alias for std::pair | |
template<typename ... Args> | |
using | Tuple = std::tuple< Args... > |
Alias for std::tuple | |
template<typename T , size_t Size> | |
using | Array = std::array< T, Size > |
Alias for std::array | |
template<size_t Size> | |
using | Bitset = std::bitset< Size > |
Alias for std::bitset | |
using | StringView = std::basic_string_view< char > |
Alias for std::basic_string_view<char> | |
using | String = std::basic_string< char > |
Alias for std::basic_string<char> , without an explicit allocator constructor. | |
using | StringAlloc = std::basic_string< char, std::char_traits< char >, StlAllocator< char > > |
std::basic_string<char> with explicit Foundation::Core::StlAllocator constructor | |
template<typename T > | |
using | Vector = std::vector< T, StlAllocator< T > > |
std::vector with explicit Foundation::Core::StlAllocator constructor | |
template<typename T , typename Predicate = std::less<T>> | |
using | Set = std::set< T, Predicate, StlAllocator< T > > |
std::set with explicit Foundation::Core::StlAllocator constructor | |
template<typename K , typename V , typename Predicate = std::less<K>> | |
using | Map = std::map< K, V, Predicate, StlAllocator< Pair< const K, V > > > |
std::map with explicit Foundation::Core::StlAllocator constructor | |
template<typename T > | |
using | Deque = std::deque< T, StlAllocator< T > > |
std::deque with explicit Foundation::Core::StlAllocator constructor | |
template<typename T > | |
using | List = std::list< T, StlAllocator< T > > |
std::list with explicit Foundation::Core::StlAllocator constructor | |
template<typename T , typename Container = Deque<T>> | |
using | Queue = std::queue< T, Container > |
std::queue with explicit Foundation::Core::StlAllocator constructor | |
template<typename T , typename Predicate = std::less<T>, typename Container = Vector<T>> | |
using | PriorityQueue = std::priority_queue< T, Container, Predicate > |
std::priority_queue with explicit Foundation::Core::StlAllocator constructor | |
using | DefaultAllocator = HeapAllocator |
Alias for HeapAllocator with tracking enabled. | |
Functions | |
uintptr_t | AlignUp (uintptr_t value, uintptr_t alignment) |
uintptr_t | AlignDown (uintptr_t value, uintptr_t alignment) |
template<typename Base , typename Derived , typename ... Args> | |
Base * | ConstructBase (Allocator *resource, Args &&...args) |
Placement new helper for constructing an object of type Derived (which can be a subclass of Base) using a Foundation::Core::Allocator. | |
template<typename T , typename ... Args> | |
T * | Construct (Allocator *resource, Args &&...args) |
Convenience placement new with object of type T using a Foundation::Core::Allocator. | |
template<typename T > | |
void | Destruct (Allocator *resource, T *obj) |
Convenience destructor for objects allocated with Construct or ConstructBase. | |
template<typename Base , typename Derived , typename ... Args> | |
UniquePtr< Base > | ConstructUniqueBase (Allocator *resource, Args &&...args) |
Helper function for constructing a pinned resource with a Foundation::Core::Allocator. | |
template<typename T , typename ... Args> | |
UniquePtr< T > | ConstructUnique (Allocator *resource, Args &&...args) |
Convenience wrapper for calling ConstructUniqueBase when Base and Derived are the same type. | |
template<typename Base , typename Derived , typename ... Args> | |
SharedPtr< Base > | ConstructSharedBase (Allocator *resource, Args &&...args) |
Helper function for constructing a ref-counted resource with a Foundation::Core::Allocator. | |
template<typename T , typename ... Args> | |
SharedPtr< T > | ConstructShared (Allocator *resource, Args &&...args) |
Convenience wrapper for calling ConstructSharedBase when Base and Derived are the same type. | |
template<typename T , typename ... Args> | |
Span< T > | ConstructSpan (Allocator *resource, size_t size, Args &&...args) |
Convenience function for constructing a Span with memory allocated from a Foundation::Core::Allocator. Possibly constructs objects in-place if they are not trivially constructible (e.g. non-PODs) | |
template<typename T > | |
void | DestructSpan (Allocator *resource, Span< T > span) |
Convenience function for destructing a Span allocated with ConstructSpan. Calls destructors in-place if the type is not trivially destructible (e.g. non-PODs) | |
std::shared_ptr< spdlog::sinks::dist_sink_mt > | getLoggingSink () |
std::shared_ptr< spdlog::sinks::ringbuffer_sink_mt > | getBacktraceSink () |
spdlog::logger * | getLogger (const char *name) |
Variables | |
constexpr size_t | kDefaultStackArenaSize = 12 * 1024 |
static bool | g_Initialized = false |
static std::shared_ptr< spdlog::sinks::dist_sink_mt > | g_LoggingSink = nullptr |
static std::shared_ptr< spdlog::sinks::ringbuffer_sink_mt > | g_BacktraceSink = nullptr |
std::recursive_mutex | g_LoggingSinkMutex |
std::recursive_mutex | g_LoggerMutex |
const size_t | kMaxBacktraceLogMessages = 1000 |
Allocators, Data Structures and introspection implementations.
Alias for std::array
using Foundation::Core::Bitset = typedef std::bitset<Size> |
Alias for std::bitset
Alias for HeapAllocator with tracking enabled.
using Foundation::Core::Deque = typedef std::deque<T, StlAllocator<T> > |
std::deque
with explicit Foundation::Core::StlAllocator constructor
Construction without an allocator is disallowed, and will result in a compile-time error.
using Foundation::Core::List = typedef std::list<T, StlAllocator<T> > |
std::list
with explicit Foundation::Core::StlAllocator constructor
Construction without an allocator is disallowed, and will result in a compile-time error.
std::map
with explicit Foundation::Core::StlAllocator constructor
Construction without an allocator is disallowed, and will result in a compile-time error.
Alias for std::optional
using Foundation::Core::Pair = typedef std::pair<First, Second> |
Alias for std::pair
std::priority_queue
with explicit Foundation::Core::StlAllocator constructor
Construction without an allocator is disallowed, and will result in a compile-time error.
using Foundation::Core::Queue = typedef std::queue<T, Container> |
std::queue
with explicit Foundation::Core::StlAllocator constructor
Construction without an allocator is disallowed, and will result in a compile-time error.
using Foundation::Core::Set = typedef std::set<T, Predicate, StlAllocator<T> > |
std::set
with explicit Foundation::Core::StlAllocator constructor
Construction without an allocator is disallowed, and will result in a compile-time error.
std::shared_ptr
with custom deleter that uses a Foundation::Core::Allocator to deallocate memory.
using Foundation::Core::size_type = typedef std::size_t |
using Foundation::Core::String = typedef std::basic_string<char> |
Alias for std::basic_string<char>
, without an explicit allocator constructor.
Allocation of strings on heap is done with the default global allocator.
using Foundation::Core::StringAlloc = typedef std::basic_string<char, std::char_traits<char>, StlAllocator<char> > |
std::basic_string<char>
with explicit Foundation::Core::StlAllocator constructor
Construction without an allocator is disallowed, and will result in a compile-time error.
using Foundation::Core::StringView = typedef std::basic_string_view<char> |
Alias for std::basic_string_view<char>
using Foundation::Core::Tuple = typedef std::tuple<Args...> |
Alias for std::tuple
using Foundation::Core::UniquePtr = typedef std::unique_ptr<T, StlDeleter<T> > |
std::unique_ptr
with custom deleter that uses a Foundation::Core::Allocator to deallocate memory.
Construction without a Foundation::Core::Allocator pointer is disallowed, and will result in a compile-time error.
using Foundation::Core::Vector = typedef std::vector<T, StlAllocator<T> > |
std::vector
with explicit Foundation::Core::StlAllocator constructor
Construction without an allocator is disallowed, and will result in a compile-time error.
Convenience placement new with object of type T using a Foundation::Core::Allocator.
Placement new helper for constructing an object of type Derived (which can be a subclass of Base) using a Foundation::Core::Allocator.
Convenience wrapper for calling ConstructSharedBase when Base and Derived are the same type.
T | is the class type to be templated on. |
Helper function for constructing a ref-counted resource with a Foundation::Core::Allocator.
Base | is the base class type be templated on. |
Derived | can be a subclass of Base, with destruction handled correctly. |
Convenience function for constructing a Span with memory allocated from a Foundation::Core::Allocator. Possibly constructs objects in-place if they are not trivially constructible (e.g. non-PODs)
Convenience wrapper for calling ConstructUniqueBase when Base and Derived are the same type.
T | is the class type to be templated on. |
Helper function for constructing a pinned resource with a Foundation::Core::Allocator.
Base | is the base class type be templated on. |
Derived | can be a subclass of Base, with destruction handled correctly. |
Convenience destructor for objects allocated with Construct or ConstructBase.
Convenience function for destructing a Span allocated with ConstructSpan. Calls destructors in-place if the type is not trivially destructible (e.g. non-PODs)
std::shared_ptr< spdlog::sinks::ringbuffer_sink_mt > Foundation::Core::getBacktraceSink | ( | ) |
std::shared_ptr< spdlog::sinks::dist_sink_mt > Foundation::Core::getLoggingSink | ( | ) |
|
static |
std::recursive_mutex Foundation::Core::g_LoggerMutex |
|
static |
std::recursive_mutex Foundation::Core::g_LoggingSinkMutex |