You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
53 lines
1.1 KiB
//! Custom allocation framekwork for frozen (RO) and/or secure allocations, shared allocations, aliased allocation, etc. (polymorphic.)
|
|
#ifndef _ALLOC_H
|
|
#define _ALLOC_H
|
|
|
|
#ifdef __cplusplus
|
|
#include <memory>
|
|
#endif
|
|
|
|
#include "types.h"
|
|
#include "macros.h"
|
|
|
|
LINK_START(C)
|
|
typedef struct base_allocator alloc_t;
|
|
|
|
//TODO: C API anonlogue for allocator interface below.
|
|
|
|
LINK_END
|
|
|
|
#if $CXX
|
|
extern "C" {
|
|
struct base_allocator {
|
|
//TODO: Allocator interface...
|
|
virtual ~base_allocator();
|
|
}
|
|
}
|
|
namespace alloc {
|
|
class FrozenAllocator : public alloc_t {
|
|
struct _impl;
|
|
protected:
|
|
struct anon_raw_secmem;
|
|
/*struct anon_raw_secmem::deleter {
|
|
operator
|
|
};*/
|
|
struct alloc_info;
|
|
struct alloc_value;
|
|
public:
|
|
template<typename T>
|
|
FrozenAllocator(FrozenAllocator &&) noexcept;
|
|
FrozenAllocator& operator=(FrozenAllocator &&);
|
|
|
|
FrozenAllocator(const FrozenAllocator&) = delete;
|
|
FrozenAllocator& operator=(const FrozenAllocator&) = delete;
|
|
virtual ~FrozenAllocator();
|
|
private:
|
|
std::unique_ptr<_impl> inner_;
|
|
//std::shared_ptr<anon_raw_secmem> m_manager;
|
|
//std::map<alloc_info, std::unique_ptr<alloc_value>> m_values;
|
|
};
|
|
}
|
|
#endif
|
|
|
|
#endif /* _ALLOC_H */
|