Kale
Loading...
Searching...
No Matches
src
Kale
Vulkan
ParentResource
ParentResource.hpp
Go to the documentation of this file.
1
/*
2
Copyright 2022 Rishi Challa
3
4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7
8
http://www.apache.org/licenses/LICENSE-2.0
9
10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16
17
#pragma once
18
19
#ifdef KALE_VULKAN
20
21
#include <
Kale/Core/Logger/Logger.hpp
>
22
23
#include <list>
24
25
namespace
Kale::Vulkan
{
26
30
template
<
typename
Parent>
class
ChildResource;
31
35
template
<
typename
Parent>
class
ParentResource
{
36
protected
:
37
41
std::list<ChildResource<Parent>*>
resources
;
42
43
friend
class
ChildResource
<Parent>;
44
public
:
45
49
virtual
~ParentResource
() {
50
freeChildren
();
51
}
52
56
void
freeChildren
() {
57
for
(
ChildResource<Parent>
* resource :
resources
) {
58
try
{
59
resource->freeResources(
false
);
60
}
61
catch
(
const
std::exception& e) {
62
console
.
error
(e.what());
63
}
64
}
65
resources
.clear();
66
}
67
};
68
}
69
70
#endif
Logger.hpp
Kale::Logger::error
void error(T msg)
Definition
Logger.hpp:198
Kale::Vulkan::ChildResource
Definition
ChildResource.hpp:33
Kale::Vulkan::ParentResource
Definition
ParentResource.hpp:35
Kale::Vulkan::ParentResource::~ParentResource
virtual ~ParentResource()
Definition
ParentResource.hpp:49
Kale::Vulkan::ParentResource::resources
std::list< ChildResource< Parent > * > resources
Definition
ParentResource.hpp:41
Kale::Vulkan::ParentResource::freeChildren
void freeChildren()
Definition
ParentResource.hpp:56
Kale::Vulkan
Definition
Window.hpp:42
Kale::console
Logger console
Definition
Logger.hpp:317
Generated on Tue Mar 12 2024 00:05:56 for Kale by
1.10.0