Foundation
Loading...
Searching...
No Matches
Classes | Namespaces | Typedefs | Functions | Variables
Allocator.hpp File Reference
#include <atomic>
#include <memory>
#include <stdexcept>

Go to the source code of this file.

Classes

struct  Foundation::Core::Arena
 A memory arena allocated from an Allocator. More...
 
class  Foundation::Core::Allocator
 General Purpose Allocator (GPA) interface. More...
 
struct  Foundation::Core::ScopedArena
 RAII wrapper for an arena allocated from an Allocator. More...
 
struct  Foundation::Core::StackArena< Size >
 A fixed-size stack memory arena. More...
 
class  Foundation::Core::StlAllocator< T >
 std::allocator adaptor for Foundation::Core::Allocator More...
 
struct  Foundation::Core::StlAllocator< T >::Rebind< U >
 
struct  Foundation::Core::StlDeleter< T >
 Custom deleter for Foundation::Core::UniquePtr and Foundation::Core::SharedPtr that uses a Foundation::Core::Allocator to deallocate memory. More...
 

Namespaces

namespace  Foundation
 
namespace  Foundation::Core
 Allocators, Data Structures and introspection implementations.
 

Typedefs

using Foundation::Core::size_type = std::size_t
 
using Foundation::Core::pointer = void *
 
template<typename T >
using Foundation::Core::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 Foundation::Core::SharedPtr = std::shared_ptr< T >
 std::shared_ptr with custom deleter that uses a Foundation::Core::Allocator to deallocate memory.
 

Functions

uintptr_t Foundation::Core::AlignUp (uintptr_t value, uintptr_t alignment)
 
uintptr_t Foundation::Core::AlignDown (uintptr_t value, uintptr_t alignment)
 
template<typename Base , typename Derived , typename ... Args>
BaseFoundation::Core::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>
TFoundation::Core::Construct (Allocator *resource, Args &&...args)
 Convenience placement new with object of type T using a Foundation::Core::Allocator.
 
template<typename T >
void Foundation::Core::Destruct (Allocator *resource, T *obj)
 Convenience destructor for objects allocated with Construct or ConstructBase.
 
template<typename Base , typename Derived , typename ... Args>
UniquePtr< BaseFoundation::Core::ConstructUniqueBase (Allocator *resource, Args &&...args)
 Helper function for constructing a pinned resource with a Foundation::Core::Allocator.
 
template<typename T , typename ... Args>
UniquePtr< TFoundation::Core::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< BaseFoundation::Core::ConstructSharedBase (Allocator *resource, Args &&...args)
 Helper function for constructing a ref-counted resource with a Foundation::Core::Allocator.
 
template<typename T , typename ... Args>
SharedPtr< TFoundation::Core::ConstructShared (Allocator *resource, Args &&...args)
 Convenience wrapper for calling ConstructSharedBase when Base and Derived are the same type.
 

Variables

constexpr size_t Foundation::Core::kDefaultStackArenaSize = 12 * 1024