Lugdunum  0.1.0
Namespaces | Macros | Typedefs | Functions
Memory.hpp File Reference
#include <cstddef>
#include <type_traits>
#include <new>
#include <memory>
#include <functional>
#include <lug/System/Memory/Arena.hpp>
#include <lug/System/Memory/Policies/Thread.hpp>
#include <lug/System/Memory/Policies/BoundsChecker.hpp>
#include <lug/System/Memory/Policies/MemoryMarker.hpp>
#include <lug/System/Memory.inl>
Include dependency graph for Memory.hpp:

Go to the source code of this file.

Namespaces

 lug
 
 lug::System
 
 lug::System::Memory
 

Macros

#define LUG_NEW_ALIGN(T, alignment, ...)   ::lug::System::Memory::new_one<T>(alignment, __FILE__, __LINE__, __VA_ARGS__)
 
#define LUG_NEW_ARRAY_ALIGN(T, alignment, ...)   LUG_NEW_ARRAY_ALIGN_SIZE(typename std::remove_all_extents<T>::type, alignment, std::extent<T>::value, __VA_ARGS__)
 
#define LUG_NEW_ARRAY_ALIGN_SIZE(T, alignment, size, ...)   ::lug::System::Memory::new_array<typename std::remove_all_extents<T>::type>(alignment, size, __FILE__, __LINE__, __VA_ARGS__)
 
#define LUG_NEW(T, ...)   LUG_NEW_ALIGN(T, alignof(T), __VA_ARGS__)
 
#define LUG_DELETE(object, arena)   ::lug::System::Memory::delete_one(object, arena)
 
#define LUG_NEW_ARRAY(T, ...)   LUG_NEW_ARRAY_ALIGN(T, alignof(typename std::remove_all_extents<T>::type), __VA_ARGS__)
 
#define LUG_NEW_ARRAY_SIZE(T, size, ...)   LUG_NEW_ARRAY_ALIGN_SIZE(T, alignof(typename std::remove_all_extents<T>::type), size, __VA_ARGS__)
 
#define LUG_DELETE_ARRAY(object, arena)   ::lug::System::Memory::delete_array(object, arena)
 

Typedefs

template<typename T , typename Deleter = typename priv::make_unique_deleter<T>::Deleter>
using lug::System::Memory::unique_ptr = std::unique_ptr< T, Deleter >
 

Functions

template<typename T , class Arena , class ... Args>
T * lug::System::Memory::new_one (size_t alignment, const char *file, size_t line, Arena &arena, Args &&... args)
 
template<typename T , class Arena >
void lug::System::Memory::delete_one (T *object, Arena &arena)
 
template<typename T , class Arena , class ... Args, typename std::enable_if<!std::is_pod< T >::value, int >::type = 0>
T * lug::System::Memory::new_array (size_t alignment, size_t nb, const char *file, size_t line, Arena &arena, Args &&... args)
 
template<typename T , class Arena , typename std::enable_if<!std::is_pod< T >::value, int >::type = 0>
void lug::System::Memory::delete_array (T *ptr, Arena &arena)
 
template<typename T , class Arena , typename std::enable_if< std::is_pod< T >::value, int >::type = 0>
T * lug::System::Memory::new_array (size_t alignment, size_t nb, const char *file, size_t line, Arena &arena)
 
template<typename T , class Arena , typename ... Args>
priv::make_unique_if< T >::SingleObject lug::System::Memory::make_unique (Arena &arena, Args &&... args)
 
template<typename T , class Arena , typename ... Args>
priv::make_unique_if< T >::SingleObject lug::System::Memory::make_unique_align (Arena &arena, size_t alignment, Args &&... args)
 
template<typename T , class Arena , typename ... Args, typename std::enable_if<!std::is_pod< T >::value, int >::type = 0>
priv::make_unique_if< T >::UnknownBound lug::System::Memory::make_unique (Arena &arena, size_t size, Args &&... args)
 
