AssetContainer barebones
All checks were successful
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 7m8s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m12s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 5m36s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 5m41s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 7m1s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m54s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 6m59s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 7m2s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m54s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m54s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 6m42s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 6m45s
Bigfoot / Clang Format Checks (push) Successful in 11s

This commit is contained in:
2026-05-12 21:09:17 +02:00
parent 0d3885a863
commit 4798ed8ab7
14 changed files with 381 additions and 177 deletions

View File

@@ -0,0 +1,91 @@
/*********************************************************************
* \file AssetContainer.hpp
*
* \author Romain BOULLARD
* \date May 2026
*********************************************************************/
#ifndef BIGFOOT_ENGINE_ASSETCONTAINER_HPP
#define BIGFOOT_ENGINE_ASSETCONTAINER_HPP
#include <Engine/EngineAssertHandler.hpp>
#include <System/UUID/UUID.hpp>
#include <ankerl/unordered_dense.h>
#include <cstdint>
namespace Bigfoot
{
template<class ASSET>
class AssetContainer
{
public:
AssetContainer()
{
CRITICAL_ASSERT(EngineAssertHandler, !ms_instance, "Asset container already exists!");
ms_instance = this;
}
AssetContainer(const AssetContainer&) = delete;
AssetContainer& operator=(const AssetContainer&) = delete;
~AssetContainer() = default;
struct Entry
{
std::uint32_t m_hardRefCount = 0;
std::uint32_t m_softRefCount = 0;
};
void IncrementHardRefCount(const UUID& p_uuid)
{
++m_entries[p_uuid].m_hardRefCount;
}
void DecrementHardRefCount(const UUID& p_uuid)
{
if (m_entries.contains(p_uuid))
{
--m_entries.at(p_uuid).m_hardRefCount;
}
}
void IncrementSoftRefCount(const UUID& p_uuid)
{
++m_entries[p_uuid].m_softRefCount;
}
void DecrementSoftRefCount(const UUID& p_uuid)
{
if (m_entries.contains(p_uuid))
{
--m_entries.at(p_uuid).m_softRefCount;
}
}
[[nodiscard]]
std::uint32_t HardRefCount(const UUID& p_uuid) const
{
return m_entries.contains(p_uuid) ? m_entries.at(p_uuid).m_hardRefCount : 0;
}
[[nodiscard]]
std::uint32_t SoftRefCount(const UUID& p_uuid) const
{
return m_entries.contains(p_uuid) ? m_entries.at(p_uuid).m_softRefCount : 0;
}
[[nodiscard]]
static AssetContainer& Get()
{
return *ms_instance;
}
private:
ankerl::unordered_dense::segmented_map<UUID, Entry> m_entries;
inline static constinit AssetContainer* ms_instance = nullptr;
};
} // namespace Bigfoot
#endif

View File

@@ -0,0 +1,74 @@
/*********************************************************************
* \file AssetHelper.hpp
*
* \author Romain BOULLARD
* \date April 2026
*********************************************************************/
#ifndef BIGFOOT_ENGINE_ASSETHELPER_HPP
#define BIGFOOT_ENGINE_ASSETHELPER_HPP
#include <Engine/Asset/AssetContainer.hpp>
#include <Engine/Asset/Reference.hpp>
#include <Engine/Asset/Reference_generated.hpp>
#define ASSET_SOFT_REF_DECL(AssetName, AssetType) \
namespace flatbuffers \
{ \
Flat::Bigfoot::SoftReference PackSoftReference##AssetName(const Bigfoot::SoftReference<AssetType>& p_softRef); \
Bigfoot::SoftReference<AssetType> 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<AssetType>& p_hardRef); \
Bigfoot::HardReference<AssetType> UnPackHardReference##AssetName(const Flat::Bigfoot::HardReference& p_hardRef); \
}
#define ASSET_CONTAINER(AssetName, AssetType) \
namespace Bigfoot \
{ \
inline AssetContainer<AssetType> g_##AssetName##Container; \
}
#define ASSET_REF_DECL(AssetName, AssetType) \
ASSET_SOFT_REF_DECL(AssetName, AssetType) \
ASSET_HARD_REF_DECL(AssetName, AssetType)
#define ASSET_DECL(AssetName, AssetType) \
ASSET_REF_DECL(AssetName, AssetType) \
ASSET_CONTAINER(AssetName, AssetType)
/****************************************************************************************/
#define ASSET_SOFT_REF_IMPL(AssetName, AssetType) \
namespace flatbuffers \
{ \
Flat::Bigfoot::SoftReference PackSoftReference##AssetName(const Bigfoot::SoftReference<AssetType>& p_softRef) \
{ \
return {flatbuffers::Pack(p_softRef.GetUUID())}; \
} \
Bigfoot::SoftReference<AssetType> 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<AssetType>& p_softRef) \
{ \
return {flatbuffers::Pack(p_softRef.GetUUID())}; \
} \
Bigfoot::HardReference<AssetType> UnPackHardReference##AssetName(const Flat::Bigfoot::HardReference& p_softRef) \
{ \
return {flatbuffers::UnPack(p_softRef.uuid())}; \
} \
}
#define ASSET_REF_IMPL(AssetName, AssetType) \
ASSET_SOFT_REF_IMPL(AssetName, AssetType) \
ASSET_HARD_REF_IMPL(AssetName, AssetType)
#define ASSET_IMPL(AssetName, AssetType) ASSET_REF_IMPL(AssetName, AssetType)
#endif

View File

@@ -4,12 +4,12 @@ include "System/UUID/UUID.fbs";
namespace Flat.Bigfoot; namespace Flat.Bigfoot;
struct HardRef struct HardReference
{ {
uuid:UUID; uuid:UUID;
} }
struct SoftRef struct SoftReference
{ {
uuid:UUID; uuid:UUID;
} }

View File

