CreateAsset
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 57s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 45s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 30s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 47s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 32s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m10s
Bigfoot / Sonarqube (push) Skipped
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 54s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m19s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m1s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 33s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 27s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 52s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 44s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 52s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 43s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 57s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 48s
Bigfoot / Clang Format Checks (push) Successful in 11s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 41s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 25s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m16s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 44s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 27s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m8s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 54s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 57s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 45s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 30s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 47s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 32s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m10s
Bigfoot / Sonarqube (push) Skipped
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 54s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m19s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m1s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 33s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 27s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 52s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 44s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 52s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 43s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 57s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 48s
Bigfoot / Clang Format Checks (push) Successful in 11s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 41s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 25s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m16s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 44s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 27s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m8s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 54s
This commit is contained in:
@@ -30,7 +30,7 @@ class ReferenceFixture: public benchmark::Fixture
|
||||
SetActiveAssetLibrary(&m_library);
|
||||
std::ignore = m_library.Insert(&m_container);
|
||||
|
||||
m_uuid = m_container.Insert()->GetAsset()->GetHeader().uuid;
|
||||
m_uuid = CreateAsset<BenchmarkAsset>()->GetHeader().uuid;
|
||||
m_reference.emplace(m_uuid);
|
||||
}
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ BENCHMARK_DEFINE_F(SerializationManagerFixture, SaveAsset)(benchmark::State& sta
|
||||
for (auto _: state)
|
||||
{
|
||||
state.PauseTiming();
|
||||
auto* asset = static_cast<BenchmarkAsset*>(container.Insert()->GetAsset());
|
||||
auto* asset = CreateAsset<BenchmarkAsset>();
|
||||
asset->SetName(asset->GetHeader().uuid.ToString().c_str());
|
||||
asset->GetAsset().payload.assign(ASSET_PAYLOAD_SIZE, std::uint8_t {0xAB});
|
||||
for (std::uint32_t j = 0; j < REFS_PER_ROOT; ++j)
|
||||
@@ -359,7 +359,7 @@ BENCHMARK_DEFINE_F(SerializationManagerFixture, SaveAssets)(benchmark::State& st
|
||||
std::size_t batchBytes = 0;
|
||||
for (std::size_t i = 0; i < batchSize; ++i)
|
||||
{
|
||||
auto* asset = static_cast<BenchmarkAsset*>(container.Insert()->GetAsset());
|
||||
auto* asset = CreateAsset<BenchmarkAsset>();
|
||||
asset->SetName(asset->GetHeader().uuid.ToString().c_str());
|
||||
asset->GetAsset().payload.assign(ASSET_PAYLOAD_SIZE, std::uint8_t {0xAB});
|
||||
for (std::uint32_t j = 0; j < REFS_PER_ROOT; ++j)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/*********************************************************************
|
||||
* \file Asset.cpp
|
||||
* \file AssetBase.cpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date April 2026
|
||||
*********************************************************************/
|
||||
#include <Engine/Asset/Asset.hpp>
|
||||
#include <Engine/Asset/AssetBase.hpp>
|
||||
|
||||
#include <Engine/Asset/Reference_generated.hpp>
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_ENGINE_ASSET_ASSET_HPP
|
||||
#define BIGFOOT_ENGINE_ASSET_ASSET_HPP
|
||||
#include <Engine/Asset/AssetBase.hpp>
|
||||
#include <Engine/Asset/AssetConcepts.hpp>
|
||||
#include <Engine/Asset/AssetContainer.hpp>
|
||||
#include <Engine/Asset/AssetLibrary.hpp>
|
||||
#include <Engine/Asset/Asset_generated.hpp>
|
||||
#include <Engine/EngineAssertHandler.hpp>
|
||||
|
||||
@@ -18,95 +21,6 @@
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
class AssetBase
|
||||
{
|
||||
public:
|
||||
virtual ~AssetBase() = default;
|
||||
|
||||
/**
|
||||
* Get the header of the asset
|
||||
*
|
||||
* \return The header of the asset
|
||||
*/
|
||||
[[nodiscard]]
|
||||
virtual const ::Flat::Bigfoot::AssetHeaderT& GetHeader() const = 0;
|
||||
|
||||
/**
|
||||
* Get the HardReferences the flatbuffer has
|
||||
*
|
||||
* \param p_flatbuffer The flatbuffer
|
||||
* \return The UUIDs of the HardReferences
|
||||
*/
|
||||
[[nodiscard]]
|
||||
virtual eastl::vector<UUID> GetHardReferences(const eastl::span<const std::byte> p_flatbuffer) const = 0;
|
||||
|
||||
/**
|
||||
* Unpack a flatbuffer to the asset
|
||||
*
|
||||
* \param p_flatbuffer The flatbuffer to unpack
|
||||
*/
|
||||
virtual void Unpack(const eastl::span<const std::byte> p_flatbuffer) = 0;
|
||||
|
||||
/**
|
||||
* Pack the asset to a flatbuffer
|
||||
*
|
||||
* \return The packed asset
|
||||
*/
|
||||
[[nodiscard]]
|
||||
virtual eastl::vector<std::byte> Pack() const = 0;
|
||||
|
||||
protected:
|
||||
AssetBase() = default;
|
||||
|
||||
AssetBase(const AssetBase& p_asset) = delete;
|
||||
AssetBase(AssetBase&& p_asset) = default;
|
||||
|
||||
AssetBase& operator=(const AssetBase& p_asset) = delete;
|
||||
AssetBase& operator=(AssetBase&& p_asset) = default;
|
||||
|
||||
class HardReferenceVisitor: public flatbuffers::IterationVisitor
|
||||
{
|
||||
public:
|
||||
void Field(size_t p_fieldIndex,
|
||||
size_t p_setIndex,
|
||||
const flatbuffers::ElementaryType p_type,
|
||||
const bool p_isVector,
|
||||
const flatbuffers::TypeTable* p_typeTable,
|
||||
const char* p_name,
|
||||
const std::uint8_t* p_val) override;
|
||||
|
||||
void Element(size_t p_index,
|
||||
const flatbuffers::ElementaryType p_type,
|
||||
const flatbuffers::TypeTable* p_typeTable,
|
||||
const std::uint8_t* p_val) override;
|
||||
|
||||
/**
|
||||
* Get the visited HardReference
|
||||
*
|
||||
* \return The visited HardReferences
|
||||
*/
|
||||
[[nodiscard]]
|
||||
eastl::vector<UUID> GetUUIDs() const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Visit an element in the flatbuffer
|
||||
*
|
||||
* \param p_type The element type
|
||||
* \param p_typeTable The element typetable
|
||||
* \param p_val The element
|
||||
*/
|
||||
void Visit(const flatbuffers::ElementaryType p_type,
|
||||
const flatbuffers::TypeTable* p_typeTable,
|
||||
const std::uint8_t* p_val);
|
||||
|
||||
/**
|
||||
* The HardReferences visited so far
|
||||
*/
|
||||
ankerl::unordered_dense::set<UUID> m_uuids;
|
||||
};
|
||||
};
|
||||
|
||||
template<class ASSET>
|
||||
requires AssetTraits<ASSET>
|
||||
class Asset: public AssetBase
|
||||
@@ -277,6 +191,24 @@ class Asset: public AssetBase
|
||||
*/
|
||||
::Flat::Bigfoot::AssetHeaderT m_header;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create an asset and insert it into its corresponding AssetContainer
|
||||
*
|
||||
* \tparam ASSET The Asset type
|
||||
* \return The created asset, nullptr if no AssetContainer is registered for ASSET
|
||||
*/
|
||||
template<class ASSET>
|
||||
requires AssetType<ASSET>
|
||||
[[nodiscard]]
|
||||
ASSET* CreateAsset()
|
||||
{
|
||||
AssetContainerBase* container = g_activeAssetLibrary->GetAssetContainer(ASSET::GetTypeID());
|
||||
CRITICAL_ASSERT(EngineAssertHandler, container != nullptr, "No AssetContainer registered for this asset type!");
|
||||
|
||||
ContainerHandle* handle = container->Insert();
|
||||
return static_cast<ASSET*>(handle->GetAsset());
|
||||
}
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
/*********************************************************************
|
||||
* \file AssetBase.hpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date April 2026
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_ENGINE_ASSET_ASSETBASE_HPP
|
||||
#define BIGFOOT_ENGINE_ASSET_ASSETBASE_HPP
|
||||
#include <Engine/Asset/Asset_generated.hpp>
|
||||
|
||||
#include <System/UUID/UUID.hpp>
|
||||
|
||||
#include <EASTL/span.h>
|
||||
#include <EASTL/vector.h>
|
||||
#include <ankerl/unordered_dense.h>
|
||||
#include <flatbuffers/minireflect.h>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
class AssetBase
|
||||
{
|
||||
public:
|
||||
virtual ~AssetBase() = default;
|
||||
|
||||
/**
|
||||
* Get the header of the asset
|
||||
*
|
||||
* \return The header of the asset
|
||||
*/
|
||||
[[nodiscard]]
|
||||
virtual const ::Flat::Bigfoot::AssetHeaderT& GetHeader() const = 0;
|
||||
|
||||
/**
|
||||
* Get the HardReferences the flatbuffer has
|
||||
*
|
||||
* \param p_flatbuffer The flatbuffer
|
||||
* \return The UUIDs of the HardReferences
|
||||
*/
|
||||
[[nodiscard]]
|
||||
virtual eastl::vector<UUID> GetHardReferences(const eastl::span<const std::byte> p_flatbuffer) const = 0;
|
||||
|
||||
/**
|
||||
* Unpack a flatbuffer to the asset
|
||||
*
|
||||
* \param p_flatbuffer The flatbuffer to unpack
|
||||
*/
|
||||
virtual void Unpack(const eastl::span<const std::byte> p_flatbuffer) = 0;
|
||||
|
||||
/**
|
||||
* Pack the asset to a flatbuffer
|
||||
*
|
||||
* \return The packed asset
|
||||
*/
|
||||
[[nodiscard]]
|
||||
virtual eastl::vector<std::byte> Pack() const = 0;
|
||||
|
||||
protected:
|
||||
AssetBase() = default;
|
||||
|
||||
AssetBase(const AssetBase& p_asset) = delete;
|
||||
AssetBase(AssetBase&& p_asset) = default;
|
||||
|
||||
AssetBase& operator=(const AssetBase& p_asset) = delete;
|
||||
AssetBase& operator=(AssetBase&& p_asset) = default;
|
||||
|
||||
class HardReferenceVisitor: public flatbuffers::IterationVisitor
|
||||
{
|
||||
public:
|
||||
void Field(size_t p_fieldIndex,
|
||||
size_t p_setIndex,
|
||||
const flatbuffers::ElementaryType p_type,
|
||||
const bool p_isVector,
|
||||
const flatbuffers::TypeTable* p_typeTable,
|
||||
const char* p_name,
|
||||
const std::uint8_t* p_val) override;
|
||||
|
||||
void Element(size_t p_index,
|
||||
const flatbuffers::ElementaryType p_type,
|
||||
const flatbuffers::TypeTable* p_typeTable,
|
||||
const std::uint8_t* p_val) override;
|
||||
|
||||
/**
|
||||
* Get the visited HardReference
|
||||
*
|
||||
* \return The visited HardReferences
|
||||
*/
|
||||
[[nodiscard]]
|
||||
eastl::vector<UUID> GetUUIDs() const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Visit an element in the flatbuffer
|
||||
*
|
||||
* \param p_type The element type
|
||||
* \param p_typeTable The element typetable
|
||||
* \param p_val The element
|
||||
*/
|
||||
void Visit(const flatbuffers::ElementaryType p_type,
|
||||
const flatbuffers::TypeTable* p_typeTable,
|
||||
const std::uint8_t* p_val);
|
||||
|
||||
/**
|
||||
* The HardReferences visited so far
|
||||
*/
|
||||
ankerl::unordered_dense::set<UUID> m_uuids;
|
||||
};
|
||||
};
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif
|
||||
@@ -6,7 +6,7 @@
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_ENGINE_ASSET_ASSETCONTAINER_HPP
|
||||
#define BIGFOOT_ENGINE_ASSET_ASSETCONTAINER_HPP
|
||||
#include <Engine/Asset/Asset.hpp>
|
||||
#include <Engine/Asset/AssetBase.hpp>
|
||||
#include <Engine/Asset/AssetConcepts.hpp>
|
||||
#include <Engine/EngineAssertHandler.hpp>
|
||||
|
||||
|
||||
@@ -20,6 +20,10 @@ class AssetFixture: public ::testing::Test
|
||||
protected:
|
||||
void SetUp() override
|
||||
{
|
||||
SetActiveAssetLibrary(&m_library);
|
||||
std::ignore = m_library.Insert(&m_containerA);
|
||||
std::ignore = m_library.Insert(&m_containerB);
|
||||
|
||||
const UUID uuidA = m_assetA.GetHeader().uuid;
|
||||
const UUID uuidB = m_assetB.GetHeader().uuid;
|
||||
|
||||
@@ -35,6 +39,15 @@ class AssetFixture: public ::testing::Test
|
||||
m_assetC.GetAsset().asset_b_refs.push_back(SoftReference<AssetB> {uuidB});
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
SetActiveAssetLibrary(&g_assetLibrary);
|
||||
}
|
||||
|
||||
AssetLibrary m_library;
|
||||
AssetContainer<AssetA> m_containerA;
|
||||
AssetContainer<AssetB> m_containerB;
|
||||
|
||||
AssetA m_assetA;
|
||||
AssetB m_assetB;
|
||||
AssetC m_assetC;
|
||||
@@ -117,4 +130,45 @@ TEST_F(AssetFixture, GetHardReferences_ShouldReturnTheHardReferencesOfTheAsset)
|
||||
|
||||
EXPECT_THAT(hardReferences, ::testing::UnorderedElementsAre(m_assetA.GetHeader().uuid, m_assetB.GetHeader().uuid));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(AssetFixture, CreateAsset_ShouldReturnTheCreatedAsset)
|
||||
{
|
||||
EXPECT_NE(CreateAsset<AssetA>(), nullptr);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(AssetFixture, CreateAsset_ShouldCreateUniqueAssets)
|
||||
{
|
||||
const AssetA* first = CreateAsset<AssetA>();
|
||||
const AssetA* second = CreateAsset<AssetA>();
|
||||
|
||||
EXPECT_NE(first->GetHeader().uuid, second->GetHeader().uuid);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(AssetFixture, CreateAsset_ShouldReturnTheSameAssetAsItsContainerHandle)
|
||||
{
|
||||
const AssetA* asset = CreateAsset<AssetA>();
|
||||
const ContainerHandle* handle = m_containerA.AcquireContainerHandle(asset->GetHeader().uuid);
|
||||
|
||||
EXPECT_EQ(handle->GetAsset(), asset);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(AssetFixture, CreateAsset_ShouldInsertTheAssetIntoItsCorrespondingContainer)
|
||||
{
|
||||
const AssetA* assetA = CreateAsset<AssetA>();
|
||||
const AssetB* assetB = CreateAsset<AssetB>();
|
||||
|
||||
EXPECT_TRUE(m_containerA.Has(assetA->GetHeader().uuid));
|
||||
EXPECT_FALSE(m_containerB.Has(assetA->GetHeader().uuid));
|
||||
|
||||
EXPECT_TRUE(m_containerB.Has(assetB->GetHeader().uuid));
|
||||
EXPECT_FALSE(m_containerA.Has(assetB->GetHeader().uuid));
|
||||
}
|
||||
} // namespace Bigfoot
|
||||
|
||||
@@ -184,11 +184,11 @@ TEST_F(AssetLibraryFixture, ProcessPendingRemovals_ShouldCascadeThroughHardRefer
|
||||
|
||||
{
|
||||
// leaf
|
||||
AssetA* leaf = static_cast<AssetA*>(m_containerA.Insert()->GetAsset());
|
||||
AssetA* leaf = CreateAsset<AssetA>();
|
||||
leafUUID = leaf->GetHeader().uuid;
|
||||
|
||||
// middle --> leaf
|
||||
AssetB* middle = static_cast<AssetB*>(m_containerB.Insert()->GetAsset());
|
||||
AssetB* middle = CreateAsset<AssetB>();
|
||||
middle->GetAsset().ref_a = HardReference<AssetA> {leafUUID};
|
||||
middleUUID = middle->GetHeader().uuid;
|
||||
|
||||
@@ -196,7 +196,7 @@ TEST_F(AssetLibraryFixture, ProcessPendingRemovals_ShouldCascadeThroughHardRefer
|
||||
// / \
|
||||
// v v
|
||||
// middle --> leaf
|
||||
AssetC* root = static_cast<AssetC*>(m_containerC.Insert()->GetAsset());
|
||||
AssetC* root = CreateAsset<AssetC>();
|
||||
root->GetAsset().asset_b_ref = HardReference<AssetB> {middleUUID};
|
||||
root->GetAsset().inner_table->asset_a_ref = HardReference<AssetA> {leafUUID};
|
||||
rootUUID = root->GetHeader().uuid;
|
||||
|
||||
@@ -96,7 +96,7 @@ TYPED_TEST(ReferenceFixture, GetUUID_ShouldReturnTheUUID)
|
||||
|
||||
TYPED_TEST(ReferenceFixture, Get_ShouldReturnTheAsset)
|
||||
{
|
||||
const AssetA* inserted = static_cast<const AssetA*>(this->m_containerA.Insert()->GetAsset());
|
||||
const AssetA* inserted = CreateAsset<AssetA>();
|
||||
const UUID uuid = inserted->GetHeader().uuid;
|
||||
|
||||
TypeParam ref {uuid};
|
||||
@@ -120,7 +120,7 @@ TYPED_TEST(ReferenceFixture, Get_ShouldReturnNullptrIfTheAssetDoesNotExist)
|
||||
|
||||
TYPED_TEST(ReferenceFixture, Get_ShouldReturnNullptrAfterTheAssetIsRemovedFromTheContainer)
|
||||
{
|
||||
const AssetA* inserted = static_cast<const AssetA*>(this->m_containerA.Insert()->GetAsset());
|
||||
const AssetA* inserted = CreateAsset<AssetA>();
|
||||
const UUID uuid = inserted->GetHeader().uuid;
|
||||
|
||||
TypeParam ref {uuid};
|
||||
@@ -157,7 +157,7 @@ TYPED_TEST(ReferenceFixture, ShouldTouchTheRefCountOfTheHandle)
|
||||
|
||||
TYPED_TEST(ReferenceFixture, CopyConstructor_ShouldIncrementTheRefCountAndCopyTheState)
|
||||
{
|
||||
const AssetA* inserted = static_cast<const AssetA*>(this->m_containerA.Insert()->GetAsset());
|
||||
const AssetA* inserted = CreateAsset<AssetA>();
|
||||
const UUID uuid = inserted->GetHeader().uuid;
|
||||
const ContainerHandle* handle = this->m_containerA.AcquireContainerHandle(uuid);
|
||||
|
||||
@@ -175,7 +175,7 @@ TYPED_TEST(ReferenceFixture, CopyConstructor_ShouldIncrementTheRefCountAndCopyTh
|
||||
|
||||
TYPED_TEST(ReferenceFixture, MoveConstructor_ShouldTransferTheStateWithoutChangingTheRefCount)
|
||||
{
|
||||
const AssetA* inserted = static_cast<const AssetA*>(this->m_containerA.Insert()->GetAsset());
|
||||
const AssetA* inserted = CreateAsset<AssetA>();
|
||||
const UUID uuid = inserted->GetHeader().uuid;
|
||||
const ContainerHandle* handle = this->m_containerA.AcquireContainerHandle(uuid);
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ TEST_F(SerializationManagerFixture, LoadAsset_ShouldSkipAssetsThatAreCaughtInACy
|
||||
|
||||
TEST_F(SerializationManagerFixture, LoadAsset_ShouldNotReloadAnAssetThatIsAlreadyLoaded)
|
||||
{
|
||||
AssetA* alreadyLoaded = static_cast<AssetA*>(m_containerA.Insert()->GetAsset());
|
||||
AssetA* alreadyLoaded = CreateAsset<AssetA>();
|
||||
alreadyLoaded->SetName("in-memory");
|
||||
const UUID uuid = alreadyLoaded->GetHeader().uuid;
|
||||
|
||||
@@ -305,7 +305,7 @@ TEST_F(SerializationManagerFixture, LoadAssets_ShouldLoadEveryRootAndMergeShared
|
||||
#ifdef BIGFOOT_TOOLMODE
|
||||
TEST_F(SerializationManagerFixture, SaveAsset_ShouldSaveTheAsset)
|
||||
{
|
||||
AssetB* asset = static_cast<AssetB*>(m_containerB.Insert()->GetAsset());
|
||||
AssetB* asset = CreateAsset<AssetB>();
|
||||
const UUID referencedUUID;
|
||||
asset->GetAsset().ref_a = HardReference<AssetA> {referencedUUID};
|
||||
|
||||
@@ -323,7 +323,7 @@ TEST_F(SerializationManagerFixture, SaveAsset_ShouldSaveTheAsset)
|
||||
|
||||
TEST_F(SerializationManagerFixture, SaveAsset_ShouldFailAndNotSaveIfAnAssetHardReferencesItself)
|
||||
{
|
||||
AssetB* asset = static_cast<AssetB*>(m_containerB.Insert()->GetAsset());
|
||||
AssetB* asset = CreateAsset<AssetB>();
|
||||
const UUID uuid = asset->GetHeader().uuid;
|
||||
asset->GetAsset().ref_a = HardReference<AssetA> {uuid};
|
||||
|
||||
@@ -338,8 +338,8 @@ TEST_F(SerializationManagerFixture, SaveAsset_ShouldFailAndNotSaveIfAnAssetHardR
|
||||
|
||||
TEST_F(SerializationManagerFixture, SaveAssets_ShouldFailAndNotSaveIfTwoAssetsInTheSameSaveHardReferenceEachOther)
|
||||
{
|
||||
AssetB* assetX = static_cast<AssetB*>(m_containerB.Insert()->GetAsset());
|
||||
AssetB* assetY = static_cast<AssetB*>(m_containerB.Insert()->GetAsset());
|
||||
AssetB* assetX = CreateAsset<AssetB>();
|
||||
AssetB* assetY = CreateAsset<AssetB>();
|
||||
|
||||
const UUID uuidX = assetX->GetHeader().uuid;
|
||||
const UUID uuidY = assetY->GetHeader().uuid;
|
||||
@@ -361,7 +361,7 @@ TEST_F(SerializationManagerFixture, SaveAssets_ShouldFailAndNotSaveIfTwoAssetsIn
|
||||
|
||||
TEST_F(SerializationManagerFixture, SaveAssets_ShouldFailAndNotSaveIfAnAlreadySavedHardReferencePointsBackToIt)
|
||||
{
|
||||
AssetB* asset = static_cast<AssetB*>(m_containerB.Insert()->GetAsset());
|
||||
AssetB* asset = CreateAsset<AssetB>();
|
||||
const UUID uuid = asset->GetHeader().uuid;
|
||||
const UUID referencedUUID;
|
||||
asset->GetAsset().ref_a = HardReference<AssetA> {referencedUUID};
|
||||
@@ -383,8 +383,8 @@ TEST_F(SerializationManagerFixture, SaveAssets_ShouldFailAndNotSaveIfAnAlreadySa
|
||||
|
||||
TEST_F(SerializationManagerFixture, SaveAssets_ShouldSaveEveryAsset)
|
||||
{
|
||||
const AssetA* assetX = static_cast<const AssetA*>(m_containerA.Insert()->GetAsset());
|
||||
const AssetA* assetY = static_cast<const AssetA*>(m_containerA.Insert()->GetAsset());
|
||||
const AssetA* assetX = CreateAsset<AssetA>();
|
||||
const AssetA* assetY = CreateAsset<AssetA>();
|
||||
|
||||
const UUID uuidX = assetX->GetHeader().uuid;
|
||||
const UUID uuidY = assetY->GetHeader().uuid;
|
||||
|
||||
Reference in New Issue
Block a user