Asset concepts
Bigfoot / Sonarqube (push) Skipped
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 14m5s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 14m23s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 14m24s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 13m53s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 14m22s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 14m43s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 14m49s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 14m28s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 15m21s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Failing after 12m47s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Failing after 12m42s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Failing after 12m41s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Canceled after 48s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Clang Format Checks (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Canceled after 2m4s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Canceled after 2m24s

This commit is contained in:
2026-08-23 12:28:46 +02:00
parent 407401bea2
commit 8e28f50e1d
5 changed files with 49 additions and 0 deletions
@@ -6,6 +6,7 @@
*********************************************************************/
#ifndef BIGFOOT_ENGINE_ASSET_ASSET_HPP
#define BIGFOOT_ENGINE_ASSET_ASSET_HPP
#include <Engine/Asset/AssetConcepts.hpp>
#include <Engine/Asset/Asset_generated.hpp>
#include <Engine/EngineAssertHandler.hpp>
@@ -33,6 +34,7 @@ class AssetBase
};
template<class ASSET>
requires AssetTraits<ASSET>
class Asset: public AssetBase
{
public:
@@ -0,0 +1,40 @@
/*********************************************************************
* \file AssetConcepts.hpp
*
* \author Romain BOULLARD
* \date August 2026
*********************************************************************/
#ifndef BIGFOOT_ENGINE_ASSET_ASSETCONCEPTS_HPP
#define BIGFOOT_ENGINE_ASSET_ASSETCONCEPTS_HPP
#include <Engine/Asset/AssetTypeID.hpp>
#include <System/UUID/UUID.hpp>
#include <concepts>
namespace Bigfoot
{
class AssetBase;
/**
* The traits struct passed to Asset<TRAITS> (e.g. AssetATraits).
* Must name the generated flatbuffers table type for the asset.
*/
template<class TRAITS>
concept AssetTraits = requires {
typename TRAITS::FLAT;
typename TRAITS::FLAT::NativeTableType;
{ TRAITS::FLAT::GetFullyQualifiedName() } -> std::convertible_to<const char*>;
};
/**
* A concrete Asset type (e.g. AssetA), usable with AssetContainer, AssetLibrary and References.
*/
template<class ASSET>
concept AssetType = std::derived_from<ASSET, AssetBase> && !std::same_as<ASSET, AssetBase> &&
requires(const ASSET& p_asset) {
{ ASSET::GetTypeID() } -> std::convertible_to<AssetTypeID>;
{ p_asset.GetHeader().uuid } -> std::convertible_to<UUID>;
};
} // namespace Bigfoot
#endif
@@ -7,6 +7,7 @@
#ifndef BIGFOOT_ENGINE_ASSET_ASSETCONTAINER_HPP
#define BIGFOOT_ENGINE_ASSET_ASSETCONTAINER_HPP
#include <Engine/Asset/Asset.hpp>
#include <Engine/Asset/AssetConcepts.hpp>
#include <Engine/EngineAssertHandler.hpp>
#include <Utils/Containers/SlotMap.hpp>
@@ -284,6 +285,7 @@ class AssetContainerBase
/****************************************************************************************/
template<class ASSET>
requires AssetType<ASSET>
class AssetContainer: public AssetContainerBase
{
using SlotMap = StableSlotMap<ASSET>;
@@ -6,6 +6,7 @@
*********************************************************************/
#ifndef BIGFOOT_ENGINE_ASSET_ASSETLIBRARY_HPP
#define BIGFOOT_ENGINE_ASSET_ASSETLIBRARY_HPP
#include <Engine/Asset/AssetConcepts.hpp>
#include <Engine/Asset/AssetContainer.hpp>
#include <Engine/Asset/AssetTypeID.hpp>
@@ -31,6 +32,7 @@ class AssetLibrary
* \return The AssetContainer for the Asset type. Nullptr if not found
*/
template<class ASSET>
requires AssetType<ASSET>
[[nodiscard]]
bool Insert(AssetContainer<ASSET>* p_assetContainer)
{
@@ -6,6 +6,7 @@
*********************************************************************/
#ifndef BIGFOOT_ENGINE_ASSET_REFERENCE_HPP
#define BIGFOOT_ENGINE_ASSET_REFERENCE_HPP
#include <Engine/Asset/AssetConcepts.hpp>
#include <Engine/Asset/AssetLibrary.hpp>
#include <System/UUID/UUID.hpp>
@@ -43,6 +44,7 @@ class ReferenceBase
[[nodiscard]]
const ASSET* Get() const
{
static_assert(AssetType<ASSET>, "ASSET must derive from AssetBase (and not be AssetBase itself)");
return m_handle ? static_cast<const ASSET*>(m_handle->GetAsset()) : nullptr;
}
@@ -54,6 +56,7 @@ class ReferenceBase
[[nodiscard]]
ASSET* Get()
{
static_assert(AssetType<ASSET>, "ASSET must derive from AssetBase (and not be AssetBase itself)");
return m_handle ? static_cast<ASSET*>(m_handle->GetAsset()) : nullptr;
}