@@ -6,23 +6,35 @@
*********************************************************************/ *********************************************************************/
#ifndef BIGFOOT_ENGINE_REFERENCE_HPP #ifndef BIGFOOT_ENGINE_REFERENCE_HPP
#define BIGFOOT_ENGINE_REFERENCE_HPP #define BIGFOOT_ENGINE_REFERENCE_HPP
#include <Engine/Asset/AssetContainer.hpp>
#include <System/UUID/UUID.hpp> #include <System/UUID/UUID.hpp>
#include <utility>
namespace Bigfoot namespace Bigfoot
{ {
template<class ASSET> template<class ASSET>
class HardRef class HardReference
{ {
public: public:
HardRef() = default; HardReference() = default;
HardRef(const UUID& p_uuid): HardReference(const UUID& p_uuid):
m_uuid(p_uuid) m_uuid(p_uuid)
{ {
Acquire();
} }
HardRef(const HardRef& p_ref) = default; HardReference(const HardReference& p_ref):
HardRef(HardRef&& p_ref) = default; m_uuid(p_ref.m_uuid)
{
Acquire();
}
HardReference(HardReference&& p_ref) noexcept:
m_uuid(std::exchange(p_ref.m_uuid, UUID::NULL_UUID))
{
}
[[nodiscard]] [[nodiscard]]
const UUID& GetUUID() const const UUID& GetUUID() const
@@ -30,34 +42,80 @@ class HardRef
return m_uuid; return m_uuid;
} }
~HardRef() = default; ~HardReference()
{
Release();
}
HardRef& operator=(const HardRef& p_ref) = default; HardReference& operator=(const HardReference& p_ref)
HardRef& operator=(HardRef&& p_ref) = default; {
if (this != &p_ref)
{
Release();
m_uuid = p_ref.m_uuid;
Acquire();
}
return *this;
}
HardReference& operator=(HardReference&& p_ref) noexcept
{
if (this != &p_ref)
{
Release();
m_uuid = std::exchange(p_ref.m_uuid, UUID::NULL_UUID);
}
return *this;
}
[[nodiscard]] [[nodiscard]]
bool operator==(const HardRef& p_ref) const bool operator==(const HardReference& p_ref) const
{ {
return m_uuid == p_ref.m_uuid; return m_uuid == p_ref.m_uuid;
} }
private: private:
void Acquire()
{
if (m_uuid)
{
AssetContainer<ASSET>::Get().IncrementHardRefCount(m_uuid);
}
}
void Release()
{
if (m_uuid)
{
AssetContainer<ASSET>::Get().DecrementHardRefCount(m_uuid);
}
}
UUID m_uuid = UUID::NULL_UUID; UUID m_uuid = UUID::NULL_UUID;
}; };
template<class ASSET> template<class ASSET>
class SoftRef class SoftReference
{ {
public: public:
SoftRef() = default; SoftReference() = default;
SoftRef(const UUID& p_uuid): SoftReference(const UUID& p_uuid):
m_uuid(p_uuid) m_uuid(p_uuid)
{ {
Acquire();
} }
SoftRef(const SoftRef& p_ref) = default; SoftReference(const SoftReference& p_ref):
SoftRef(SoftRef&& p_ref) = default; m_uuid(p_ref.m_uuid)
{
Acquire();
}
SoftReference(SoftReference&& p_ref) noexcept:
m_uuid(std::exchange(p_ref.m_uuid, UUID::NULL_UUID))
{
}
[[nodiscard]] [[nodiscard]]
const UUID& GetUUID() const const UUID& GetUUID() const
@@ -65,73 +123,56 @@ class SoftRef
return m_uuid; return m_uuid;
} }
~SoftRef() = default; ~SoftReference()
{
Release();
}
SoftRef& operator=(const SoftRef& p_ref) = default; SoftReference& operator=(const SoftReference& p_ref)
SoftRef& operator=(SoftRef&& p_ref) = default; {
if (this != &p_ref)
{
Release();
m_uuid = p_ref.m_uuid;
Acquire();
}
return *this;
}
SoftReference& operator=(SoftReference&& p_ref) noexcept
{
if (this != &p_ref)
{
Release();
m_uuid = std::exchange(p_ref.m_uuid, UUID::NULL_UUID);
}
return *this;
}
[[nodiscard]] [[nodiscard]]
bool operator==(const SoftRef& p_ref) const bool operator==(const SoftReference& p_ref) const
{ {
return m_uuid == p_ref.m_uuid; return m_uuid == p_ref.m_uuid;
} }
private: private:
void Acquire()
{
if (m_uuid)
{
AssetContainer<ASSET>::Get().IncrementSoftRefCount(m_uuid);
}
}
void Release()
{
if (m_uuid)
{
AssetContainer<ASSET>::Get().DecrementSoftRefCount(m_uuid);
}
}
UUID m_uuid = UUID::NULL_UUID; UUID m_uuid = UUID::NULL_UUID;
}; };
} // namespace Bigfoot } // namespace Bigfoot
#define ASSET_SOFT_REF_DECL(AssetName, AssetType) \
namespace flatbuffers \
{ \
Flat::Bigfoot::SoftRef PackSoftRef##AssetName(const Bigfoot::SoftRef<AssetType>& p_softRef); \
Bigfoot::SoftRef<AssetType> UnPackSoftRef##AssetName(const Flat::Bigfoot::SoftRef& p_softRef); \
}
#define ASSET_HARD_REF_DECL(AssetName, AssetType) \
namespace flatbuffers \
{ \
Flat::Bigfoot::HardRef PackHardRef##AssetName(const Bigfoot::HardRef<AssetType>& p_hardRef); \
Bigfoot::HardRef<AssetType> UnPackHardRef##AssetName(const Flat::Bigfoot::HardRef& p_hardRef); \
}
#define ASSET_REF_DECL(AssetName, AssetType) \
ASSET_SOFT_REF_DECL(AssetName, AssetType) \
ASSET_HARD_REF_DECL(AssetName, AssetType)
#define ASSET_DECL(AssetName, AssetType) ASSET_REF_DECL(AssetName, AssetType)
/****************************************************************************************/
#define ASSET_SOFT_REF_IMPL(AssetName, AssetType) \
namespace flatbuffers \
{ \
Flat::Bigfoot::SoftRef PackSoftRef##AssetName(const Bigfoot::SoftRef<AssetType>& p_softRef) \
{ \
return {flatbuffers::Pack(p_softRef.GetUUID())}; \
} \
Bigfoot::SoftRef<AssetType> UnPackSoftRef##AssetName(const Flat::Bigfoot::SoftRef& p_softRef) \
{ \
return {flatbuffers::UnPack(p_softRef.uuid())}; \
} \
}
#define ASSET_HARD_REF_IMPL(AssetName, AssetType) \
namespace flatbuffers \
{ \
Flat::Bigfoot::HardRef PackHardRef##AssetName(const Bigfoot::HardRef<AssetType>& p_softRef) \
{ \
return {flatbuffers::Pack(p_softRef.GetUUID())}; \
} \
Bigfoot::HardRef<AssetType> UnPackHardRef##AssetName(const Flat::Bigfoot::HardRef& p_softRef) \
{ \
return {flatbuffers::UnPack(p_softRef.uuid())}; \
} \
}
#define ASSET_REF_IMPL(AssetName, AssetType) \
ASSET_SOFT_REF_IMPL(AssetName, AssetType) \
ASSET_HARD_REF_IMPL(AssetName, AssetType)
#define ASSET_IMPL(AssetName, AssetType) ASSET_REF_IMPL(AssetName, AssetType)
#endif #endif

View File

