13 changed files with 715 additions and 74 deletions
@ -0,0 +1,74 @@ |
|||||
|
// Copyright 2022 Simon Boyé
|
||||
|
|
||||
|
#include <vk/DescriptorPool.h> |
||||
|
#include <vk/Context.h> |
||||
|
|
||||
|
#include <cassert> |
||||
|
|
||||
|
|
||||
|
namespace vk { |
||||
|
|
||||
|
|
||||
|
DescriptorPool::DescriptorPool() noexcept { |
||||
|
} |
||||
|
|
||||
|
DescriptorPool::DescriptorPool( |
||||
|
Context& context, |
||||
|
uint32_t max_sets, |
||||
|
Array<const VkDescriptorPoolSize> pool_sizes, |
||||
|
VkDescriptorPoolCreateFlags flags |
||||
|
) |
||||
|
: m_context(&context) |
||||
|
{ |
||||
|
assert(m_context); |
||||
|
|
||||
|
VkDescriptorPoolCreateInfo create_info { |
||||
|
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, |
||||
|
.flags = flags, |
||||
|
.maxSets = max_sets, |
||||
|
.poolSizeCount = uint32_t(pool_sizes.size()), |
||||
|
.pPoolSizes = pool_sizes.data(), |
||||
|
}; |
||||
|
if(vkCreateDescriptorPool( |
||||
|
context.device(), |
||||
|
&create_info, |
||||
|
nullptr, |
||||
|
&m_descriptor_pool |
||||
|
) != VK_SUCCESS) |
||||
|
throw std::runtime_error("failed to create descriptor pool"); |
||||
|
} |
||||
|
|
||||
|
DescriptorPool::DescriptorPool(DescriptorPool&& other) noexcept |
||||
|
{ |
||||
|
swap(*this, other); |
||||
|
} |
||||
|
|
||||
|
DescriptorPool::~DescriptorPool() noexcept { |
||||
|
if(!is_null()) |
||||
|
destroy(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
DescriptorPool& DescriptorPool::operator=(DescriptorPool&& other) noexcept { |
||||
|
swap(*this, other); |
||||
|
if(other) |
||||
|
other.destroy(); |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void DescriptorPool::destroy() noexcept { |
||||
|
assert(!is_null()); |
||||
|
assert(m_context); |
||||
|
|
||||
|
vkDestroyDescriptorPool( |
||||
|
m_context->device(), |
||||
|
m_descriptor_pool, |
||||
|
nullptr |
||||
|
); |
||||
|
|
||||
|
m_descriptor_pool = nullptr; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,68 @@ |
|||||
|
// Copyright 2022 Simon Boyé
|
||||
|
#pragma once |
||||
|
|
||||
|
#include <core/utils.h> |
||||
|
|
||||
|
#include <vk/forward.h> |
||||
|
|
||||
|
#include <vulkan/vulkan.h> |
||||
|
|
||||
|
|
||||
|
namespace vk { |
||||
|
|
||||
|
|
||||
|
class DescriptorPool { |
||||
|
public: |
||||
|
DescriptorPool() noexcept; |
||||
|
DescriptorPool( |
||||
|
Context& context, |
||||
|
uint32_t max_sets, |
||||
|
Array<const VkDescriptorPoolSize> pool_sizes, |
||||
|
VkDescriptorPoolCreateFlags flags=0 |
||||
|
); |
||||
|
DescriptorPool(const DescriptorPool&) = delete; |
||||
|
DescriptorPool(DescriptorPool&& other) noexcept; |
||||
|
~DescriptorPool() noexcept; |
||||
|
|
||||
|
DescriptorPool& operator=(const DescriptorPool&) = delete; |
||||
|
DescriptorPool& operator=(DescriptorPool&& other) noexcept; |
||||
|
|
||||
|
explicit inline operator bool() const noexcept { |
||||
|
return !is_null(); |
||||
|
} |
||||
|
|
||||
|
inline bool is_null() const noexcept { |
||||
|
return m_descriptor_pool == VK_NULL_HANDLE; |
||||
|
} |
||||
|
|
||||
|
inline const Context* context() const noexcept { |
||||
|
return m_context; |
||||
|
} |
||||
|
|
||||
|
inline Context* context() noexcept { |
||||
|
return m_context; |
||||
|
} |
||||
|
|
||||
|
inline operator VkDescriptorPool() noexcept { |
||||
|
return m_descriptor_pool; |
||||
|
} |
||||
|
|
||||
|
inline VkDescriptorPool descriptor_pool() noexcept { |
||||
|
return m_descriptor_pool; |
||||
|
} |
||||
|
|
||||
|
friend inline void swap(DescriptorPool& descriptor_pool_0, DescriptorPool& descriptor_pool_1) noexcept { |
||||
|
using std::swap; |
||||
|
swap(descriptor_pool_0.m_context, descriptor_pool_1.m_context); |
||||
|
swap(descriptor_pool_0.m_descriptor_pool, descriptor_pool_1.m_descriptor_pool); |
||||
|
} |
||||
|
|
||||
|
void destroy() noexcept; |
||||
|
|
||||
|
private: |
||||
|
Context* m_context = nullptr; |
||||
|
VkDescriptorPool m_descriptor_pool = VK_NULL_HANDLE; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,76 @@ |
|||||
|
// Copyright 2022 Simon Boyé
|
||||
|
|
||||
|
#include <vk/DescriptorSet.h> |
||||
|
#include <vk/Context.h> |
||||
|
|
||||
|
#include <cassert> |
||||
|
|
||||
|
|
||||
|
namespace vk { |
||||
|
|
||||
|
|
||||
|
DescriptorSet::DescriptorSet() noexcept { |
||||
|
} |
||||
|
|
||||
|
DescriptorSet::DescriptorSet( |
||||
|
Context& context, |
||||
|
VkDescriptorPool descriptor_pool, |
||||
|
const VkDescriptorSetLayout& set_layout |
||||
|
) |
||||
|
: Wrapper(context, 0) |
||||
|
, m_descriptor_pool(descriptor_pool) |
||||
|
{ |
||||
|
assert(m_descriptor_pool != VK_NULL_HANDLE); |
||||
|
|
||||
|
VkDescriptorSetAllocateInfo create_info { |
||||
|
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, |
||||
|
.descriptorPool = m_descriptor_pool, |
||||
|
.descriptorSetCount = 1, |
||||
|
.pSetLayouts = &set_layout, |
||||
|
}; |
||||
|
if(vkAllocateDescriptorSets( |
||||
|
context.device(), |
||||
|
&create_info, |
||||
|
&m_descriptor_set |
||||
|
) != VK_SUCCESS) |
||||
|
throw std::runtime_error("failed to create descriptor_set"); |
||||
|
} |
||||
|
|
||||
|
DescriptorSet::DescriptorSet(DescriptorSet&& other) noexcept |
||||
|
{ |
||||
|
swap(other); |
||||
|
} |
||||
|
|
||||
|
DescriptorSet::~DescriptorSet() noexcept { |
||||
|
if(!is_null()) |
||||
|
destroy(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
DescriptorSet& DescriptorSet::operator=(DescriptorSet&& other) noexcept { |
||||
|
swap(other); |
||||
|
if(other) |
||||
|
other.destroy(); |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void DescriptorSet::destroy() noexcept { |
||||
|
assert(!is_null()); |
||||
|
assert(m_context); |
||||
|
|
||||
|
if (!own_underlying_object()) |
||||
|
return; |
||||
|
|
||||
|
vkFreeDescriptorSets( |
||||
|
m_context->device(), |
||||
|
m_descriptor_pool, |
||||
|
1, |
||||
|
&m_descriptor_set |
||||
|
); |
||||
|
|
||||
|
m_descriptor_set = nullptr; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,79 @@ |
|||||
|
// Copyright 2022 Simon Boyé
|
||||
|
#pragma once |
||||
|
|
||||
|
#include <vk/forward.h> |
||||
|
#include <vk/Wrapper.h> |
||||
|
|
||||
|
#include <vulkan/vulkan.h> |
||||
|
|
||||
|
|
||||
|
namespace vk { |
||||
|
|
||||
|
|
||||
|
class DescriptorSet: public Wrapper { |
||||
|
public: |
||||
|
DescriptorSet() noexcept; |
||||
|
DescriptorSet( |
||||
|
Context& context, |
||||
|
VkDescriptorPool descriptor_pool, |
||||
|
const VkDescriptorSetLayout& set_layout |
||||
|
); |
||||
|
DescriptorSet(const DescriptorSet&) = delete; |
||||
|
DescriptorSet(DescriptorSet&& other) noexcept; |
||||
|
~DescriptorSet() noexcept; |
||||
|
|
||||
|
DescriptorSet& operator=(const DescriptorSet&) = delete; |
||||
|
DescriptorSet& operator=(DescriptorSet&& other) noexcept; |
||||
|
|
||||
|
explicit inline operator bool() const noexcept { |
||||
|
return !is_null(); |
||||
|
} |
||||
|
|
||||
|
inline bool is_null() const noexcept { |
||||
|
return m_descriptor_set == VK_NULL_HANDLE; |
||||
|
} |
||||
|
|
||||
|
inline const Context* context() const noexcept { |
||||
|
return m_context; |
||||
|
} |
||||
|
|
||||
|
inline Context* context() noexcept { |
||||
|
return m_context; |
||||
|
} |
||||
|
|
||||
|
inline const VkDescriptorPool descriptor_pool() const noexcept { |
||||
|
return m_descriptor_pool; |
||||
|
} |
||||
|
|
||||
|
inline VkDescriptorPool descriptor_pool() noexcept { |
||||
|
return m_descriptor_pool; |
||||
|
} |
||||
|
|
||||
|
inline operator VkDescriptorSet() noexcept { |
||||
|
return m_descriptor_set; |
||||
|
} |
||||
|
|
||||
|
inline VkDescriptorSet descriptor_set() noexcept { |
||||
|
return m_descriptor_set; |
||||
|
} |
||||
|
|
||||
|
inline void swap(DescriptorSet& other) noexcept { |
||||
|
using std::swap; |
||||
|
swap(m_context, other.m_context); |
||||
|
swap(m_descriptor_pool, other.m_descriptor_pool); |
||||
|
swap(m_descriptor_set, other.m_descriptor_set); |
||||
|
} |
||||
|
|
||||
|
friend inline void swap(DescriptorSet& descriptor_set_0, DescriptorSet& descriptor_set_1) noexcept { |
||||
|
descriptor_set_0.swap(descriptor_set_1); |
||||
|
} |
||||
|
|
||||
|
void destroy() noexcept; |
||||
|
|
||||
|
private: |
||||
|
VkDescriptorPool m_descriptor_pool = VK_NULL_HANDLE; |
||||
|
VkDescriptorSet m_descriptor_set = VK_NULL_HANDLE; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,67 @@ |
|||||
|
// Copyright 2022 Simon Boyé
|
||||
|
|
||||
|
#include <vk/DescriptorSetLayout.h> |
||||
|
#include <vk/Context.h> |
||||
|
|
||||
|
#include <cassert> |
||||
|
|
||||
|
|
||||
|
namespace vk { |
||||
|
|
||||
|
|
||||
|
DescriptorSetLayout::DescriptorSetLayout() noexcept { |
||||
|
} |
||||
|
|
||||
|
DescriptorSetLayout::DescriptorSetLayout(Context& context, Array<const VkDescriptorSetLayoutBinding> bindings) |
||||
|
: m_context(&context) |
||||
|
{ |
||||
|
assert(m_context); |
||||
|
|
||||
|
VkDescriptorSetLayoutCreateInfo create_info { |
||||
|
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, |
||||
|
.bindingCount = uint32_t(bindings.size()), |
||||
|
.pBindings = bindings.data(), |
||||
|
}; |
||||
|
if(vkCreateDescriptorSetLayout( |
||||
|
context.device(), |
||||
|
&create_info, |
||||
|
nullptr, |
||||
|
&m_descriptor_set_layout |
||||
|
) != VK_SUCCESS) |
||||
|
throw std::runtime_error("failed to create descriptor set layout"); |
||||
|
} |
||||
|
|
||||
|
DescriptorSetLayout::DescriptorSetLayout(DescriptorSetLayout&& other) noexcept |
||||
|
{ |
||||
|
swap(*this, other); |
||||
|
} |
||||
|
|
||||
|
DescriptorSetLayout::~DescriptorSetLayout() noexcept { |
||||
|
if(!is_null()) |
||||
|
destroy(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
DescriptorSetLayout& DescriptorSetLayout::operator=(DescriptorSetLayout&& other) noexcept { |
||||
|
swap(*this, other); |
||||
|
if(other) |
||||
|
other.destroy(); |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void DescriptorSetLayout::destroy() noexcept { |
||||
|
assert(!is_null()); |
||||
|
assert(m_context); |
||||
|
|
||||
|
vkDestroyDescriptorSetLayout( |
||||
|
m_context->device(), |
||||
|
m_descriptor_set_layout, |
||||
|
nullptr |
||||
|
); |
||||
|
|
||||
|
m_descriptor_set_layout = nullptr; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,63 @@ |
|||||
|
// Copyright 2022 Simon Boyé
|
||||
|
#pragma once |
||||
|
|
||||
|
#include <core/utils.h> |
||||
|
|
||||
|
#include <vk/forward.h> |
||||
|
|
||||
|
#include <vulkan/vulkan.h> |
||||
|
|
||||
|
|
||||
|
namespace vk { |
||||
|
|
||||
|
|
||||
|
class DescriptorSetLayout { |
||||
|
public: |
||||
|
DescriptorSetLayout() noexcept; |
||||
|
DescriptorSetLayout(Context& context, Array<const VkDescriptorSetLayoutBinding> bindings); |
||||
|
DescriptorSetLayout(const DescriptorSetLayout&) = delete; |
||||
|
DescriptorSetLayout(DescriptorSetLayout&& other) noexcept; |
||||
|
~DescriptorSetLayout() noexcept; |
||||
|
|
||||
|
DescriptorSetLayout& operator=(const DescriptorSetLayout&) = delete; |
||||
|
DescriptorSetLayout& operator=(DescriptorSetLayout&& other) noexcept; |
||||
|
|
||||
|
explicit inline operator bool() const noexcept { |
||||
|
return !is_null(); |
||||
|
} |
||||
|
|
||||
|
inline bool is_null() const noexcept { |
||||
|
return m_descriptor_set_layout == VK_NULL_HANDLE; |
||||
|
} |
||||
|
|
||||
|
inline const Context* context() const noexcept { |
||||
|
return m_context; |
||||
|
} |
||||
|
|
||||
|
inline Context* context() noexcept { |
||||
|
return m_context; |
||||
|
} |
||||
|
|
||||
|
inline operator VkDescriptorSetLayout() noexcept { |
||||
|
return m_descriptor_set_layout; |
||||
|
} |
||||
|
|
||||
|
inline VkDescriptorSetLayout descriptor_set_layout() noexcept { |
||||
|
return m_descriptor_set_layout; |
||||
|
} |
||||
|
|
||||
|
friend inline void swap(DescriptorSetLayout& descriptor_set_layout_0, DescriptorSetLayout& descriptor_set_layout_1) noexcept { |
||||
|
using std::swap; |
||||
|
swap(descriptor_set_layout_0.m_context, descriptor_set_layout_1.m_context); |
||||
|
swap(descriptor_set_layout_0.m_descriptor_set_layout, descriptor_set_layout_1.m_descriptor_set_layout); |
||||
|
} |
||||
|
|
||||
|
void destroy() noexcept; |
||||
|
|
||||
|
private: |
||||
|
Context* m_context = nullptr; |
||||
|
VkDescriptorSetLayout m_descriptor_set_layout = VK_NULL_HANDLE; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,73 @@ |
|||||
|
// Copyright 2022 Simon Boyé
|
||||
|
|
||||
|
#include <vk/PipelineLayout.h> |
||||
|
#include <vk/Context.h> |
||||
|
|
||||
|
#include <cassert> |
||||
|
|
||||
|
|
||||
|
namespace vk { |
||||
|
|
||||
|
|
||||
|
PipelineLayout::PipelineLayout() noexcept { |
||||
|
} |
||||
|
|
||||
|
PipelineLayout::PipelineLayout( |
||||
|
Context& context, |
||||
|
Array<const VkDescriptorSetLayout> set_layouts, |
||||
|
Array<const VkPushConstantRange> push_constant_ranges |
||||
|
) |
||||
|
: m_context(&context) |
||||
|
{ |
||||
|
assert(m_context); |
||||
|
|
||||
|
VkPipelineLayoutCreateInfo create_info { |
||||
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, |
||||
|
.setLayoutCount = uint32_t(set_layouts.size()), |
||||
|
.pSetLayouts = set_layouts.data(), |
||||
|
.pushConstantRangeCount = uint32_t(push_constant_ranges.size()), |
||||
|
.pPushConstantRanges = push_constant_ranges.data(), |
||||
|
}; |
||||
|
if(vkCreatePipelineLayout( |
||||
|
context.device(), |
||||
|
&create_info, |
||||
|
nullptr, |
||||
|
&m_pipeline_layout |
||||
|
) != VK_SUCCESS) |
||||
|
throw std::runtime_error("failed to create pipeline layout"); |
||||
|
} |
||||
|
|
||||
|
PipelineLayout::PipelineLayout(PipelineLayout&& other) noexcept |
||||
|
{ |
||||
|
swap(*this, other); |
||||
|
} |
||||
|
|
||||
|
PipelineLayout::~PipelineLayout() noexcept { |
||||
|
if(!is_null()) |
||||
|
destroy(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
PipelineLayout& PipelineLayout::operator=(PipelineLayout&& other) noexcept { |
||||
|
swap(*this, other); |
||||
|
if(other) |
||||
|
other.destroy(); |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void PipelineLayout::destroy() noexcept { |
||||
|
assert(!is_null()); |
||||
|
assert(m_context); |
||||
|
|
||||
|
vkDestroyPipelineLayout( |
||||
|
m_context->device(), |
||||
|
m_pipeline_layout, |
||||
|
nullptr |
||||
|
); |
||||
|
|
||||
|
m_pipeline_layout = nullptr; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,67 @@ |
|||||
|
// Copyright 2022 Simon Boyé
|
||||
|
#pragma once |
||||
|
|
||||
|
#include <core/utils.h> |
||||
|
|
||||
|
#include <vk/forward.h> |
||||
|
|
||||
|
#include <vulkan/vulkan.h> |
||||
|
|
||||
|
|
||||
|
namespace vk { |
||||
|
|
||||
|
|
||||
|
class PipelineLayout { |
||||
|
public: |
||||
|
PipelineLayout() noexcept; |
||||
|
PipelineLayout( |
||||
|
Context& context, |
||||
|
Array<const VkDescriptorSetLayout> set_layouts, |
||||
|
Array<const VkPushConstantRange> push_constant_ranges={} |
||||
|
); |
||||
|
PipelineLayout(const PipelineLayout&) = delete; |
||||
|
PipelineLayout(PipelineLayout&& other) noexcept; |
||||
|
~PipelineLayout() noexcept; |
||||
|
|
||||
|
PipelineLayout& operator=(const PipelineLayout&) = delete; |
||||
|
PipelineLayout& operator=(PipelineLayout&& other) noexcept; |
||||
|
|
||||
|
explicit inline operator bool() const noexcept { |
||||
|
return !is_null(); |
||||
|
} |
||||
|
|
||||
|
inline bool is_null() const noexcept { |
||||
|
return m_pipeline_layout == VK_NULL_HANDLE; |
||||
|
} |
||||
|
|
||||
|
inline const Context* context() const noexcept { |
||||
|
return m_context; |
||||
|
} |
||||
|
|
||||
|
inline Context* context() noexcept { |
||||
|
return m_context; |
||||
|
} |
||||
|
|
||||
|
inline operator VkPipelineLayout() noexcept { |
||||
|
return m_pipeline_layout; |
||||
|
} |
||||
|
|
||||
|
inline VkPipelineLayout pipeline_layout() noexcept { |
||||
|
return m_pipeline_layout; |
||||
|
} |
||||
|
|
||||
|
friend inline void swap(PipelineLayout& pipeline_layout_0, PipelineLayout& pipeline_layout_1) noexcept { |
||||
|
using std::swap; |
||||
|
swap(pipeline_layout_0.m_context, pipeline_layout_1.m_context); |
||||
|
swap(pipeline_layout_0.m_pipeline_layout, pipeline_layout_1.m_pipeline_layout); |
||||
|
} |
||||
|
|
||||
|
void destroy() noexcept; |
||||
|
|
||||
|
private: |
||||
|
Context* m_context = nullptr; |
||||
|
VkPipelineLayout m_pipeline_layout = VK_NULL_HANDLE; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
// Copyright 2022 Simon Boyé
|
||||
|
|
||||
|
#include <vk/Wrapper.h> |
||||
|
#include <vk/Context.h> |
||||
|
|
||||
|
#include <cassert> |
||||
|
|
||||
|
|
||||
|
namespace vk { |
||||
|
|
||||
|
|
||||
|
Wrapper::Wrapper() noexcept { |
||||
|
} |
||||
|
|
||||
|
Wrapper::Wrapper(Context& context, Flags flags) noexcept |
||||
|
: m_context(&context) |
||||
|
, m_flags(flags) |
||||
|
{ |
||||
|
assert(m_context); |
||||
|
} |
||||
|
|
||||
|
Wrapper::Wrapper(const Wrapper& other) noexcept |
||||
|
: m_context(other.m_context) |
||||
|
{} |
||||
|
|
||||
|
Wrapper::Wrapper(Wrapper&& other) noexcept |
||||
|
{ |
||||
|
swap(other); |
||||
|
} |
||||
|
|
||||
|
Wrapper::~Wrapper() noexcept { |
||||
|
} |
||||
|
|
||||
|
|
||||
|
Wrapper& Wrapper::operator=(const Wrapper& other) noexcept { |
||||
|
if (&other != this) { |
||||
|
m_context = other.m_context; |
||||
|
} |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
Wrapper& Wrapper::operator=(Wrapper&& other) noexcept { |
||||
|
swap(other); |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,56 @@ |
|||||
|
// Copyright 2022 Simon Boyé
|
||||
|
#pragma once |
||||
|
|
||||
|
#include <vk/forward.h> |
||||
|
|
||||
|
#include <vulkan/vulkan.h> |
||||
|
|
||||
|
|
||||
|
namespace vk { |
||||
|
|
||||
|
|
||||
|
class Wrapper { |
||||
|
public: |
||||
|
enum Flag { |
||||
|
OwnUnderlyingObject = 0x01, |
||||
|
}; |
||||
|
using Flags = unsigned; |
||||
|
|
||||
|
public: |
||||
|
Wrapper() noexcept; |
||||
|
Wrapper(Context& context, Flags flags=OwnUnderlyingObject) noexcept; |
||||
|
Wrapper(const Wrapper& other) noexcept; |
||||
|
Wrapper(Wrapper&& other) noexcept; |
||||
|
~Wrapper() noexcept; |
||||
|
|
||||
|
Wrapper& operator=(const Wrapper& other) noexcept; |
||||
|
Wrapper& operator=(Wrapper&& other) noexcept; |
||||
|
|
||||
|
inline const Context* context() const noexcept { |
||||
|
return m_context; |
||||
|
} |
||||
|
|
||||
|
inline Context* context() noexcept { |
||||
|
return m_context; |
||||
|
} |
||||
|
|
||||
|
inline bool own_underlying_object() const noexcept { |
||||
|
return (m_flags & Flags(OwnUnderlyingObject)) != 0; |
||||
|
} |
||||
|
|
||||
|
inline void swap(Wrapper& other) noexcept { |
||||
|
using std::swap; |
||||
|
swap(m_context, other.m_context); |
||||
|
} |
||||
|
|
||||
|
friend inline void swap(Wrapper& wrapper_0, Wrapper& wrapper_1) noexcept { |
||||
|
wrapper_0.swap(wrapper_1); |
||||
|
} |
||||
|
|
||||
|
protected: |
||||
|
Context* m_context = nullptr; |
||||
|
Flags m_flags = 0; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
} |
||||
Loading…
Reference in new issue