7#ifndef VGL_FOUNDATION_HPP
8#define VGL_FOUNDATION_HPP
53 table.user_data =
this;
54 table.allocate = &allocate_thunk;
55 table.deallocate = &deallocate_thunk;
60 static void* allocate_thunk(
void* user_data, std::size_t size, std::size_t
alignment)
66 deallocate_thunk(
void* user_data,
void* memory, std::size_t size, std::size_t alignment)
81 return static_cast<result>(
95 info.complete = complete;
96 info.user_data = user_data;
135 table.user_data =
this;
136 table.read = &read_thunk;
137 table.cancel = &cancel_thunk;
138 table.destroy = &destroy_thunk;
148 static void cancel_thunk(
void* user_data,
vgl_io_request* request)
153 static void destroy_thunk(
void* user_data)
187 table.user_data =
this;
188 table.submit = &submit_thunk;
189 table.destroy = &destroy_thunk;
200 static void destroy_thunk(
void* user_data)
vgl_result
Definition base.h:98
Definition foundation.hpp:32
allocator(const allocator &)=delete
virtual void deallocate(void *memory, std::size_t size, std::size_t alignment) noexcept=0
allocator & operator=(const allocator &)=delete
virtual ~allocator()=default
allocator(allocator &&)=delete
virtual void * allocate(std::size_t size, std::size_t alignment) noexcept=0
allocator & operator=(allocator &&)=delete
vgl_allocator_interface c_interface() noexcept
Definition foundation.hpp:49
Definition foundation.hpp:110
virtual ~io_interface()=default
io_interface & operator=(io_interface &&)=delete
io_interface(io_interface &&)=delete
vgl_io_interface c_interface() noexcept
Definition foundation.hpp:131
virtual void read(io_request *request, const io_read &read) noexcept=0
io_interface(const io_interface &)=delete
io_interface & operator=(const io_interface &)=delete
virtual void on_destroy() noexcept
Definition foundation.hpp:128
virtual void cancel(io_request *) noexcept
Definition foundation.hpp:124
Definition foundation.hpp:164
task_interface(task_interface &&)=delete
virtual result submit(task_fn function, void *task_data) noexcept=0
task_interface & operator=(task_interface &&)=delete
task_interface(const task_interface &)=delete
virtual void on_destroy() noexcept
Definition foundation.hpp:180
virtual ~task_interface()=default
task_interface & operator=(const task_interface &)=delete
vgl_task_interface c_interface() noexcept
Definition foundation.hpp:183
vgl_result vgl_io_request_complete(vgl_io_request *request, vgl_result result, const void *data, size_t size)
#define VGL_TASK_INTERFACE_VERSION
Definition foundation.h:224
struct vgl_io_request vgl_io_request
Definition foundation.h:76
#define VGL_IO_INTERFACE_VERSION
Definition foundation.h:94
#define VGL_IO_SIZE_TO_END
Definition foundation.h:79
vgl_result vgl_io_request_create(const vgl_io_request_create_info *info, vgl_io_request **out_request)
void(* vgl_task_fn)(void *user_data)
Definition foundation.h:222
#define VGL_ALLOCATOR_INTERFACE_VERSION
Definition foundation.h:41
@ VGL_LOG_LEVEL_DEFAULT
Definition foundation.h:21
@ VGL_LOG_LEVEL_ERROR
Definition foundation.h:22
@ VGL_LOG_LEVEL_DEBUG
Definition foundation.h:25
@ VGL_LOG_LEVEL_WARNING
Definition foundation.h:23
@ VGL_LOG_LEVEL_INFO
Definition foundation.h:24
void(* vgl_io_complete_fn)(void *user_data, vgl_result result, const void *data, size_t size)
Definition foundation.h:169
vgl_task_fn task_fn
Definition foundation.hpp:159
expected< io_request * > io_request_create(io_complete_fn complete, void *user_data, const vgl_allocator_interface *alloc=nullptr) noexcept
Definition foundation.hpp:90
log_level
Definition foundation.hpp:21
result
Definition base.hpp:25
vgl_io_complete_fn io_complete_fn
Definition foundation.hpp:85
vgl_io_request io_request
Definition foundation.hpp:72
result io_request_complete(io_request *request, result r, std::span< const std::byte > data={}) noexcept
Definition foundation.hpp:79
constexpr std::uint64_t io_size_to_end
Definition foundation.hpp:75
Definition foundation.h:49
Definition foundation.h:102
Definition foundation.h:83
Definition foundation.h:232