@@ -25,71 +25,71 @@ static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
namespace Flat { namespace Flat {
namespace Bigfoot { namespace Bigfoot {
struct HardRef; struct HardReference;
struct SoftRef; struct SoftReference;
inline const ::flatbuffers::TypeTable *HardRefTypeTable(); inline const ::flatbuffers::TypeTable *HardReferenceTypeTable();
inline const ::flatbuffers::TypeTable *SoftRefTypeTable(); inline const ::flatbuffers::TypeTable *SoftReferenceTypeTable();
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) HardRef FLATBUFFERS_FINAL_CLASS { FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) HardReference FLATBUFFERS_FINAL_CLASS {
private: private:
Flat::Bigfoot::UUID uuid_; Flat::Bigfoot::UUID uuid_;
public: public:
struct Traits; struct Traits;
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() { static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
return HardRefTypeTable(); return HardReferenceTypeTable();
} }
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
return "Flat.Bigfoot.HardRef"; return "Flat.Bigfoot.HardReference";
} }
HardRef() HardReference()
: uuid_() { : uuid_() {
} }
HardRef(const Flat::Bigfoot::UUID &_uuid) HardReference(const Flat::Bigfoot::UUID &_uuid)
: uuid_(_uuid) { : uuid_(_uuid) {
} }
const Flat::Bigfoot::UUID &uuid() const { const Flat::Bigfoot::UUID &uuid() const {
return uuid_; return uuid_;
} }
}; };
FLATBUFFERS_STRUCT_END(HardRef, 16); FLATBUFFERS_STRUCT_END(HardReference, 16);
struct HardRef::Traits { struct HardReference::Traits {
using type = HardRef; using type = HardReference;
}; };
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) SoftRef FLATBUFFERS_FINAL_CLASS { FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) SoftReference FLATBUFFERS_FINAL_CLASS {
private: private:
Flat::Bigfoot::UUID uuid_; Flat::Bigfoot::UUID uuid_;
public: public:
struct Traits; struct Traits;
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() { static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
return SoftRefTypeTable(); return SoftReferenceTypeTable();
} }
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
return "Flat.Bigfoot.SoftRef"; return "Flat.Bigfoot.SoftReference";
} }
SoftRef() SoftReference()
: uuid_() { : uuid_() {
} }
SoftRef(const Flat::Bigfoot::UUID &_uuid) SoftReference(const Flat::Bigfoot::UUID &_uuid)
: uuid_(_uuid) { : uuid_(_uuid) {
} }
const Flat::Bigfoot::UUID &uuid() const { const Flat::Bigfoot::UUID &uuid() const {
return uuid_; return uuid_;
} }
}; };
FLATBUFFERS_STRUCT_END(SoftRef, 16); FLATBUFFERS_STRUCT_END(SoftReference, 16);
struct SoftRef::Traits { struct SoftReference::Traits {
using type = SoftRef; using type = SoftReference;
}; };
inline const ::flatbuffers::TypeTable *HardRefTypeTable() { inline const ::flatbuffers::TypeTable *HardReferenceTypeTable() {
static const ::flatbuffers::TypeCode type_codes[] = { static const ::flatbuffers::TypeCode type_codes[] = {
{ ::flatbuffers::ET_SEQUENCE, 0, 0 } { ::flatbuffers::ET_SEQUENCE, 0, 0 }
}; };
@@ -103,7 +103,7 @@ inline const ::flatbuffers::TypeTable *HardRefTypeTable() {
return &tt; return &tt;
} }
inline const ::flatbuffers::TypeTable *SoftRefTypeTable() { inline const ::flatbuffers::TypeTable *SoftReferenceTypeTable() {
static const ::flatbuffers::TypeCode type_codes[] = { static const ::flatbuffers::TypeCode type_codes[] = {
{ ::flatbuffers::ET_SEQUENCE, 0, 0 } { ::flatbuffers::ET_SEQUENCE, 0, 0 }
}; };

View File

@@ -106,9 +106,9 @@ TEST_F(AssetFixture, AssetBTests)
AssetB assetB; AssetB assetB;
assetB.SetName(nameB); assetB.SetName(nameB);
assetB.SetVersion(versionB); assetB.SetVersion(versionB);
assetB.GetAsset().asset_a_ref = HardRef<AssetA> {assetA.GetHeader().uuid}; assetB.GetAsset().asset_a_ref = HardReference<AssetA> {assetA.GetHeader().uuid};
assetB.GetAsset().asset_a_refs = {SoftRef<AssetA> {assetA.GetHeader().uuid}, assetB.GetAsset().asset_a_refs = {SoftReference<AssetA> {assetA.GetHeader().uuid},
SoftRef<AssetA> {assetAA.GetHeader().uuid}}; SoftReference<AssetA> {assetAA.GetHeader().uuid}};
const eastl::vector<std::byte> test = assetB.Save(); const eastl::vector<std::byte> test = assetB.Save();
@@ -128,12 +128,12 @@ TEST_F(AssetFixture, AssetBTests)
EXPECT_EQ(assetB.GetHeader().version, versionB); EXPECT_EQ(assetB.GetHeader().version, versionB);
EXPECT_EQ(assetB.GetHeader().version, assetB_dup.GetHeader().version); EXPECT_EQ(assetB.GetHeader().version, assetB_dup.GetHeader().version);
EXPECT_EQ(assetB.GetAsset().asset_a_ref, HardRef<AssetA> {assetA.GetHeader().uuid}); EXPECT_EQ(assetB.GetAsset().asset_a_ref, HardReference<AssetA> {assetA.GetHeader().uuid});
EXPECT_EQ(assetB.GetAsset().asset_a_ref, assetB_dup.GetAsset().asset_a_ref); EXPECT_EQ(assetB.GetAsset().asset_a_ref, assetB_dup.GetAsset().asset_a_ref);
EXPECT_EQ(assetB.GetAsset().asset_a_refs, EXPECT_EQ(assetB.GetAsset().asset_a_refs,
(eastl::vector<SoftRef<AssetA>> {SoftRef<AssetA> {assetA.GetHeader().uuid}, (eastl::vector<SoftReference<AssetA>> {SoftReference<AssetA> {assetA.GetHeader().uuid},
SoftRef<AssetA> {assetAA.GetHeader().uuid}})); SoftReference<AssetA> {assetAA.GetHeader().uuid}}));
EXPECT_EQ(assetB.GetAsset().asset_a_refs, assetB_dup.GetAsset().asset_a_refs); EXPECT_EQ(assetB.GetAsset().asset_a_refs, assetB_dup.GetAsset().asset_a_refs);
} }
@@ -169,9 +169,9 @@ TEST_F(AssetFixture, AssetCTests)
AssetB assetB; AssetB assetB;
assetB.SetName(nameB); assetB.SetName(nameB);
assetB.SetVersion(versionB); assetB.SetVersion(versionB);
assetB.GetAsset().asset_a_ref = HardRef<AssetA> {assetA.GetHeader().uuid}; assetB.GetAsset().asset_a_ref = HardReference<AssetA> {assetA.GetHeader().uuid};
assetB.GetAsset().asset_a_refs = {SoftRef<AssetA> {assetA.GetHeader().uuid}, assetB.GetAsset().asset_a_refs = {SoftReference<AssetA> {assetA.GetHeader().uuid},
SoftRef<AssetA> {assetAA.GetHeader().uuid}}; SoftReference<AssetA> {assetAA.GetHeader().uuid}};
constexpr eastl::string_view nameC = "General"; constexpr eastl::string_view nameC = "General";
constexpr std::uint32_t versionC = 1; constexpr std::uint32_t versionC = 1;
@@ -179,11 +179,11 @@ TEST_F(AssetFixture, AssetCTests)
AssetC assetC; AssetC assetC;
assetC.SetName(nameC); assetC.SetName(nameC);
assetC.SetVersion(versionC); assetC.SetVersion(versionC);
assetC.GetAsset().inner_table->asset_a_ref = HardRef<AssetA> {assetA.GetHeader().uuid}; assetC.GetAsset().inner_table->asset_a_ref = HardReference<AssetA> {assetA.GetHeader().uuid};
assetC.GetAsset().inner_table->asset_a_refs = {HardRef<AssetA> {assetA.GetHeader().uuid}, assetC.GetAsset().inner_table->asset_a_refs = {HardReference<AssetA> {assetA.GetHeader().uuid},
HardRef<AssetA> {assetAA.GetHeader().uuid}}; HardReference<AssetA> {assetAA.GetHeader().uuid}};
assetC.GetAsset().asset_b_ref = HardRef<AssetB> {assetB.GetHeader().uuid}; assetC.GetAsset().asset_b_ref = HardReference<AssetB> {assetB.GetHeader().uuid};
assetC.GetAsset().asset_b_refs = {SoftRef<AssetB> {assetB.GetHeader().uuid}}; assetC.GetAsset().asset_b_refs = {SoftReference<AssetB> {assetB.GetHeader().uuid}};
const eastl::vector<std::byte> test = assetC.Save(); const eastl::vector<std::byte> test = assetC.Save();
@@ -203,23 +203,21 @@ TEST_F(AssetFixture, AssetCTests)
EXPECT_EQ(assetC.GetHeader().version, versionC); EXPECT_EQ(assetC.GetHeader().version, versionC);
EXPECT_EQ(assetC.GetHeader().version, assetC_dup.GetHeader().version); EXPECT_EQ(assetC.GetHeader().version, assetC_dup.GetHeader().version);
EXPECT_EQ(assetC.GetAsset().asset_b_ref, HardRef<AssetB> {assetB.GetHeader().uuid}); EXPECT_EQ(assetC.GetAsset().asset_b_ref, HardReference<AssetB> {assetB.GetHeader().uuid});
EXPECT_EQ(assetC.GetAsset().asset_b_ref, assetC_dup.GetAsset().asset_b_ref); EXPECT_EQ(assetC.GetAsset().asset_b_ref, assetC_dup.GetAsset().asset_b_ref);
EXPECT_EQ(assetC.GetAsset().asset_b_refs, EXPECT_EQ(assetC.GetAsset().asset_b_refs,
(eastl::vector<SoftRef<AssetB>> {SoftRef<AssetB> {assetB.GetHeader().uuid}})); (eastl::vector<SoftReference<AssetB>> {SoftReference<AssetB> {assetB.GetHeader().uuid}}));
EXPECT_EQ(assetC.GetAsset().asset_b_refs, assetC_dup.GetAsset().asset_b_refs); EXPECT_EQ(assetC.GetAsset().asset_b_refs, assetC_dup.GetAsset().asset_b_refs);
EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_ref, HardRef<AssetA> {assetA.GetHeader().uuid}); EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_ref, HardReference<AssetA> {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, assetC_dup.GetAsset().inner_table->asset_a_ref);
EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_refs, EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_refs,
(eastl::vector<HardRef<AssetA>> {HardRef<AssetA> {assetA.GetHeader().uuid}, (eastl::vector<HardReference<AssetA>> {HardReference<AssetA> {assetA.GetHeader().uuid},
HardRef<AssetA> {assetAA.GetHeader().uuid}})); HardReference<AssetA> {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, assetC_dup.GetAsset().inner_table->asset_a_refs);
} }
TEST_F(AssetFixture, MiniReflect) TEST_F(AssetFixture, MiniReflect) { }
{
}
} // namespace Bigfoot } // namespace Bigfoot

