Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
SdlResourceBase.h
Go to the documentation of this file.
1#pragma once
2
3#include "SDL/ISdlResource.h"
4#include "SDL/SdlResourceId.h"
6
7#include <Common/assertion.h>
8
9namespace ph
10{
11
17{
18protected:
20 SdlResourceBase(const SdlResourceBase& other);
21 SdlResourceBase(SdlResourceBase&& other) = default;
22
25
26public:
28
29 SdlResourceId getId() const override;
30
31private:
32 SdlResourceId m_resourceId;
33};
34
35// In-header Implementations:
36
38
40
41 m_resourceId(gen_sdl_resource_id())
42{
43 PH_ASSERT_NE(m_resourceId, EMPTY_SDL_RESOURCE_ID);
44}
45
47
48 ISdlResource(other),
49
50 // ID should not be copied--it must be re-generated
51 m_resourceId(gen_sdl_resource_id())
52{
53 PH_ASSERT_NE(m_resourceId, EMPTY_SDL_RESOURCE_ID);
54}
55
57{
58 return m_resourceId;
59}
60
62{
64
65 // Note: m_resourceId is left unchanged--no need to re-generate as it should be done in ctors
66
67 return *this;
68}
69
70}// end namespace ph
Interface for all SDL resource.
Definition ISdlResource.h:22
ISdlResource & operator=(const ISdlResource &rhs)=default
A convenient ISdlResource with some core requirements implemented. This class does not provide static...
Definition SdlResourceBase.h:17
SdlResourceBase(SdlResourceBase &&other)=default
ESdlTypeCategory getDynamicCategory() const override=0
SdlResourceBase()
Definition SdlResourceBase.h:37
SdlResourceId getId() const override
Get the unique ID of this resource. The returned ID is guaranteed to be unique in the current process...
Definition SdlResourceBase.h:56
SdlResourceBase & operator=(const SdlResourceBase &rhs)
Definition SdlResourceBase.h:61
The root for all renderer implementations.
Definition EEngineProject.h:6
std::uint64_t SdlResourceId
Definition SdlResourceId.h:8
SdlResourceId gen_sdl_resource_id()
Definition SdlResourceId.cpp:8
constexpr SdlResourceId EMPTY_SDL_RESOURCE_ID
Definition SdlResourceId.h:10
ESdlTypeCategory
Definition ESdlTypeCategory.h:15