From 9b2769cf0f713bc786ffa18019591aff6976a9f4 Mon Sep 17 00:00:00 2001 From: Romain BOULLARD Date: Wed, 29 Jul 2026 23:28:44 +0200 Subject: [PATCH] Refactoring Reference #1 --- .../Engine/Include/Engine/Asset/Asset.hpp | 38 +++++- .../Include/Engine/Asset/AssetHelper.hpp | 60 +-------- .../Engine/Include/Engine/Asset/Reference.fbs | 15 --- .../Engine/Include/Engine/Asset/Reference.hpp | 60 +++++++-- .../Engine/Asset/Reference_generated.hpp | 123 ------------------ Bigfoot/Tests/Engine/Asset/Asset.cpp | 56 ++++---- .../Misc/AssetsForTesting/Asset/AssetA.cpp | 2 +- .../Misc/AssetsForTesting/Asset/AssetARef.cpp | 9 -- .../Misc/AssetsForTesting/Asset/AssetB.cpp | 2 +- .../Misc/AssetsForTesting/Asset/AssetBRef.cpp | 9 -- .../Misc/AssetsForTesting/Asset/AssetC.cpp | 2 +- .../Misc/AssetsForTesting/Asset/AssetCRef.cpp | 9 -- .../Include/AssetsForTesting/Asset/AssetA.fbs | 4 - .../Include/AssetsForTesting/Asset/AssetA.hpp | 4 +- .../AssetsForTesting/Asset/AssetARef.hpp | 18 --- .../Asset/AssetA_generated.hpp | 6 - .../Include/AssetsForTesting/Asset/AssetB.fbs | 6 - .../Include/AssetsForTesting/Asset/AssetB.hpp | 4 +- .../AssetsForTesting/Asset/AssetBRef.hpp | 18 --- .../Asset/AssetB_generated.hpp | 51 +------- .../Include/AssetsForTesting/Asset/AssetC.fbs | 9 -- .../Include/AssetsForTesting/Asset/AssetC.hpp | 4 +- .../AssetsForTesting/Asset/AssetCRef.hpp | 18 --- .../Asset/AssetC_generated.hpp | 102 ++------------- CMake/Utils.cmake | 2 +- 25 files changed, 138 insertions(+), 493 deletions(-) delete mode 100644 Bigfoot/Sources/Engine/Include/Engine/Asset/Reference.fbs delete mode 100644 Bigfoot/Sources/Engine/Include/Engine/Asset/Reference_generated.hpp delete mode 100644 Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetARef.cpp delete mode 100644 Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetBRef.cpp delete mode 100644 Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetCRef.cpp delete mode 100644 Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetARef.hpp delete mode 100644 Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetBRef.hpp delete mode 100644 Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetCRef.hpp diff --git a/Bigfoot/Sources/Engine/Include/Engine/Asset/Asset.hpp b/Bigfoot/Sources/Engine/Include/Engine/Asset/Asset.hpp index dea8a76..01618c3 100644 --- a/Bigfoot/Sources/Engine/Include/Engine/Asset/Asset.hpp +++ b/Bigfoot/Sources/Engine/Include/Engine/Asset/Asset.hpp @@ -7,7 +7,6 @@ #ifndef BIGFOOT_ENGINE_ASSET_ASSET_HPP #define BIGFOOT_ENGINE_ASSET_ASSET_HPP #include -#include #include #include @@ -25,6 +24,8 @@ class Asset using FLAT_ASSET = typename ASSET::FLAT; Asset(): + m_hardRefCount(0), + m_softRefCount(0), m_header(::Flat::Bigfoot::AssetHeaderT {.uuid = UUID {}, .name = eastl::string {}, .type_id = GetTypeID(), @@ -59,6 +60,38 @@ class Asset ~Asset() = default; + void IncrementHardRefCount() + { + m_hardRefCount++; + } + + void DecrementHardRefCount() + { + m_hardRefCount--; + } + + [[nodiscard]] + std::uint32_t GetHardRefCount() const + { + return m_hardRefCount; + } + + void IncrementSoftRefCount() + { + m_softRefCount++; + } + + void DecrementSoftRefCount() + { + m_hardRefCount--; + } + + [[nodiscard]] + std::uint32_t GetSoftRefCount() const + { + return m_softRefCount; + } + [[nodiscard]] const ::Flat::Bigfoot::AssetHeaderT& GetHeader() const { @@ -123,6 +156,9 @@ class Asset Asset& operator=(Asset&& p_asset) = default; private: + std::uint32_t m_hardRefCount; + std::uint32_t m_softRefCount; + ::Flat::Bigfoot::AssetHeaderT m_header; typename FLAT_ASSET::NativeTableType m_asset; }; diff --git a/Bigfoot/Sources/Engine/Include/Engine/Asset/AssetHelper.hpp b/Bigfoot/Sources/Engine/Include/Engine/Asset/AssetHelper.hpp index 4e85a86..d7496ab 100644 --- a/Bigfoot/Sources/Engine/Include/Engine/Asset/AssetHelper.hpp +++ b/Bigfoot/Sources/Engine/Include/Engine/Asset/AssetHelper.hpp @@ -8,65 +8,11 @@ #define BIGFOOT_ENGINE_ASSET_ASSETHELPER_HPP #include #include -#include -#include -#define ASSET_SOFT_REF_DECL(AssetName, AssetType) \ - namespace flatbuffers \ - { \ - Flat::Bigfoot::SoftReference PackSoftReference##AssetName(const Bigfoot::SoftReference& p_softRef); \ - Bigfoot::SoftReference UnPackSoftReference##AssetName(const Flat::Bigfoot::SoftReference& p_softRef); \ - } - -#define ASSET_HARD_REF_DECL(AssetName, AssetType) \ - namespace flatbuffers \ - { \ - Flat::Bigfoot::HardReference PackHardReference##AssetName(const Bigfoot::HardReference& p_hardRef); \ - Bigfoot::HardReference UnPackHardReference##AssetName(const Flat::Bigfoot::HardReference& p_hardRef); \ - } - -#define ASSET_REF_DECL(AssetName, AssetType) \ - ASSET_SOFT_REF_DECL(AssetName, AssetType) \ - ASSET_HARD_REF_DECL(AssetName, AssetType) - -/****************************************************************************************/ - -#define ASSET_SOFT_REF_IMPL(AssetName, AssetType) \ - namespace flatbuffers \ - { \ - Flat::Bigfoot::SoftReference PackSoftReference##AssetName(const Bigfoot::SoftReference& p_softRef) \ - { \ - return {flatbuffers::Pack(p_softRef.GetUUID())}; \ - } \ - Bigfoot::SoftReference UnPackSoftReference##AssetName(const Flat::Bigfoot::SoftReference& p_softRef) \ - { \ - return {flatbuffers::UnPack(p_softRef.uuid())}; \ - } \ - } - -#define ASSET_HARD_REF_IMPL(AssetName, AssetType) \ - namespace flatbuffers \ - { \ - Flat::Bigfoot::HardReference PackHardReference##AssetName(const Bigfoot::HardReference& p_hardRef) \ - { \ - return {flatbuffers::Pack(p_hardRef.GetUUID())}; \ - } \ - Bigfoot::HardReference UnPackHardReference##AssetName(const Flat::Bigfoot::HardReference& p_hardRef) \ - { \ - return {flatbuffers::UnPack(p_hardRef.uuid())}; \ - } \ - } - -#define ASSET_REF_IMPL(AssetName, AssetType) \ - ASSET_SOFT_REF_IMPL(AssetName, AssetType) \ - ASSET_HARD_REF_IMPL(AssetName, AssetType) - -/****************************************************************************************/ - -#define ASSET_CONTAINER(AssetType) \ +#define ASSET_CONTAINER(AssetName, AssetType) \ namespace Bigfoot \ { \ - AssetContainer g_containerFor##AssetType; \ - const bool g_insertedContainerFor##AssetType = g_assetLibrary.Insert(&g_containerFor##AssetType); \ + AssetContainer g_containerFor##AssetName; \ + const bool g_insertedContainerFor##AssetName = g_assetLibrary.Insert(&g_containerFor##AssetName); \ } #endif diff --git a/Bigfoot/Sources/Engine/Include/Engine/Asset/Reference.fbs b/Bigfoot/Sources/Engine/Include/Engine/Asset/Reference.fbs deleted file mode 100644 index 4529a78..0000000 --- a/Bigfoot/Sources/Engine/Include/Engine/Asset/Reference.fbs +++ /dev/null @@ -1,15 +0,0 @@ -native_include "Engine/Asset/Reference.hpp"; - -include "System/UUID/UUID.fbs"; - -namespace Flat.Bigfoot; - -struct HardReference -{ - uuid:UUID; -} - -struct SoftReference -{ - uuid:UUID; -} \ No newline at end of file diff --git a/Bigfoot/Sources/Engine/Include/Engine/Asset/Reference.hpp b/Bigfoot/Sources/Engine/Include/Engine/Asset/Reference.hpp index 8007dc9..94d7c9c 100644 --- a/Bigfoot/Sources/Engine/Include/Engine/Asset/Reference.hpp +++ b/Bigfoot/Sources/Engine/Include/Engine/Asset/Reference.hpp @@ -6,7 +6,7 @@ *********************************************************************/ #ifndef BIGFOOT_ENGINE_ASSET_REFERENCE_HPP #define BIGFOOT_ENGINE_ASSET_REFERENCE_HPP -#include +#include #include @@ -27,13 +27,15 @@ class HardReference } HardReference(const HardReference& p_ref): - m_uuid(p_ref.m_uuid) + m_uuid(p_ref.m_uuid), + m_slotKey(p_ref.m_slotKey) { Acquire(); } HardReference(HardReference&& p_ref) noexcept: - m_uuid(std::exchange(p_ref.m_uuid, UUID::NULL_UUID)) + m_uuid(std::exchange(p_ref.m_uuid, UUID::NULL_UUID)), + m_slotKey(std::exchange(p_ref.m_slotKey, typename SlotMap::SlotKey {})) { } @@ -54,6 +56,7 @@ class HardReference { Release(); m_uuid = p_ref.m_uuid; + m_slotKey = p_ref.m_slotKey; Acquire(); } return *this; @@ -65,6 +68,7 @@ class HardReference { Release(); m_uuid = std::exchange(p_ref.m_uuid, UUID::NULL_UUID); + std::exchange(p_ref.m_slotKey, typename SlotMap::SlotKey {}); } return *this; } @@ -78,21 +82,34 @@ class HardReference private: void Acquire() { - if (m_uuid) + if (AssetContainer* assetContainer = g_assetLibrary.Get() ; assetContainer && m_uuid) { - // AssetContainer::Get().IncrementHardRefCount(m_uuid); + if (!m_slotKey.Valid()) + { + m_slotKey = assetContainer->GetSlotKey(m_uuid); + } + + if (ASSET* asset = assetContainer->Get(m_slotKey)) + { + asset->IncrementHardRefCount(); + } } } void Release() { - if (m_uuid) + if (AssetContainer* assetContainer = g_assetLibrary.Get(); assetContainer && m_uuid) { - // AssetContainer::Get().DecrementHardRefCount(m_uuid); + // Acquire always happens before Release, so slot key should be valid + if (ASSET* asset = assetContainer->Get(m_slotKey)) + { + asset->IncrementHardRefCount(); + } } } UUID m_uuid = UUID::NULL_UUID; + typename SlotMap::SlotKey m_slotKey; }; template @@ -108,13 +125,15 @@ class SoftReference } SoftReference(const SoftReference& p_ref): - m_uuid(p_ref.m_uuid) + m_uuid(p_ref.m_uuid), + m_slotKey(p_ref.m_slotKey) { Acquire(); } SoftReference(SoftReference&& p_ref) noexcept: - m_uuid(std::exchange(p_ref.m_uuid, UUID::NULL_UUID)) + m_uuid(std::exchange(p_ref.m_uuid, UUID::NULL_UUID)), + m_slotKey(std::exchange(p_ref.m_slotKey, typename SlotMap::SlotKey {})) { } @@ -135,6 +154,7 @@ class SoftReference { Release(); m_uuid = p_ref.m_uuid; + m_slotKey = p_ref.m_slotKey; Acquire(); } return *this; @@ -146,6 +166,7 @@ class SoftReference { Release(); m_uuid = std::exchange(p_ref.m_uuid, UUID::NULL_UUID); + m_slotKey = std::exchange(p_ref.m_slotKey, typename SlotMap::SlotKey {}); } return *this; } @@ -159,21 +180,34 @@ class SoftReference private: void Acquire() { - if (m_uuid) + if (AssetContainer* assetContainer = g_assetLibrary.Get(); assetContainer && m_uuid) { - // AssetContainer::Get().IncrementSoftRefCount(m_uuid); + if (!m_slotKey.Valid()) + { + m_slotKey = assetContainer->GetSlotKey(m_uuid); + } + + if (ASSET* asset = assetContainer->Get(m_slotKey)) + { + asset->IncrementSoftRefCount(); + } } } void Release() { - if (m_uuid) + if (AssetContainer* assetContainer = g_assetLibrary.Get(); assetContainer && m_uuid) { - // AssetContainer::Get().DecrementSoftRefCount(m_uuid); + // Acquire always happens before Release, so slot key should be valid + if (ASSET* asset = assetContainer->Get(m_slotKey)) + { + asset->DecrementSoftRefCount(); + } } } UUID m_uuid = UUID::NULL_UUID; + typename SlotMap::SlotKey m_slotKey; }; } // namespace Bigfoot #endif diff --git a/Bigfoot/Sources/Engine/Include/Engine/Asset/Reference_generated.hpp b/Bigfoot/Sources/Engine/Include/Engine/Asset/Reference_generated.hpp deleted file mode 100644 index 8128d52..0000000 --- a/Bigfoot/Sources/Engine/Include/Engine/Asset/Reference_generated.hpp +++ /dev/null @@ -1,123 +0,0 @@ -// automatically generated by the FlatBuffers compiler, do not modify - - -#ifndef FLATBUFFERS_GENERATED_REFERENCE_FLAT_BIGFOOT_H_ -#define FLATBUFFERS_GENERATED_REFERENCE_FLAT_BIGFOOT_H_ - -#include "flatbuffers/flatbuffers.h" - -// Ensure the included flatbuffers.h is the same version as when this file was -// generated, otherwise it may not be compatible. -static_assert(FLATBUFFERS_VERSION_MAJOR == 25 && - FLATBUFFERS_VERSION_MINOR == 12 && - FLATBUFFERS_VERSION_REVISION == 19, - "Non-compatible flatbuffers version included"); - -#include "Engine/Asset/Reference.hpp" -#include "System/UUID/UUID.hpp" -#include "Engine/Asset/Reference.hpp" -#include "System/UUID/UUID_generated.hpp" - -#include "EASTL/unique_ptr.h" -#include "EASTL/string.h" -#include "EASTL/vector.h" - -namespace Flat { -namespace Bigfoot { - -struct HardReference; - -struct SoftReference; - -inline const ::flatbuffers::TypeTable *HardReferenceTypeTable(); - -inline const ::flatbuffers::TypeTable *SoftReferenceTypeTable(); - -FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) HardReference FLATBUFFERS_FINAL_CLASS { - private: - Flat::Bigfoot::UUID uuid_; - - public: - struct Traits; - static const ::flatbuffers::TypeTable *MiniReflectTypeTable() { - return HardReferenceTypeTable(); - } - static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { - return "Flat.Bigfoot.HardReference"; - } - HardReference() - : uuid_() { - } - HardReference(const Flat::Bigfoot::UUID &_uuid) - : uuid_(_uuid) { - } - const Flat::Bigfoot::UUID &uuid() const { - return uuid_; - } -}; -FLATBUFFERS_STRUCT_END(HardReference, 16); - -struct HardReference::Traits { - using type = HardReference; -}; - -FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) SoftReference FLATBUFFERS_FINAL_CLASS { - private: - Flat::Bigfoot::UUID uuid_; - - public: - struct Traits; - static const ::flatbuffers::TypeTable *MiniReflectTypeTable() { - return SoftReferenceTypeTable(); - } - static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { - return "Flat.Bigfoot.SoftReference"; - } - SoftReference() - : uuid_() { - } - SoftReference(const Flat::Bigfoot::UUID &_uuid) - : uuid_(_uuid) { - } - const Flat::Bigfoot::UUID &uuid() const { - return uuid_; - } -}; -FLATBUFFERS_STRUCT_END(SoftReference, 16); - -struct SoftReference::Traits { - using type = SoftReference; -}; - -inline const ::flatbuffers::TypeTable *HardReferenceTypeTable() { - static const ::flatbuffers::TypeCode type_codes[] = { - { ::flatbuffers::ET_SEQUENCE, 0, 0 } - }; - static const ::flatbuffers::TypeFunction type_refs[] = { - Flat::Bigfoot::UUIDTypeTable - }; - static const int64_t values[] = { 0, 16 }; - static const ::flatbuffers::TypeTable tt = { - ::flatbuffers::ST_STRUCT, 1, type_codes, type_refs, nullptr, values, nullptr - }; - return &tt; -} - -inline const ::flatbuffers::TypeTable *SoftReferenceTypeTable() { - static const ::flatbuffers::TypeCode type_codes[] = { - { ::flatbuffers::ET_SEQUENCE, 0, 0 } - }; - static const ::flatbuffers::TypeFunction type_refs[] = { - Flat::Bigfoot::UUIDTypeTable - }; - static const int64_t values[] = { 0, 16 }; - static const ::flatbuffers::TypeTable tt = { - ::flatbuffers::ST_STRUCT, 1, type_codes, type_refs, nullptr, values, nullptr - }; - return &tt; -} - -} // namespace Bigfoot -} // namespace Flat - -#endif // FLATBUFFERS_GENERATED_REFERENCE_FLAT_BIGFOOT_H_ diff --git a/Bigfoot/Tests/Engine/Asset/Asset.cpp b/Bigfoot/Tests/Engine/Asset/Asset.cpp index 4867d64..ee6cbc1 100644 --- a/Bigfoot/Tests/Engine/Asset/Asset.cpp +++ b/Bigfoot/Tests/Engine/Asset/Asset.cpp @@ -90,9 +90,9 @@ TEST_F(AssetFixture, AssetBTests) AssetB assetB; assetB.SetName(nameB); assetB.SetVersion(versionB); - assetB.GetAsset().asset_a_ref = HardReference {assetA.GetHeader().uuid}; - assetB.GetAsset().asset_a_refs = {SoftReference {assetA.GetHeader().uuid}, - SoftReference {assetAA.GetHeader().uuid}}; + //assetB.GetAsset().asset_a_ref = HardReference {assetA.GetHeader().uuid}; + //assetB.GetAsset().asset_a_refs = {SoftReference {assetA.GetHeader().uuid}, + // SoftReference {assetAA.GetHeader().uuid}}; const eastl::vector test = assetB.Save(); @@ -112,13 +112,13 @@ TEST_F(AssetFixture, AssetBTests) EXPECT_EQ(assetB.GetHeader().version, versionB); EXPECT_EQ(assetB.GetHeader().version, assetB_dup.GetHeader().version); - EXPECT_EQ(assetB.GetAsset().asset_a_ref, HardReference {assetA.GetHeader().uuid}); - EXPECT_EQ(assetB.GetAsset().asset_a_ref, assetB_dup.GetAsset().asset_a_ref); + //EXPECT_EQ(assetB.GetAsset().asset_a_ref, HardReference {assetA.GetHeader().uuid}); + //EXPECT_EQ(assetB.GetAsset().asset_a_ref, assetB_dup.GetAsset().asset_a_ref); - EXPECT_EQ(assetB.GetAsset().asset_a_refs, - (eastl::vector> {SoftReference {assetA.GetHeader().uuid}, - SoftReference {assetAA.GetHeader().uuid}})); - EXPECT_EQ(assetB.GetAsset().asset_a_refs, assetB_dup.GetAsset().asset_a_refs); + //EXPECT_EQ(assetB.GetAsset().asset_a_refs, + // (eastl::vector> {SoftReference {assetA.GetHeader().uuid}, + // SoftReference {assetAA.GetHeader().uuid}})); + //EXPECT_EQ(assetB.GetAsset().asset_a_refs, assetB_dup.GetAsset().asset_a_refs); } /****************************************************************************************/ @@ -153,9 +153,9 @@ TEST_F(AssetFixture, AssetCTests) AssetB assetB; assetB.SetName(nameB); assetB.SetVersion(versionB); - assetB.GetAsset().asset_a_ref = HardReference {assetA.GetHeader().uuid}; - assetB.GetAsset().asset_a_refs = {SoftReference {assetA.GetHeader().uuid}, - SoftReference {assetAA.GetHeader().uuid}}; + //assetB.GetAsset().asset_a_ref = HardReference {assetA.GetHeader().uuid}; + //assetB.GetAsset().asset_a_refs = {SoftReference {assetA.GetHeader().uuid}, + // SoftReference {assetAA.GetHeader().uuid}}; constexpr eastl::string_view nameC = "General"; constexpr std::uint32_t versionC = 1; @@ -163,11 +163,11 @@ TEST_F(AssetFixture, AssetCTests) AssetC assetC; assetC.SetName(nameC); assetC.SetVersion(versionC); - assetC.GetAsset().inner_table->asset_a_ref = HardReference {assetA.GetHeader().uuid}; - assetC.GetAsset().inner_table->asset_a_refs = {HardReference {assetA.GetHeader().uuid}, - HardReference {assetAA.GetHeader().uuid}}; - assetC.GetAsset().asset_b_ref = HardReference {assetB.GetHeader().uuid}; - assetC.GetAsset().asset_b_refs = {SoftReference {assetB.GetHeader().uuid}}; + //assetC.GetAsset().inner_table->asset_a_ref = HardReference {assetA.GetHeader().uuid}; + //assetC.GetAsset().inner_table->asset_a_refs = {HardReference {assetA.GetHeader().uuid}, + // HardReference {assetAA.GetHeader().uuid}}; + //assetC.GetAsset().asset_b_ref = HardReference {assetB.GetHeader().uuid}; + //assetC.GetAsset().asset_b_refs = {SoftReference {assetB.GetHeader().uuid}}; const eastl::vector test = assetC.Save(); @@ -187,19 +187,19 @@ TEST_F(AssetFixture, AssetCTests) EXPECT_EQ(assetC.GetHeader().version, versionC); EXPECT_EQ(assetC.GetHeader().version, assetC_dup.GetHeader().version); - EXPECT_EQ(assetC.GetAsset().asset_b_ref, HardReference {assetB.GetHeader().uuid}); - EXPECT_EQ(assetC.GetAsset().asset_b_ref, assetC_dup.GetAsset().asset_b_ref); + //EXPECT_EQ(assetC.GetAsset().asset_b_ref, HardReference {assetB.GetHeader().uuid}); + //EXPECT_EQ(assetC.GetAsset().asset_b_ref, assetC_dup.GetAsset().asset_b_ref); - EXPECT_EQ(assetC.GetAsset().asset_b_refs, - (eastl::vector> {SoftReference {assetB.GetHeader().uuid}})); - EXPECT_EQ(assetC.GetAsset().asset_b_refs, assetC_dup.GetAsset().asset_b_refs); + //EXPECT_EQ(assetC.GetAsset().asset_b_refs, + // (eastl::vector> {SoftReference {assetB.GetHeader().uuid}})); + //EXPECT_EQ(assetC.GetAsset().asset_b_refs, assetC_dup.GetAsset().asset_b_refs); - EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_ref, HardReference {assetA.GetHeader().uuid}); - EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_ref, assetC_dup.GetAsset().inner_table->asset_a_ref); + //EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_ref, HardReference {assetA.GetHeader().uuid}); + //EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_ref, assetC_dup.GetAsset().inner_table->asset_a_ref); - EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_refs, - (eastl::vector> {HardReference {assetA.GetHeader().uuid}, - HardReference {assetAA.GetHeader().uuid}})); - EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_refs, assetC_dup.GetAsset().inner_table->asset_a_refs); + //EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_refs, + // (eastl::vector> {HardReference {assetA.GetHeader().uuid}, + // HardReference {assetAA.GetHeader().uuid}})); + //EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_refs, assetC_dup.GetAsset().inner_table->asset_a_refs); } } // namespace Bigfoot diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetA.cpp b/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetA.cpp index 02e9957..e989e54 100644 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetA.cpp +++ b/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetA.cpp @@ -8,4 +8,4 @@ #include -ASSET_CONTAINER(AssetA) +ASSET_CONTAINER(AssetA, ::Bigfoot::AssetA) diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetARef.cpp b/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetARef.cpp deleted file mode 100644 index a7165e4..0000000 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetARef.cpp +++ /dev/null @@ -1,9 +0,0 @@ -/********************************************************************* - * \file AssetARef.cpp - * - * \author Romain BOULLARD - * \date May 2026 - *********************************************************************/ -#include - -ASSET_REF_IMPL(AssetA, ::Bigfoot::AssetA) diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetB.cpp b/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetB.cpp index 9353ebc..b614402 100644 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetB.cpp +++ b/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetB.cpp @@ -8,4 +8,4 @@ #include -ASSET_CONTAINER(AssetB) +ASSET_CONTAINER(AssetB, ::Bigfoot::AssetB) diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetBRef.cpp b/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetBRef.cpp deleted file mode 100644 index 066ea8e..0000000 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetBRef.cpp +++ /dev/null @@ -1,9 +0,0 @@ -/********************************************************************* - * \file AssetBRef.cpp - * - * \author Romain BOULLARD - * \date May 2026 - *********************************************************************/ -#include - -ASSET_REF_IMPL(AssetB, ::Bigfoot::AssetB) diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetC.cpp b/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetC.cpp index ae822b4..a4a4e01 100644 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetC.cpp +++ b/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetC.cpp @@ -8,4 +8,4 @@ #include -ASSET_CONTAINER(AssetC) +ASSET_CONTAINER(AssetC, ::Bigfoot::AssetC) diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetCRef.cpp b/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetCRef.cpp deleted file mode 100644 index 62f0e3a..0000000 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Asset/AssetCRef.cpp +++ /dev/null @@ -1,9 +0,0 @@ -/********************************************************************* - * \file AssetCRef.cpp - * - * \author Romain BOULLARD - * \date May 2026 - *********************************************************************/ -#include - -ASSET_REF_IMPL(AssetC, ::Bigfoot::AssetC) diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetA.fbs b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetA.fbs index c22e5f3..5dcd580 100644 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetA.fbs +++ b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetA.fbs @@ -1,7 +1,3 @@ -include "Engine/Asset/Reference.fbs"; - -native_include "AssetsForTesting/Asset/AssetARef.hpp"; - namespace Flat.Bigfoot; table AssetA diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetA.hpp b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetA.hpp index 9bee1f1..5d56027 100644 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetA.hpp +++ b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetA.hpp @@ -6,10 +6,10 @@ *********************************************************************/ #ifndef BIGFOOT_ASSETSFORTESTING_ASSET_ASSETA_HPP #define BIGFOOT_ASSETSFORTESTING_ASSET_ASSETA_HPP -#include - #include +#include + namespace Bigfoot { struct AssetATraits diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetARef.hpp b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetARef.hpp deleted file mode 100644 index 6ff87bf..0000000 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetARef.hpp +++ /dev/null @@ -1,18 +0,0 @@ -/********************************************************************* - * \file AssetARef.hpp - * - * \author Romain BOULLARD - * \date May 2026 - *********************************************************************/ -#ifndef BIGFOOT_ASSETSFORTESTING_ASSET_ASSETAREF_HPP -#define BIGFOOT_ASSETSFORTESTING_ASSET_ASSETAREF_HPP -#include - -namespace Bigfoot -{ -class AssetA; -} // namespace Bigfoot - -ASSET_REF_DECL(AssetA, ::Bigfoot::AssetA) - -#endif diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetA_generated.hpp b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetA_generated.hpp index 2c01d6c..22cf352 100644 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetA_generated.hpp +++ b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetA_generated.hpp @@ -13,12 +13,6 @@ static_assert(FLATBUFFERS_VERSION_MAJOR == 25 && FLATBUFFERS_VERSION_REVISION == 19, "Non-compatible flatbuffers version included"); -#include "Engine/Asset/Reference.hpp" -#include "System/UUID/UUID.hpp" -#include "Engine/Asset/Reference.hpp" -#include "AssetsForTesting/Asset/AssetARef.hpp" -#include "Engine/Asset/Reference_generated.hpp" - #include "EASTL/unique_ptr.h" #include "EASTL/string.h" #include "EASTL/vector.h" diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetB.fbs b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetB.fbs index 84b0349..22ab30d 100644 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetB.fbs +++ b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetB.fbs @@ -1,15 +1,9 @@ -include "Engine/Asset/Reference.fbs"; - include "AssetsForTesting/Asset/AssetA.fbs"; -native_include "AssetsForTesting/Asset/AssetBRef.hpp"; - namespace Flat.Bigfoot; table AssetB { - asset_a_ref: Flat.Bigfoot.HardReference (native_type: "::Bigfoot::HardReference<::Bigfoot::AssetA>", native_inline, native_type_pack_name: "HardReferenceAssetA"); - asset_a_refs: [Flat.Bigfoot.SoftReference] (native_type: "::Bigfoot::SoftReference<::Bigfoot::AssetA>", native_inline, native_type_pack_name: "SoftReferenceAssetA"); } root_type AssetB; \ No newline at end of file diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetB.hpp b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetB.hpp index cc87034..7aef595 100644 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetB.hpp +++ b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetB.hpp @@ -6,10 +6,10 @@ *********************************************************************/ #ifndef BIGFOOT_ASSETSFORTESTING_ASSET_ASSETB_HPP #define BIGFOOT_ASSETSFORTESTING_ASSET_ASSETB_HPP -#include - #include +#include + namespace Bigfoot { struct AssetBTraits diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetBRef.hpp b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetBRef.hpp deleted file mode 100644 index 302d2e9..0000000 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetBRef.hpp +++ /dev/null @@ -1,18 +0,0 @@ -/********************************************************************* - * \file AssetBRef.hpp - * - * \author Romain BOULLARD - * \date May 2026 - *********************************************************************/ -#ifndef BIGFOOT_ASSETSFORTESTING_ASSET_ASSETBREF_HPP -#define BIGFOOT_ASSETSFORTESTING_ASSET_ASSETBREF_HPP -#include - -namespace Bigfoot -{ -class AssetB; -} // namespace Bigfoot - -ASSET_REF_DECL(AssetB, ::Bigfoot::AssetB) - -#endif diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetB_generated.hpp b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetB_generated.hpp index 022e574..0971e31 100644 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetB_generated.hpp +++ b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetB_generated.hpp @@ -13,12 +13,6 @@ static_assert(FLATBUFFERS_VERSION_MAJOR == 25 && FLATBUFFERS_VERSION_REVISION == 19, "Non-compatible flatbuffers version included"); -#include "Engine/Asset/Reference.hpp" -#include "System/UUID/UUID.hpp" -#include "Engine/Asset/Reference.hpp" -#include "AssetsForTesting/Asset/AssetARef.hpp" -#include "AssetsForTesting/Asset/AssetBRef.hpp" -#include "Engine/Asset/Reference_generated.hpp" #include "AssetsForTesting/Asset/AssetA_generated.hpp" #include "EASTL/unique_ptr.h" @@ -39,8 +33,6 @@ struct AssetBT : public ::flatbuffers::NativeTable { static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { return "Flat.Bigfoot.AssetBT"; } - ::Bigfoot::HardReference<::Bigfoot::AssetA> asset_a_ref{}; - eastl::vector<::Bigfoot::SoftReference<::Bigfoot::AssetA>> asset_a_refs{}; }; struct AssetB FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { @@ -53,22 +45,9 @@ struct AssetB FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { return "Flat.Bigfoot.AssetB"; } - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ASSET_A_REF = 4, - VT_ASSET_A_REFS = 6 - }; - const Flat::Bigfoot::HardReference *asset_a_ref() const { - return GetStruct(VT_ASSET_A_REF); - } - const ::flatbuffers::Vector *asset_a_refs() const { - return GetPointer *>(VT_ASSET_A_REFS); - } template bool Verify(::flatbuffers::VerifierTemplate &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ASSET_A_REF, 1) && - VerifyOffset(verifier, VT_ASSET_A_REFS) && - verifier.VerifyVector(asset_a_refs()) && verifier.EndTable(); } AssetBT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const; @@ -80,12 +59,6 @@ struct AssetBBuilder { typedef AssetB Table; ::flatbuffers::FlatBufferBuilder &fbb_; ::flatbuffers::uoffset_t start_; - void add_asset_a_ref(const Flat::Bigfoot::HardReference *asset_a_ref) { - fbb_.AddStruct(AssetB::VT_ASSET_A_REF, asset_a_ref); - } - void add_asset_a_refs(::flatbuffers::Offset<::flatbuffers::Vector> asset_a_refs) { - fbb_.AddOffset(AssetB::VT_ASSET_A_REFS, asset_a_refs); - } explicit AssetBBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); @@ -98,12 +71,8 @@ struct AssetBBuilder { }; inline ::flatbuffers::Offset CreateAssetB( - ::flatbuffers::FlatBufferBuilder &_fbb, - const Flat::Bigfoot::HardReference *asset_a_ref = nullptr, - ::flatbuffers::Offset<::flatbuffers::Vector> asset_a_refs = 0) { + ::flatbuffers::FlatBufferBuilder &_fbb) { AssetBBuilder builder_(_fbb); - builder_.add_asset_a_refs(asset_a_refs); - builder_.add_asset_a_ref(asset_a_ref); return builder_.Finish(); } @@ -123,8 +92,6 @@ inline AssetBT *AssetB::UnPack(const ::flatbuffers::resolver_function_t *_resolv inline void AssetB::UnPackTo(AssetBT *_o, const ::flatbuffers::resolver_function_t *_resolver) const { (void)_o; (void)_resolver; - { auto _e = asset_a_ref(); if (_e) _o->asset_a_ref = ::flatbuffers::UnPackHardReferenceAssetA(*_e); } - { auto _e = asset_a_refs(); if (_e) { _o->asset_a_refs.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->asset_a_refs[_i] = ::flatbuffers::UnPackSoftReferenceAssetA(*_e->Get(_i)); } } else { _o->asset_a_refs.resize(0); } } } inline ::flatbuffers::Offset CreateAssetB(::flatbuffers::FlatBufferBuilder &_fbb, const AssetBT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) { @@ -135,25 +102,13 @@ inline ::flatbuffers::Offset AssetB::Pack(::flatbuffers::FlatBufferBuild (void)_rehasher; (void)_o; struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const AssetBT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _asset_a_ref = ::flatbuffers::PackHardReferenceAssetA(_o->asset_a_ref); - auto _asset_a_refs = _fbb.CreateVectorOfNativeStructs>(_o->asset_a_refs.data(), _o->asset_a_refs.size(), ::flatbuffers::PackSoftReferenceAssetA); return Flat::Bigfoot::CreateAssetB( - _fbb, - &_asset_a_ref, - _asset_a_refs); + _fbb); } inline const ::flatbuffers::TypeTable *AssetBTypeTable() { - static const ::flatbuffers::TypeCode type_codes[] = { - { ::flatbuffers::ET_SEQUENCE, 0, 0 }, - { ::flatbuffers::ET_SEQUENCE, 1, 1 } - }; - static const ::flatbuffers::TypeFunction type_refs[] = { - Flat::Bigfoot::HardReferenceTypeTable, - Flat::Bigfoot::SoftReferenceTypeTable - }; static const ::flatbuffers::TypeTable tt = { - ::flatbuffers::ST_TABLE, 2, type_codes, type_refs, nullptr, nullptr, nullptr + ::flatbuffers::ST_TABLE, 0, nullptr, nullptr, nullptr, nullptr, nullptr }; return &tt; } diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetC.fbs b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetC.fbs index 78fbd2e..7374f65 100644 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetC.fbs +++ b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetC.fbs @@ -1,24 +1,15 @@ -include "Engine/Asset/Reference.fbs"; - include "AssetsForTesting/Asset/AssetA.fbs"; include "AssetsForTesting/Asset/AssetB.fbs"; -native_include "AssetsForTesting/Asset/AssetCRef.hpp"; - namespace Flat.Bigfoot; table InnerTable { - asset_a_ref: Flat.Bigfoot.HardReference (native_type: "::Bigfoot::HardReference<::Bigfoot::AssetA>", native_inline, native_type_pack_name: "HardReferenceAssetA"); - asset_a_refs: [Flat.Bigfoot.HardReference] (native_type: "::Bigfoot::HardReference<::Bigfoot::AssetA>", native_inline, native_type_pack_name: "HardReferenceAssetA"); } table AssetC { inner_table: InnerTable (required); - - asset_b_ref: Flat.Bigfoot.HardReference (native_type: "::Bigfoot::HardReference<::Bigfoot::AssetB>", native_inline, native_type_pack_name: "HardReferenceAssetB"); - asset_b_refs: [Flat.Bigfoot.SoftReference] (native_type: "::Bigfoot::SoftReference<::Bigfoot::AssetB>", native_inline, native_type_pack_name: "SoftReferenceAssetB"); } root_type AssetC; \ No newline at end of file diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetC.hpp b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetC.hpp index ecf5fae..36953d8 100644 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetC.hpp +++ b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetC.hpp @@ -6,10 +6,10 @@ *********************************************************************/ #ifndef BIGFOOT_ASSETSFORTESTING_ASSET_ASSETC_HPP #define BIGFOOT_ASSETSFORTESTING_ASSET_ASSETC_HPP -#include - #include +#include + namespace Bigfoot { struct AssetCTraits diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetCRef.hpp b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetCRef.hpp deleted file mode 100644 index d225707..0000000 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetCRef.hpp +++ /dev/null @@ -1,18 +0,0 @@ -/********************************************************************* - * \file AssetCRef.hpp - * - * \author Romain BOULLARD - * \date May 2026 - *********************************************************************/ -#ifndef BIGFOOT_ASSETSFORTESTING_ASSET_ASSETCREF_HPP -#define BIGFOOT_ASSETSFORTESTING_ASSET_ASSETCREF_HPP -#include - -namespace Bigfoot -{ -class AssetC; -} // namespace Bigfoot - -ASSET_REF_DECL(AssetC, ::Bigfoot::AssetC) - -#endif diff --git a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetC_generated.hpp b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetC_generated.hpp index 464c640..6f60966 100644 --- a/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetC_generated.hpp +++ b/Bigfoot/Tests/Misc/AssetsForTesting/Include/AssetsForTesting/Asset/AssetC_generated.hpp @@ -13,13 +13,6 @@ static_assert(FLATBUFFERS_VERSION_MAJOR == 25 && FLATBUFFERS_VERSION_REVISION == 19, "Non-compatible flatbuffers version included"); -#include "Engine/Asset/Reference.hpp" -#include "System/UUID/UUID.hpp" -#include "Engine/Asset/Reference.hpp" -#include "AssetsForTesting/Asset/AssetARef.hpp" -#include "AssetsForTesting/Asset/AssetBRef.hpp" -#include "AssetsForTesting/Asset/AssetCRef.hpp" -#include "Engine/Asset/Reference_generated.hpp" #include "AssetsForTesting/Asset/AssetA_generated.hpp" #include "AssetsForTesting/Asset/AssetB_generated.hpp" @@ -47,8 +40,6 @@ struct InnerTableT : public ::flatbuffers::NativeTable { static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { return "Flat.Bigfoot.InnerTableT"; } - ::Bigfoot::HardReference<::Bigfoot::AssetA> asset_a_ref{}; - eastl::vector<::Bigfoot::HardReference<::Bigfoot::AssetA>> asset_a_refs{}; }; struct InnerTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { @@ -61,22 +52,9 @@ struct InnerTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { return "Flat.Bigfoot.InnerTable"; } - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ASSET_A_REF = 4, - VT_ASSET_A_REFS = 6 - }; - const Flat::Bigfoot::HardReference *asset_a_ref() const { - return GetStruct(VT_ASSET_A_REF); - } - const ::flatbuffers::Vector *asset_a_refs() const { - return GetPointer *>(VT_ASSET_A_REFS); - } template bool Verify(::flatbuffers::VerifierTemplate &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ASSET_A_REF, 1) && - VerifyOffset(verifier, VT_ASSET_A_REFS) && - verifier.VerifyVector(asset_a_refs()) && verifier.EndTable(); } InnerTableT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const; @@ -88,12 +66,6 @@ struct InnerTableBuilder { typedef InnerTable Table; ::flatbuffers::FlatBufferBuilder &fbb_; ::flatbuffers::uoffset_t start_; - void add_asset_a_ref(const Flat::Bigfoot::HardReference *asset_a_ref) { - fbb_.AddStruct(InnerTable::VT_ASSET_A_REF, asset_a_ref); - } - void add_asset_a_refs(::flatbuffers::Offset<::flatbuffers::Vector> asset_a_refs) { - fbb_.AddOffset(InnerTable::VT_ASSET_A_REFS, asset_a_refs); - } explicit InnerTableBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); @@ -106,12 +78,8 @@ struct InnerTableBuilder { }; inline ::flatbuffers::Offset CreateInnerTable( - ::flatbuffers::FlatBufferBuilder &_fbb, - const Flat::Bigfoot::HardReference *asset_a_ref = nullptr, - ::flatbuffers::Offset<::flatbuffers::Vector> asset_a_refs = 0) { + ::flatbuffers::FlatBufferBuilder &_fbb) { InnerTableBuilder builder_(_fbb); - builder_.add_asset_a_refs(asset_a_refs); - builder_.add_asset_a_ref(asset_a_ref); return builder_.Finish(); } @@ -128,8 +96,6 @@ struct AssetCT : public ::flatbuffers::NativeTable { return "Flat.Bigfoot.AssetCT"; } eastl::unique_ptr inner_table{}; - ::Bigfoot::HardReference<::Bigfoot::AssetB> asset_b_ref{}; - eastl::vector<::Bigfoot::SoftReference<::Bigfoot::AssetB>> asset_b_refs{}; AssetCT() = default; AssetCT(const AssetCT &o); AssetCT(AssetCT&&) FLATBUFFERS_NOEXCEPT = default; @@ -147,27 +113,16 @@ struct AssetC FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { return "Flat.Bigfoot.AssetC"; } enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_INNER_TABLE = 4, - VT_ASSET_B_REF = 6, - VT_ASSET_B_REFS = 8 + VT_INNER_TABLE = 4 }; const Flat::Bigfoot::InnerTable *inner_table() const { return GetPointer(VT_INNER_TABLE); } - const Flat::Bigfoot::HardReference *asset_b_ref() const { - return GetStruct(VT_ASSET_B_REF); - } - const ::flatbuffers::Vector *asset_b_refs() const { - return GetPointer *>(VT_ASSET_B_REFS); - } template bool Verify(::flatbuffers::VerifierTemplate &verifier) const { return VerifyTableStart(verifier) && VerifyOffsetRequired(verifier, VT_INNER_TABLE) && verifier.VerifyTable(inner_table()) && - VerifyField(verifier, VT_ASSET_B_REF, 1) && - VerifyOffset(verifier, VT_ASSET_B_REFS) && - verifier.VerifyVector(asset_b_refs()) && verifier.EndTable(); } AssetCT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const; @@ -182,12 +137,6 @@ struct AssetCBuilder { void add_inner_table(::flatbuffers::Offset inner_table) { fbb_.AddOffset(AssetC::VT_INNER_TABLE, inner_table); } - void add_asset_b_ref(const Flat::Bigfoot::HardReference *asset_b_ref) { - fbb_.AddStruct(AssetC::VT_ASSET_B_REF, asset_b_ref); - } - void add_asset_b_refs(::flatbuffers::Offset<::flatbuffers::Vector> asset_b_refs) { - fbb_.AddOffset(AssetC::VT_ASSET_B_REFS, asset_b_refs); - } explicit AssetCBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); @@ -202,12 +151,8 @@ struct AssetCBuilder { inline ::flatbuffers::Offset CreateAssetC( ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset inner_table = 0, - const Flat::Bigfoot::HardReference *asset_b_ref = nullptr, - ::flatbuffers::Offset<::flatbuffers::Vector> asset_b_refs = 0) { + ::flatbuffers::Offset inner_table = 0) { AssetCBuilder builder_(_fbb); - builder_.add_asset_b_refs(asset_b_refs); - builder_.add_asset_b_ref(asset_b_ref); builder_.add_inner_table(inner_table); return builder_.Finish(); } @@ -228,8 +173,6 @@ inline InnerTableT *InnerTable::UnPack(const ::flatbuffers::resolver_function_t inline void InnerTable::UnPackTo(InnerTableT *_o, const ::flatbuffers::resolver_function_t *_resolver) const { (void)_o; (void)_resolver; - { auto _e = asset_a_ref(); if (_e) _o->asset_a_ref = ::flatbuffers::UnPackHardReferenceAssetA(*_e); } - { auto _e = asset_a_refs(); if (_e) { _o->asset_a_refs.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->asset_a_refs[_i] = ::flatbuffers::UnPackHardReferenceAssetA(*_e->Get(_i)); } } else { _o->asset_a_refs.resize(0); } } } inline ::flatbuffers::Offset CreateInnerTable(::flatbuffers::FlatBufferBuilder &_fbb, const InnerTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) { @@ -240,24 +183,16 @@ inline ::flatbuffers::Offset InnerTable::Pack(::flatbuffers::FlatBuf (void)_rehasher; (void)_o; struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const InnerTableT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _asset_a_ref = ::flatbuffers::PackHardReferenceAssetA(_o->asset_a_ref); - auto _asset_a_refs = _fbb.CreateVectorOfNativeStructs>(_o->asset_a_refs.data(), _o->asset_a_refs.size(), ::flatbuffers::PackHardReferenceAssetA); return Flat::Bigfoot::CreateInnerTable( - _fbb, - &_asset_a_ref, - _asset_a_refs); + _fbb); } inline AssetCT::AssetCT(const AssetCT &o) - : inner_table((o.inner_table) ? new Flat::Bigfoot::InnerTableT(*o.inner_table) : nullptr), - asset_b_ref(o.asset_b_ref), - asset_b_refs(o.asset_b_refs) { + : inner_table((o.inner_table) ? new Flat::Bigfoot::InnerTableT(*o.inner_table) : nullptr) { } inline AssetCT &AssetCT::operator=(AssetCT o) FLATBUFFERS_NOEXCEPT { std::swap(inner_table, o.inner_table); - std::swap(asset_b_ref, o.asset_b_ref); - std::swap(asset_b_refs, o.asset_b_refs); return *this; } @@ -271,8 +206,6 @@ inline void AssetC::UnPackTo(AssetCT *_o, const ::flatbuffers::resolver_function (void)_o; (void)_resolver; { auto _e = inner_table(); if (_e) { if(_o->inner_table) { _e->UnPackTo(_o->inner_table.get(), _resolver); } else { _o->inner_table = eastl::unique_ptr(_e->UnPack(_resolver)); } } else if (_o->inner_table) { _o->inner_table.reset(); } } - { auto _e = asset_b_ref(); if (_e) _o->asset_b_ref = ::flatbuffers::UnPackHardReferenceAssetB(*_e); } - { auto _e = asset_b_refs(); if (_e) { _o->asset_b_refs.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->asset_b_refs[_i] = ::flatbuffers::UnPackSoftReferenceAssetB(*_e->Get(_i)); } } else { _o->asset_b_refs.resize(0); } } } inline ::flatbuffers::Offset CreateAssetC(::flatbuffers::FlatBufferBuilder &_fbb, const AssetCT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) { @@ -284,42 +217,27 @@ inline ::flatbuffers::Offset AssetC::Pack(::flatbuffers::FlatBufferBuild (void)_o; struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const AssetCT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; auto _inner_table = _o->inner_table ? CreateInnerTable(_fbb, _o->inner_table.get(), _rehasher) : 0; - auto _asset_b_ref = ::flatbuffers::PackHardReferenceAssetB(_o->asset_b_ref); - auto _asset_b_refs = _fbb.CreateVectorOfNativeStructs>(_o->asset_b_refs.data(), _o->asset_b_refs.size(), ::flatbuffers::PackSoftReferenceAssetB); return Flat::Bigfoot::CreateAssetC( _fbb, - _inner_table, - &_asset_b_ref, - _asset_b_refs); + _inner_table); } inline const ::flatbuffers::TypeTable *InnerTableTypeTable() { - static const ::flatbuffers::TypeCode type_codes[] = { - { ::flatbuffers::ET_SEQUENCE, 0, 0 }, - { ::flatbuffers::ET_SEQUENCE, 1, 0 } - }; - static const ::flatbuffers::TypeFunction type_refs[] = { - Flat::Bigfoot::HardReferenceTypeTable - }; static const ::flatbuffers::TypeTable tt = { - ::flatbuffers::ST_TABLE, 2, type_codes, type_refs, nullptr, nullptr, nullptr + ::flatbuffers::ST_TABLE, 0, nullptr, nullptr, nullptr, nullptr, nullptr }; return &tt; } inline const ::flatbuffers::TypeTable *AssetCTypeTable() { static const ::flatbuffers::TypeCode type_codes[] = { - { ::flatbuffers::ET_SEQUENCE, 0, 0 }, - { ::flatbuffers::ET_SEQUENCE, 0, 1 }, - { ::flatbuffers::ET_SEQUENCE, 1, 2 } + { ::flatbuffers::ET_SEQUENCE, 0, 0 } }; static const ::flatbuffers::TypeFunction type_refs[] = { - Flat::Bigfoot::InnerTableTypeTable, - Flat::Bigfoot::HardReferenceTypeTable, - Flat::Bigfoot::SoftReferenceTypeTable + Flat::Bigfoot::InnerTableTypeTable }; static const ::flatbuffers::TypeTable tt = { - ::flatbuffers::ST_TABLE, 3, type_codes, type_refs, nullptr, nullptr, nullptr + ::flatbuffers::ST_TABLE, 1, type_codes, type_refs, nullptr, nullptr, nullptr }; return &tt; } diff --git a/CMake/Utils.cmake b/CMake/Utils.cmake index a3c4922..ca0166f 100644 --- a/CMake/Utils.cmake +++ b/CMake/Utils.cmake @@ -112,7 +112,7 @@ function(bigfoot_compile_flatbuffers) --force-empty --cpp-ptr-type "eastl::unique_ptr" --cpp-str-type "eastl::string" - --cpp-vec-type "eastl::vector" + --cpp-vector-type "eastl::vector" --cpp-include "EASTL/unique_ptr.h" --cpp-include "EASTL/string.h" --cpp-include "EASTL/vector.h"