[nostalgia/core] Make AssetContainer non-copyable and non-movable

This commit is contained in:
Gary Talent 2022-05-21 19:36:44 -05:00
parent ec5898a897
commit 1529c82bec

View File

@ -4,9 +4,9 @@
#pragma once #pragma once
#include <ox/model/typenamecatcher.hpp>
#include <ox/event/signal.hpp> #include <ox/event/signal.hpp>
#include <ox/fs/fs.hpp> #include <ox/fs/fs.hpp>
#include <ox/model/typenamecatcher.hpp>
#include <ox/std/hashmap.hpp> #include <ox/std/hashmap.hpp>
#include <ox/std/utility.hpp> #include <ox/std/utility.hpp>
@ -18,22 +18,28 @@ template<typename T>
class AssetRef; class AssetRef;
template<typename T> template<typename T>
struct AssetContainer { class AssetContainer {
friend AssetManager; friend AssetManager;
friend AssetRef<T>; friend AssetRef<T>;
protected:
ox::Signal<ox::Error()> updated;
private: private:
T m_obj; T m_obj;
mutable int m_references = 0; mutable int m_references = 0;
public: public:
ox::Signal<ox::Error()> updated;
template<class... Args> template<class... Args>
explicit constexpr AssetContainer(Args&&... args): m_obj(ox::forward<Args>(args)...) { explicit constexpr AssetContainer(Args&&... args): m_obj(ox::forward<Args>(args)...) {
} }
AssetContainer(AssetContainer&) = delete;
AssetContainer(AssetContainer&&) = delete;
AssetContainer& operator=(AssetContainer&) = delete;
AssetContainer& operator=(AssetContainer&&) = delete;
constexpr T *get() noexcept { constexpr T *get() noexcept {
return &m_obj; return &m_obj;
} }