View File

@@ -6,7 +6,7 @@
*********************************************************************/ *********************************************************************/
#ifndef BIGFOOT_ENGINE_ASSETA_FWD_HPP #ifndef BIGFOOT_ENGINE_ASSETA_FWD_HPP
#define BIGFOOT_ENGINE_ASSETA_FWD_HPP #define BIGFOOT_ENGINE_ASSETA_FWD_HPP
#include <Engine/Asset/Reference_generated.hpp> #include <Engine/Asset/AssetHelper.hpp>
namespace Bigfoot namespace Bigfoot
{ {

View File

@@ -8,8 +8,8 @@ namespace Flat.Bigfoot;
table AssetB table AssetB
{ {
asset_a_ref: Flat.Bigfoot.HardRef (native_type: "::Bigfoot::HardRef<::Bigfoot::AssetA>", native_inline, native_type_pack_name: "HardRefAssetA"); asset_a_ref: Flat.Bigfoot.HardReference (native_type: "::Bigfoot::HardReference<::Bigfoot::AssetA>", native_inline, native_type_pack_name: "HardReferenceAssetA");
asset_a_refs: [Flat.Bigfoot.SoftRef] (native_type: "::Bigfoot::SoftRef<::Bigfoot::AssetA>", native_inline, native_type_pack_name: "SoftRefAssetA"); asset_a_refs: [Flat.Bigfoot.SoftReference] (native_type: "::Bigfoot::SoftReference<::Bigfoot::AssetA>", native_inline, native_type_pack_name: "SoftReferenceAssetA");
} }
root_type AssetB; root_type AssetB;

View File

@@ -6,7 +6,7 @@
*********************************************************************/ *********************************************************************/
#ifndef BIGFOOT_ENGINE_ASSETB_FWD_HPP #ifndef BIGFOOT_ENGINE_ASSETB_FWD_HPP
#define BIGFOOT_ENGINE_ASSETB_FWD_HPP #define BIGFOOT_ENGINE_ASSETB_FWD_HPP
#include <Engine/Asset/Reference_generated.hpp> #include <Engine/Asset/AssetHelper.hpp>
namespace Bigfoot namespace Bigfoot
{ {

View File

@@ -39,8 +39,8 @@ struct AssetBT : public ::flatbuffers::NativeTable {
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
return "Flat.Bigfoot.AssetBT"; return "Flat.Bigfoot.AssetBT";
} }
::Bigfoot::HardRef<::Bigfoot::AssetA> asset_a_ref{}; ::Bigfoot::HardReference<::Bigfoot::AssetA> asset_a_ref{};
eastl::vector<::Bigfoot::SoftRef<::Bigfoot::AssetA>> asset_a_refs{}; eastl::vector<::Bigfoot::SoftReference<::Bigfoot::AssetA>> asset_a_refs{};
}; };
struct AssetB FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { struct AssetB FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
@@ -57,16 +57,16 @@ struct AssetB FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
VT_ASSET_A_REF = 4, VT_ASSET_A_REF = 4,
VT_ASSET_A_REFS = 6 VT_ASSET_A_REFS = 6
}; };
const Flat::Bigfoot::HardRef *asset_a_ref() const { const Flat::Bigfoot::HardReference *asset_a_ref() const {
return GetStruct<const Flat::Bigfoot::HardRef *>(VT_ASSET_A_REF); return GetStruct<const Flat::Bigfoot::HardReference *>(VT_ASSET_A_REF);
} }
const ::flatbuffers::Vector<const Flat::Bigfoot::SoftRef *> *asset_a_refs() const { const ::flatbuffers::Vector<const Flat::Bigfoot::SoftReference *> *asset_a_refs() const {
return GetPointer<const ::flatbuffers::Vector<const Flat::Bigfoot::SoftRef *> *>(VT_ASSET_A_REFS); return GetPointer<const ::flatbuffers::Vector<const Flat::Bigfoot::SoftReference *> *>(VT_ASSET_A_REFS);
} }
template <bool B = false> template <bool B = false>
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const { bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
return VerifyTableStart(verifier) && return VerifyTableStart(verifier) &&
VerifyField<Flat::Bigfoot::HardRef>(verifier, VT_ASSET_A_REF, 1) && VerifyField<Flat::Bigfoot::HardReference>(verifier, VT_ASSET_A_REF, 1) &&
VerifyOffset(verifier, VT_ASSET_A_REFS) && VerifyOffset(verifier, VT_ASSET_A_REFS) &&
verifier.VerifyVector(asset_a_refs()) && verifier.VerifyVector(asset_a_refs()) &&
verifier.EndTable(); verifier.EndTable();
@@ -80,10 +80,10 @@ struct AssetBBuilder {
typedef AssetB Table; typedef AssetB Table;
::flatbuffers::FlatBufferBuilder &fbb_; ::flatbuffers::FlatBufferBuilder &fbb_;
::flatbuffers::uoffset_t start_; ::flatbuffers::uoffset_t start_;
void add_asset_a_ref(const Flat::Bigfoot::HardRef *asset_a_ref) { void add_asset_a_ref(const Flat::Bigfoot::HardReference *asset_a_ref) {
fbb_.AddStruct(AssetB::VT_ASSET_A_REF, asset_a_ref); fbb_.AddStruct(AssetB::VT_ASSET_A_REF, asset_a_ref);
} }
void add_asset_a_refs(::flatbuffers::Offset<::flatbuffers::Vector<const Flat::Bigfoot::SoftRef *>> asset_a_refs) { void add_asset_a_refs(::flatbuffers::Offset<::flatbuffers::Vector<const Flat::Bigfoot::SoftReference *>> asset_a_refs) {
fbb_.AddOffset(AssetB::VT_ASSET_A_REFS, asset_a_refs); fbb_.AddOffset(AssetB::VT_ASSET_A_REFS, asset_a_refs);
} }
explicit AssetBBuilder(::flatbuffers::FlatBufferBuilder &_fbb) explicit AssetBBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
@@ -99,8 +99,8 @@ struct AssetBBuilder {
inline ::flatbuffers::Offset<AssetB> CreateAssetB( inline ::flatbuffers::Offset<AssetB> CreateAssetB(
::flatbuffers::FlatBufferBuilder &_fbb, ::flatbuffers::FlatBufferBuilder &_fbb,
const Flat::Bigfoot::HardRef *asset_a_ref = nullptr, const Flat::Bigfoot::HardReference *asset_a_ref = nullptr,
::flatbuffers::Offset<::flatbuffers::Vector<const Flat::Bigfoot::SoftRef *>> asset_a_refs = 0) { ::flatbuffers::Offset<::flatbuffers::Vector<const Flat::Bigfoot::SoftReference *>> asset_a_refs = 0) {
AssetBBuilder builder_(_fbb); AssetBBuilder builder_(_fbb);
builder_.add_asset_a_refs(asset_a_refs); builder_.add_asset_a_refs(asset_a_refs);
builder_.add_asset_a_ref(asset_a_ref); builder_.add_asset_a_ref(asset_a_ref);
@@ -123,8 +123,8 @@ inline AssetBT *AssetB::UnPack(const ::flatbuffers::resolver_function_t *_resolv
inline void AssetB::UnPackTo(AssetBT *_o, const ::flatbuffers::resolver_function_t *_resolver) const { inline void AssetB::UnPackTo(AssetBT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
(void)_o; (void)_o;
(void)_resolver; (void)_resolver;
{ auto _e = asset_a_ref(); if (_e) _o->asset_a_ref = ::flatbuffers::UnPackHardRefAssetA(*_e); } { 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::UnPackSoftRefAssetA(*_e->Get(_i)); } } else { _o->asset_a_refs.resize(0); } } { 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<AssetB> CreateAssetB(::flatbuffers::FlatBufferBuilder &_fbb, const AssetBT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) { inline ::flatbuffers::Offset<AssetB> CreateAssetB(::flatbuffers::FlatBufferBuilder &_fbb, const AssetBT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
@@ -135,8 +135,8 @@ inline ::flatbuffers::Offset<AssetB> AssetB::Pack(::flatbuffers::FlatBufferBuild
(void)_rehasher; (void)_rehasher;
(void)_o; (void)_o;
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const AssetBT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 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::PackHardRefAssetA(_o->asset_a_ref); auto _asset_a_ref = ::flatbuffers::PackHardReferenceAssetA(_o->asset_a_ref);
auto _asset_a_refs = _fbb.CreateVectorOfNativeStructs<Flat::Bigfoot::SoftRef, ::Bigfoot::SoftRef<::Bigfoot::AssetA>>(_o->asset_a_refs.data(), _o->asset_a_refs.size(), ::flatbuffers::PackSoftRefAssetA); auto _asset_a_refs = _fbb.CreateVectorOfNativeStructs<Flat::Bigfoot::SoftReference, ::Bigfoot::SoftReference<::Bigfoot::AssetA>>(_o->asset_a_refs.data(), _o->asset_a_refs.size(), ::flatbuffers::PackSoftReferenceAssetA);
return Flat::Bigfoot::CreateAssetB( return Flat::Bigfoot::CreateAssetB(
_fbb, _fbb,
&_asset_a_ref, &_asset_a_ref,
@@ -149,8 +149,8 @@ inline const ::flatbuffers::TypeTable *AssetBTypeTable() {
{ ::flatbuffers::ET_SEQUENCE, 1, 1 } { ::flatbuffers::ET_SEQUENCE, 1, 1 }
}; };
static const ::flatbuffers::TypeFunction type_refs[] = { static const ::flatbuffers::TypeFunction type_refs[] = {
Flat::Bigfoot::HardRefTypeTable, Flat::Bigfoot::HardReferenceTypeTable,
Flat::Bigfoot::SoftRefTypeTable Flat::Bigfoot::SoftReferenceTypeTable
}; };
static const ::flatbuffers::TypeTable tt = { static const ::flatbuffers::TypeTable tt = {
::flatbuffers::ST_TABLE, 2, type_codes, type_refs, nullptr, nullptr, nullptr ::flatbuffers::ST_TABLE, 2, type_codes, type_refs, nullptr, nullptr, nullptr

View File

@@ -9,16 +9,16 @@ namespace Flat.Bigfoot;
table InnerTable table InnerTable
{ {
asset_a_ref: Flat.Bigfoot.HardRef (native_type: "::Bigfoot::HardRef<::Bigfoot::AssetA>", native_inline, native_type_pack_name: "HardRefAssetA"); asset_a_ref: Flat.Bigfoot.HardReference (native_type: "::Bigfoot::HardReference<::Bigfoot::AssetA>", native_inline, native_type_pack_name: "HardReferenceAssetA");
asset_a_refs: [Flat.Bigfoot.HardRef] (native_type: "::Bigfoot::HardRef<::Bigfoot::AssetA>", native_inline, native_type_pack_name: "HardRefAssetA"); asset_a_refs: [Flat.Bigfoot.HardReference] (native_type: "::Bigfoot::HardReference<::Bigfoot::AssetA>", native_inline, native_type_pack_name: "HardReferenceAssetA");
} }
table AssetC table AssetC
{ {
inner_table: InnerTable (required); inner_table: InnerTable (required);
asset_b_ref: Flat.Bigfoot.HardRef (native_type: "::Bigfoot::HardRef<::Bigfoot::AssetB>", native_inline, native_type_pack_name: "HardRefAssetB"); asset_b_ref: Flat.Bigfoot.HardReference (native_type: "::Bigfoot::HardReference<::Bigfoot::AssetB>", native_inline, native_type_pack_name: "HardReferenceAssetB");
asset_b_refs: [Flat.Bigfoot.SoftRef] (native_type: "::Bigfoot::SoftRef<::Bigfoot::AssetB>", native_inline, native_type_pack_name: "SoftRefAssetB"); asset_b_refs: [Flat.Bigfoot.SoftReference] (native_type: "::Bigfoot::SoftReference<::Bigfoot::AssetB>", native_inline, native_type_pack_name: "SoftReferenceAssetB");
} }
root_type AssetC; root_type AssetC;

View File

@@ -6,7 +6,7 @@
*********************************************************************/ *********************************************************************/
#ifndef BIGFOOT_ENGINE_ASSETC_FWD_HPP #ifndef BIGFOOT_ENGINE_ASSETC_FWD_HPP
#define BIGFOOT_ENGINE_ASSETC_FWD_HPP #define BIGFOOT_ENGINE_ASSETC_FWD_HPP
#include <Engine/Asset/Reference_generated.hpp> #include <Engine/Asset/AssetHelper.hpp>
namespace Bigfoot namespace Bigfoot
{ {

View File

@@ -47,8 +47,8 @@ struct InnerTableT : public ::flatbuffers::NativeTable {
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
return "Flat.Bigfoot.InnerTableT"; return "Flat.Bigfoot.InnerTableT";
} }
::Bigfoot::HardRef<::Bigfoot::AssetA> asset_a_ref{}; ::Bigfoot::HardReference<::Bigfoot::AssetA> asset_a_ref{};
eastl::vector<::Bigfoot::HardRef<::Bigfoot::AssetA>> asset_a_refs{}; eastl::vector<::Bigfoot::HardReference<::Bigfoot::AssetA>> asset_a_refs{};
}; };
struct InnerTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { struct InnerTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
@@ -65,16 +65,16 @@ struct InnerTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
VT_ASSET_A_REF = 4, VT_ASSET_A_REF = 4,
VT_ASSET_A_REFS = 6 VT_ASSET_A_REFS = 6
}; };
const Flat::Bigfoot::HardRef *asset_a_ref() const { const Flat::Bigfoot::HardReference *asset_a_ref() const {
return GetStruct<const Flat::Bigfoot::HardRef *>(VT_ASSET_A_REF); return GetStruct<const Flat::Bigfoot::HardReference *>(VT_ASSET_A_REF);
} }
const ::flatbuffers::Vector<const Flat::Bigfoot::HardRef *> *asset_a_refs() const { const ::flatbuffers::Vector<const Flat::Bigfoot::HardReference *> *asset_a_refs() const {
return GetPointer<const ::flatbuffers::Vector<const Flat::Bigfoot::HardRef *> *>(VT_ASSET_A_REFS); return GetPointer<const ::flatbuffers::Vector<const Flat::Bigfoot::HardReference *> *>(VT_ASSET_A_REFS);
} }
template <bool B = false> template <bool B = false>
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const { bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
return VerifyTableStart(verifier) && return VerifyTableStart(verifier) &&
VerifyField<Flat::Bigfoot::HardRef>(verifier, VT_ASSET_A_REF, 1) && VerifyField<Flat::Bigfoot::HardReference>(verifier, VT_ASSET_A_REF, 1) &&
VerifyOffset(verifier, VT_ASSET_A_REFS) && VerifyOffset(verifier, VT_ASSET_A_REFS) &&
verifier.VerifyVector(asset_a_refs()) && verifier.VerifyVector(asset_a_refs()) &&
verifier.EndTable(); verifier.EndTable();
@@ -88,10 +88,10 @@ struct InnerTableBuilder {
typedef InnerTable Table; typedef InnerTable Table;
::flatbuffers::FlatBufferBuilder &fbb_; ::flatbuffers::FlatBufferBuilder &fbb_;
::flatbuffers::uoffset_t start_; ::flatbuffers::uoffset_t start_;
void add_asset_a_ref(const Flat::Bigfoot::HardRef *asset_a_ref) { void add_asset_a_ref(const Flat::Bigfoot::HardReference *asset_a_ref) {
fbb_.AddStruct(InnerTable::VT_ASSET_A_REF, asset_a_ref); fbb_.AddStruct(InnerTable::VT_ASSET_A_REF, asset_a_ref);
} }
void add_asset_a_refs(::flatbuffers::Offset<::flatbuffers::Vector<const Flat::Bigfoot::HardRef *>> asset_a_refs) { void add_asset_a_refs(::flatbuffers::Offset<::flatbuffers::Vector<const Flat::Bigfoot::HardReference *>> asset_a_refs) {
fbb_.AddOffset(InnerTable::VT_ASSET_A_REFS, asset_a_refs); fbb_.AddOffset(InnerTable::VT_ASSET_A_REFS, asset_a_refs);
} }
explicit InnerTableBuilder(::flatbuffers::FlatBufferBuilder &_fbb) explicit InnerTableBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
@@ -107,8 +107,8 @@ struct InnerTableBuilder {
inline ::flatbuffers::Offset<InnerTable> CreateInnerTable( inline ::flatbuffers::Offset<InnerTable> CreateInnerTable(
::flatbuffers::FlatBufferBuilder &_fbb, ::flatbuffers::FlatBufferBuilder &_fbb,
const Flat::Bigfoot::HardRef *asset_a_ref = nullptr, const Flat::Bigfoot::HardReference *asset_a_ref = nullptr,
::flatbuffers::Offset<::flatbuffers::Vector<const Flat::Bigfoot::HardRef *>> asset_a_refs = 0) { ::flatbuffers::Offset<::flatbuffers::Vector<const Flat::Bigfoot::HardReference *>> asset_a_refs = 0) {
InnerTableBuilder builder_(_fbb); InnerTableBuilder builder_(_fbb);
builder_.add_asset_a_refs(asset_a_refs); builder_.add_asset_a_refs(asset_a_refs);
builder_.add_asset_a_ref(asset_a_ref); builder_.add_asset_a_ref(asset_a_ref);
@@ -128,8 +128,8 @@ struct AssetCT : public ::flatbuffers::NativeTable {
return "Flat.Bigfoot.AssetCT"; return "Flat.Bigfoot.AssetCT";
} }
eastl::unique_ptr<Flat::Bigfoot::InnerTableT> inner_table{}; eastl::unique_ptr<Flat::Bigfoot::InnerTableT> inner_table{};
::Bigfoot::HardRef<::Bigfoot::AssetB> asset_b_ref{}; ::Bigfoot::HardReference<::Bigfoot::AssetB> asset_b_ref{};
eastl::vector<::Bigfoot::SoftRef<::Bigfoot::AssetB>> asset_b_refs{}; eastl::vector<::Bigfoot::SoftReference<::Bigfoot::AssetB>> asset_b_refs{};
AssetCT() = default; AssetCT() = default;
AssetCT(const AssetCT &o); AssetCT(const AssetCT &o);
AssetCT(AssetCT&&) FLATBUFFERS_NOEXCEPT = default; AssetCT(AssetCT&&) FLATBUFFERS_NOEXCEPT = default;
@@ -154,18 +154,18 @@ struct AssetC FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
const Flat::Bigfoot::InnerTable *inner_table() const { const Flat::Bigfoot::InnerTable *inner_table() const {
return GetPointer<const Flat::Bigfoot::InnerTable *>(VT_INNER_TABLE); return GetPointer<const Flat::Bigfoot::InnerTable *>(VT_INNER_TABLE);
} }
const Flat::Bigfoot::HardRef *asset_b_ref() const { const Flat::Bigfoot::HardReference *asset_b_ref() const {
return GetStruct<const Flat::Bigfoot::HardRef *>(VT_ASSET_B_REF); return GetStruct<const Flat::Bigfoot::HardReference *>(VT_ASSET_B_REF);
} }
const ::flatbuffers::Vector<const Flat::Bigfoot::SoftRef *> *asset_b_refs() const { const ::flatbuffers::Vector<const Flat::Bigfoot::SoftReference *> *asset_b_refs() const {
return GetPointer<const ::flatbuffers::Vector<const Flat::Bigfoot::SoftRef *> *>(VT_ASSET_B_REFS); return GetPointer<const ::flatbuffers::Vector<const Flat::Bigfoot::SoftReference *> *>(VT_ASSET_B_REFS);
} }
template <bool B = false> template <bool B = false>
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const { bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
return VerifyTableStart(verifier) && return VerifyTableStart(verifier) &&
VerifyOffsetRequired(verifier, VT_INNER_TABLE) && VerifyOffsetRequired(verifier, VT_INNER_TABLE) &&
verifier.VerifyTable(inner_table()) && verifier.VerifyTable(inner_table()) &&
VerifyField<Flat::Bigfoot::HardRef>(verifier, VT_ASSET_B_REF, 1) && VerifyField<Flat::Bigfoot::HardReference>(verifier, VT_ASSET_B_REF, 1) &&
VerifyOffset(verifier, VT_ASSET_B_REFS) && VerifyOffset(verifier, VT_ASSET_B_REFS) &&
verifier.VerifyVector(asset_b_refs()) && verifier.VerifyVector(asset_b_refs()) &&
verifier.EndTable(); verifier.EndTable();
@@ -182,10 +182,10 @@ struct AssetCBuilder {
void add_inner_table(::flatbuffers::Offset<Flat::Bigfoot::InnerTable> inner_table) { void add_inner_table(::flatbuffers::Offset<Flat::Bigfoot::InnerTable> inner_table) {
fbb_.AddOffset(AssetC::VT_INNER_TABLE, inner_table); fbb_.AddOffset(AssetC::VT_INNER_TABLE, inner_table);
} }
void add_asset_b_ref(const Flat::Bigfoot::HardRef *asset_b_ref) { void add_asset_b_ref(const Flat::Bigfoot::HardReference *asset_b_ref) {
fbb_.AddStruct(AssetC::VT_ASSET_B_REF, asset_b_ref); fbb_.AddStruct(AssetC::VT_ASSET_B_REF, asset_b_ref);
} }
void add_asset_b_refs(::flatbuffers::Offset<::flatbuffers::Vector<const Flat::Bigfoot::SoftRef *>> asset_b_refs) { void add_asset_b_refs(::flatbuffers::Offset<::flatbuffers::Vector<const Flat::Bigfoot::SoftReference *>> asset_b_refs) {
fbb_.AddOffset(AssetC::VT_ASSET_B_REFS, asset_b_refs); fbb_.AddOffset(AssetC::VT_ASSET_B_REFS, asset_b_refs);
} }
explicit AssetCBuilder(::flatbuffers::FlatBufferBuilder &_fbb) explicit AssetCBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
@@ -203,8 +203,8 @@ struct AssetCBuilder {
inline ::flatbuffers::Offset<AssetC> CreateAssetC( inline ::flatbuffers::Offset<AssetC> CreateAssetC(
::flatbuffers::FlatBufferBuilder &_fbb, ::flatbuffers::FlatBufferBuilder &_fbb,
::flatbuffers::Offset<Flat::Bigfoot::InnerTable> inner_table = 0, ::flatbuffers::Offset<Flat::Bigfoot::InnerTable> inner_table = 0,
const Flat::Bigfoot::HardRef *asset_b_ref = nullptr, const Flat::Bigfoot::HardReference *asset_b_ref = nullptr,
::flatbuffers::Offset<::flatbuffers::Vector<const Flat::Bigfoot::SoftRef *>> asset_b_refs = 0) { ::flatbuffers::Offset<::flatbuffers::Vector<const Flat::Bigfoot::SoftReference *>> asset_b_refs = 0) {
AssetCBuilder builder_(_fbb); AssetCBuilder builder_(_fbb);
builder_.add_asset_b_refs(asset_b_refs); builder_.add_asset_b_refs(asset_b_refs);
builder_.add_asset_b_ref(asset_b_ref); builder_.add_asset_b_ref(asset_b_ref);
@@ -228,8 +228,8 @@ inline InnerTableT *InnerTable::UnPack(const ::flatbuffers::resolver_function_t
inline void InnerTable::UnPackTo(InnerTableT *_o, const ::flatbuffers::resolver_function_t *_resolver) const { inline void InnerTable::UnPackTo(InnerTableT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
(void)_o; (void)_o;
(void)_resolver; (void)_resolver;
{ auto _e = asset_a_ref(); if (_e) _o->asset_a_ref = ::flatbuffers::UnPackHardRefAssetA(*_e); } { 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::UnPackHardRefAssetA(*_e->Get(_i)); } } else { _o->asset_a_refs.resize(0); } } { 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<InnerTable> CreateInnerTable(::flatbuffers::FlatBufferBuilder &_fbb, const InnerTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) { inline ::flatbuffers::Offset<InnerTable> CreateInnerTable(::flatbuffers::FlatBufferBuilder &_fbb, const InnerTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
@@ -240,8 +240,8 @@ inline ::flatbuffers::Offset<InnerTable> InnerTable::Pack(::flatbuffers::FlatBuf
(void)_rehasher; (void)_rehasher;
(void)_o; (void)_o;
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const InnerTableT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 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::PackHardRefAssetA(_o->asset_a_ref); auto _asset_a_ref = ::flatbuffers::PackHardReferenceAssetA(_o->asset_a_ref);
auto _asset_a_refs = _fbb.CreateVectorOfNativeStructs<Flat::Bigfoot::HardRef, ::Bigfoot::HardRef<::Bigfoot::AssetA>>(_o->asset_a_refs.data(), _o->asset_a_refs.size(), ::flatbuffers::PackHardRefAssetA); auto _asset_a_refs = _fbb.CreateVectorOfNativeStructs<Flat::Bigfoot::HardReference, ::Bigfoot::HardReference<::Bigfoot::AssetA>>(_o->asset_a_refs.data(), _o->asset_a_refs.size(), ::flatbuffers::PackHardReferenceAssetA);
return Flat::Bigfoot::CreateInnerTable( return Flat::Bigfoot::CreateInnerTable(
_fbb, _fbb,
&_asset_a_ref, &_asset_a_ref,
@@ -271,8 +271,8 @@ inline void AssetC::UnPackTo(AssetCT *_o, const ::flatbuffers::resolver_function
(void)_o; (void)_o;
(void)_resolver; (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<Flat::Bigfoot::InnerTableT>(_e->UnPack(_resolver)); } } else if (_o->inner_table) { _o->inner_table.reset(); } } { auto _e = inner_table(); if (_e) { if(_o->inner_table) { _e->UnPackTo(_o->inner_table.get(), _resolver); } else { _o->inner_table = eastl::unique_ptr<Flat::Bigfoot::InnerTableT>(_e->UnPack(_resolver)); } } else if (_o->inner_table) { _o->inner_table.reset(); } }
{ auto _e = asset_b_ref(); if (_e) _o->asset_b_ref = ::flatbuffers::UnPackHardRefAssetB(*_e); } { 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::UnPackSoftRefAssetB(*_e->Get(_i)); } } else { _o->asset_b_refs.resize(0); } } { 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<AssetC> CreateAssetC(::flatbuffers::FlatBufferBuilder &_fbb, const AssetCT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) { inline ::flatbuffers::Offset<AssetC> CreateAssetC(::flatbuffers::FlatBufferBuilder &_fbb, const AssetCT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
@@ -284,8 +284,8 @@ inline ::flatbuffers::Offset<AssetC> AssetC::Pack(::flatbuffers::FlatBufferBuild
(void)_o; (void)_o;
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const AssetCT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 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 _inner_table = _o->inner_table ? CreateInnerTable(_fbb, _o->inner_table.get(), _rehasher) : 0;
auto _asset_b_ref = ::flatbuffers::PackHardRefAssetB(_o->asset_b_ref); auto _asset_b_ref = ::flatbuffers::PackHardReferenceAssetB(_o->asset_b_ref);
auto _asset_b_refs = _fbb.CreateVectorOfNativeStructs<Flat::Bigfoot::SoftRef, ::Bigfoot::SoftRef<::Bigfoot::AssetB>>(_o->asset_b_refs.data(), _o->asset_b_refs.size(), ::flatbuffers::PackSoftRefAssetB); auto _asset_b_refs = _fbb.CreateVectorOfNativeStructs<Flat::Bigfoot::SoftReference, ::Bigfoot::SoftReference<::Bigfoot::AssetB>>(_o->asset_b_refs.data(), _o->asset_b_refs.size(), ::flatbuffers::PackSoftReferenceAssetB);
return Flat::Bigfoot::CreateAssetC( return Flat::Bigfoot::CreateAssetC(
_fbb, _fbb,
_inner_table, _inner_table,
@@ -299,7 +299,7 @@ inline const ::flatbuffers::TypeTable *InnerTableTypeTable() {
{ ::flatbuffers::ET_SEQUENCE, 1, 0 } { ::flatbuffers::ET_SEQUENCE, 1, 0 }
}; };
static const ::flatbuffers::TypeFunction type_refs[] = { static const ::flatbuffers::TypeFunction type_refs[] = {
Flat::Bigfoot::HardRefTypeTable Flat::Bigfoot::HardReferenceTypeTable
}; };
static const ::flatbuffers::TypeTable tt = { static const ::flatbuffers::TypeTable tt = {
::flatbuffers::ST_TABLE, 2, type_codes, type_refs, nullptr, nullptr, nullptr ::flatbuffers::ST_TABLE, 2, type_codes, type_refs, nullptr, nullptr, nullptr
@@ -315,8 +315,8 @@ inline const ::flatbuffers::TypeTable *AssetCTypeTable() {
}; };
static const ::flatbuffers::TypeFunction type_refs[] = { static const ::flatbuffers::TypeFunction type_refs[] = {
Flat::Bigfoot::InnerTableTypeTable, Flat::Bigfoot::InnerTableTypeTable,
Flat::Bigfoot::HardRefTypeTable, Flat::Bigfoot::HardReferenceTypeTable,
Flat::Bigfoot::SoftRefTypeTable Flat::Bigfoot::SoftReferenceTypeTable
}; };
static const ::flatbuffers::TypeTable tt = { static const ::flatbuffers::TypeTable tt = {
::flatbuffers::ST_TABLE, 3, type_codes, type_refs, nullptr, nullptr, nullptr ::flatbuffers::ST_TABLE, 3, type_codes, type_refs, nullptr, nullptr, nullptr