template<typename T , class Arena , typename ... Args, typename std::enable_if<!std::is_pod< T >::value, int >::type = 0>
priv::make_unique_if< T >::UnknownBound lug::System::Memory::make_unique_align (Arena &arena, size_t alignment, size_t size, Args &&... args)
 
template<typename T , class Arena , typename std::enable_if< std::is_pod< T >::value, int >::type = 0>
priv::make_unique_if< T >::UnknownBound lug::System::Memory::make_unique (Arena &arena, size_t size)
 
template<typename T , class Arena , typename std::enable_if< std::is_pod< T >::value, int >::type = 0>
priv::make_unique_if< T >::UnknownBound lug::System::Memory::make_unique_align (Arena &arena, size_t alignment, size_t size)
 
template<typename T , class Arena , typename ... Args, typename std::enable_if<!std::is_pod< T >::value, int >::type = 0>
priv::make_unique_if< T >::KnownBound lug::System::Memory::make_unique (Arena &arena, Args &&... args)
 
template<typename T , class Arena , typename ... Args, typename std::enable_if<!std::is_pod< T >::value, int >::type = 0>
priv::make_unique_if< T >::KnownBound lug::System::Memory::make_unique_align (Arena &arena, size_t alignment, Args &&... args)
 
template<typename T , class Arena , typename std::enable_if< std::is_pod< T >::value, int >::type = 0>
priv::make_unique_if< T >::KnownBound lug::System::Memory::make_unique (Arena &arena)
 
template<typename T , class Arena , typename std::enable_if< std::is_pod< T >::value, int >::type = 0>
priv::make_unique_if< T >::KnownBound lug::System::Memory::make_unique_align (Arena &arena, size_t alignment)
 

Macro Definition Documentation

◆ LUG_NEW_ALIGN

#define LUG_NEW_ALIGN (   T,
  alignment,
  ... 
)    ::lug::System::Memory::new_one<T>(alignment, __FILE__, __LINE__, __VA_ARGS__)

Definition at line 16 of file Memory.hpp.

◆ LUG_NEW_ARRAY_ALIGN

#define LUG_NEW_ARRAY_ALIGN (   T,
  alignment,
  ... 
)    LUG_NEW_ARRAY_ALIGN_SIZE(typename std::remove_all_extents<T>::type, alignment, std::extent<T>::value, __VA_ARGS__)

Definition at line 17 of file Memory.hpp.

◆ LUG_NEW_ARRAY_ALIGN_SIZE

#define LUG_NEW_ARRAY_ALIGN_SIZE (   T,
  alignment,
  size,
  ... 
)    ::lug::System::Memory::new_array<typename std::remove_all_extents<T>::type>(alignment, size, __FILE__, __LINE__, __VA_ARGS__)

Definition at line 18 of file Memory.hpp.

◆ LUG_NEW

#define LUG_NEW (   T,
  ... 
)    LUG_NEW_ALIGN(T, alignof(T), __VA_ARGS__)

Definition at line 20 of file Memory.hpp.

◆ LUG_DELETE

#define LUG_DELETE (   object,
  arena 
)    ::lug::System::Memory::delete_one(object, arena)

Definition at line 21 of file Memory.hpp.

◆ LUG_NEW_ARRAY

#define LUG_NEW_ARRAY (   T,
  ... 
)    LUG_NEW_ARRAY_ALIGN(T, alignof(typename std::remove_all_extents<T>::type), __VA_ARGS__)

Definition at line 23 of file Memory.hpp.

◆ LUG_NEW_ARRAY_SIZE

#define LUG_NEW_ARRAY_SIZE (   T,
  size,
  ... 
)    LUG_NEW_ARRAY_ALIGN_SIZE(T, alignof(typename std::remove_all_extents<T>::type), size, __VA_ARGS__)

Definition at line 24 of file Memory.hpp.

◆ LUG_DELETE_ARRAY

#define LUG_DELETE_ARRAY (   object,
  arena 
)    ::lug::System::Memory::delete_array(object, arena)

Definition at line 25 of file Memory.hpp.