From 0ef2f842cb9a005237810c2907320d1339ee278e Mon Sep 17 00:00:00 2001 From: Romain BOULLARD Date: Tue, 10 Feb 2026 00:37:55 +0100 Subject: [PATCH] AssetTypeID;No circular Dependency;AssetHeader --- .../BigFile/Asset/AssetTypeID.cpp} | 12 +-- .../Sources/Engine/BigFile/BigFileSchema.sql | 1 - .../Engine/BigFile/Asset/AssetHeader.fbs | 16 ++-- .../BigFile/Asset/AssetHeader_generated.hpp | 91 +++++++------------ .../Engine/BigFile/Asset/AssetTypeID.fbs | 6 ++ .../Engine/BigFile/Asset/AssetTypeID.hpp | 24 +++++ .../BigFile/Asset/AssetTypeID_generated.hpp | 71 +++++++++++++++ .../System/Include/System/Time/FlatTime.hpp | 18 ---- .../System/Include/System/Time/Time.fbs | 2 - .../System/Include/System/Time/Time.hpp | 10 ++ .../Include/System/Time/Time_generated.hpp | 2 - .../System/Include/System/UUID/FlatUUID.hpp | 18 ---- .../System/Include/System/UUID/UUID.fbs | 2 - .../System/Include/System/UUID/UUID.hpp | 11 +++ .../Include/System/UUID/UUID_generated.hpp | 2 - Bigfoot/Sources/System/Time/Time.cpp | 17 ++++ Bigfoot/Sources/System/UUID/FlatUUID.cpp | 27 ------ Bigfoot/Sources/System/UUID/UUID.cpp | 22 +++++ Bigfoot/Tests/Engine/BigFile/BigFile.cpp | 1 + .../BigFile/Asset/AssetA_generated.hpp | 5 +- 20 files changed, 211 insertions(+), 147 deletions(-) rename Bigfoot/Sources/{System/Time/FlatTime.cpp => Engine/BigFile/Asset/AssetTypeID.cpp} (50%) create mode 100644 Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetTypeID.fbs create mode 100644 Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetTypeID.hpp create mode 100644 Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetTypeID_generated.hpp delete mode 100644 Bigfoot/Sources/System/Include/System/Time/FlatTime.hpp delete mode 100644 Bigfoot/Sources/System/Include/System/UUID/FlatUUID.hpp delete mode 100644 Bigfoot/Sources/System/UUID/FlatUUID.cpp diff --git a/Bigfoot/Sources/System/Time/FlatTime.cpp b/Bigfoot/Sources/Engine/BigFile/Asset/AssetTypeID.cpp similarity index 50% rename from Bigfoot/Sources/System/Time/FlatTime.cpp rename to Bigfoot/Sources/Engine/BigFile/Asset/AssetTypeID.cpp index 7b885f2..71093f3 100644 --- a/Bigfoot/Sources/System/Time/FlatTime.cpp +++ b/Bigfoot/Sources/Engine/BigFile/Asset/AssetTypeID.cpp @@ -1,22 +1,22 @@ /********************************************************************* - * \file FlatTime.cpp + * \file AssetTypeID.cpp * * \author Romain BOULLARD * \date February 2026 *********************************************************************/ -#include +#include namespace flatbuffers { -Bigfoot::Flat::Time Pack(const Bigfoot::Time& p_time) +Bigfoot::Flat::AssetTypeID Pack(const Bigfoot::AssetTypeID& p_assetTypeID) { - return Bigfoot::Flat::Time {p_time.Epoch()}; + return Bigfoot::Flat::AssetTypeID {p_assetTypeID}; } /****************************************************************************************/ -Bigfoot::Time UnPack(const Bigfoot::Flat::Time& p_flatTime) +Bigfoot::AssetTypeID UnPack(const Bigfoot::Flat::AssetTypeID& p_flatAssetTypeID) { - return Bigfoot::Time {p_flatTime.epoch()}; + return Bigfoot::AssetTypeID {p_flatAssetTypeID.value()}; } } // namespace flatbuffers diff --git a/Bigfoot/Sources/Engine/BigFile/BigFileSchema.sql b/Bigfoot/Sources/Engine/BigFile/BigFileSchema.sql index dc5e9ae..e307f48 100644 --- a/Bigfoot/Sources/Engine/BigFile/BigFileSchema.sql +++ b/Bigfoot/Sources/Engine/BigFile/BigFileSchema.sql @@ -7,7 +7,6 @@ CREATE TABLE IF NOT EXISTS AssetHeader ( Name TEXT NOT NULL UNIQUE, TypeID INTEGER NOT NULL, TypeName TEXT NOT NULL, - Version INTEGER NOT NULL, CreateTime INTEGER NOT NULL DEFAULT(CAST(unixepoch('subsec') AS INTEGER) * 1000000), ModificationTime INTEGER NOT NULL DEFAULT(CAST(unixepoch('subsec') AS INTEGER) * 1000000), diff --git a/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetHeader.fbs b/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetHeader.fbs index 4215921..49e5c19 100644 --- a/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetHeader.fbs +++ b/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetHeader.fbs @@ -1,18 +1,18 @@ +include "Engine/BigFile/Asset/AssetTypeID.fbs"; +native_include "Engine/BigFile/Asset/AssetTypeID.hpp"; + include "System/UUID/UUID.fbs"; -include "System/Time/Time.fbs"; +native_include "System/UUID/UUID.hpp"; namespace Bigfoot.Flat; table AssetHeader { - uuid: UUID (native_inline); - name: string; - type_id: ulong; - type_name: string; + uuid: UUID (required, native_inline); + name: string (required); + type_id: AssetTypeID (required, native_inline); + type_name: string (required); version: uint; - - create_time: Time (native_inline); - modification_time: Time (native_inline); } root_type AssetHeader; \ No newline at end of file diff --git a/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetHeader_generated.hpp b/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetHeader_generated.hpp index 12c758b..d4ef97c 100644 --- a/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetHeader_generated.hpp +++ b/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetHeader_generated.hpp @@ -13,9 +13,10 @@ static_assert(FLATBUFFERS_VERSION_MAJOR == 25 && FLATBUFFERS_VERSION_REVISION == 19, "Non-compatible flatbuffers version included"); -#include "System/UUID/FlatUUID.hpp" -#include "System/Time/FlatTime.hpp" -#include "System/Time/Time_generated.hpp" +#include "Engine/BigFile/Asset/AssetTypeID.hpp" +#include "Engine/BigFile/Asset/AssetTypeID.hpp" +#include "System/UUID/UUID.hpp" +#include "Engine/BigFile/Asset/AssetTypeID_generated.hpp" #include "System/UUID/UUID_generated.hpp" #include "EASTL/unique_ptr.h" @@ -37,11 +38,9 @@ struct AssetHeaderT : public ::flatbuffers::NativeTable { } ::Bigfoot::UUID uuid{}; eastl::string name{}; - uint64_t type_id = 0; + ::Bigfoot::AssetTypeID type_id{}; eastl::string type_name{}; uint32_t version = 0; - ::Bigfoot::Time create_time{}; - ::Bigfoot::Time modification_time{}; }; struct AssetHeader FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { @@ -59,9 +58,7 @@ struct AssetHeader FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { VT_NAME = 6, VT_TYPE_ID = 8, VT_TYPE_NAME = 10, - VT_VERSION = 12, - VT_CREATE_TIME = 14, - VT_MODIFICATION_TIME = 16 + VT_VERSION = 12 }; const Bigfoot::Flat::UUID *uuid() const { return GetStruct(VT_UUID); @@ -69,8 +66,8 @@ struct AssetHeader FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { const ::flatbuffers::String *name() const { return GetPointer(VT_NAME); } - uint64_t type_id() const { - return GetField(VT_TYPE_ID, 0); + const Bigfoot::Flat::AssetTypeID *type_id() const { + return GetStruct(VT_TYPE_ID); } const ::flatbuffers::String *type_name() const { return GetPointer(VT_TYPE_NAME); @@ -78,24 +75,16 @@ struct AssetHeader FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { uint32_t version() const { return GetField(VT_VERSION, 0); } - const Bigfoot::Flat::Time *create_time() const { - return GetStruct(VT_CREATE_TIME); - } - const Bigfoot::Flat::Time *modification_time() const { - return GetStruct(VT_MODIFICATION_TIME); - } template bool Verify(::flatbuffers::VerifierTemplate &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_UUID, 1) && - VerifyOffset(verifier, VT_NAME) && + VerifyFieldRequired(verifier, VT_UUID, 1) && + VerifyOffsetRequired(verifier, VT_NAME) && verifier.VerifyString(name()) && - VerifyField(verifier, VT_TYPE_ID, 8) && - VerifyOffset(verifier, VT_TYPE_NAME) && + VerifyFieldRequired(verifier, VT_TYPE_ID, 8) && + VerifyOffsetRequired(verifier, VT_TYPE_NAME) && verifier.VerifyString(type_name()) && VerifyField(verifier, VT_VERSION, 4) && - VerifyField(verifier, VT_CREATE_TIME, 8) && - VerifyField(verifier, VT_MODIFICATION_TIME, 8) && verifier.EndTable(); } AssetHeaderT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const; @@ -113,8 +102,8 @@ struct AssetHeaderBuilder { void add_name(::flatbuffers::Offset<::flatbuffers::String> name) { fbb_.AddOffset(AssetHeader::VT_NAME, name); } - void add_type_id(uint64_t type_id) { - fbb_.AddElement(AssetHeader::VT_TYPE_ID, type_id, 0); + void add_type_id(const Bigfoot::Flat::AssetTypeID *type_id) { + fbb_.AddStruct(AssetHeader::VT_TYPE_ID, type_id); } void add_type_name(::flatbuffers::Offset<::flatbuffers::String> type_name) { fbb_.AddOffset(AssetHeader::VT_TYPE_NAME, type_name); @@ -122,12 +111,6 @@ struct AssetHeaderBuilder { void add_version(uint32_t version) { fbb_.AddElement(AssetHeader::VT_VERSION, version, 0); } - void add_create_time(const Bigfoot::Flat::Time *create_time) { - fbb_.AddStruct(AssetHeader::VT_CREATE_TIME, create_time); - } - void add_modification_time(const Bigfoot::Flat::Time *modification_time) { - fbb_.AddStruct(AssetHeader::VT_MODIFICATION_TIME, modification_time); - } explicit AssetHeaderBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); @@ -135,6 +118,10 @@ struct AssetHeaderBuilder { ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); auto o = ::flatbuffers::Offset(end); + fbb_.Required(o, AssetHeader::VT_UUID); + fbb_.Required(o, AssetHeader::VT_NAME); + fbb_.Required(o, AssetHeader::VT_TYPE_ID); + fbb_.Required(o, AssetHeader::VT_TYPE_NAME); return o; } }; @@ -143,17 +130,13 @@ inline ::flatbuffers::Offset CreateAssetHeader( ::flatbuffers::FlatBufferBuilder &_fbb, const Bigfoot::Flat::UUID *uuid = nullptr, ::flatbuffers::Offset<::flatbuffers::String> name = 0, - uint64_t type_id = 0, + const Bigfoot::Flat::AssetTypeID *type_id = nullptr, ::flatbuffers::Offset<::flatbuffers::String> type_name = 0, - uint32_t version = 0, - const Bigfoot::Flat::Time *create_time = nullptr, - const Bigfoot::Flat::Time *modification_time = nullptr) { + uint32_t version = 0) { AssetHeaderBuilder builder_(_fbb); - builder_.add_type_id(type_id); - builder_.add_modification_time(modification_time); - builder_.add_create_time(create_time); builder_.add_version(version); builder_.add_type_name(type_name); + builder_.add_type_id(type_id); builder_.add_name(name); builder_.add_uuid(uuid); return builder_.Finish(); @@ -177,11 +160,9 @@ inline void AssetHeader::UnPackTo(AssetHeaderT *_o, const ::flatbuffers::resolve (void)_resolver; { auto _e = uuid(); if (_e) _o->uuid = ::flatbuffers::UnPack(*_e); } { auto _e = name(); if (_e) _o->name = eastl::string(_e->c_str(), _e->size()); } - { auto _e = type_id(); _o->type_id = _e; } + { auto _e = type_id(); if (_e) _o->type_id = ::flatbuffers::UnPack(*_e); } { auto _e = type_name(); if (_e) _o->type_name = eastl::string(_e->c_str(), _e->size()); } { auto _e = version(); _o->version = _e; } - { auto _e = create_time(); if (_e) _o->create_time = ::flatbuffers::UnPack(*_e); } - { auto _e = modification_time(); if (_e) _o->modification_time = ::flatbuffers::UnPack(*_e); } } inline ::flatbuffers::Offset CreateAssetHeader(::flatbuffers::FlatBufferBuilder &_fbb, const AssetHeaderT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) { @@ -193,48 +174,40 @@ inline ::flatbuffers::Offset AssetHeader::Pack(::flatbuffers::FlatB (void)_o; struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const AssetHeaderT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; auto _uuid = ::flatbuffers::Pack(_o->uuid); - auto _name = _o->name.empty() ? _fbb.CreateSharedString("") : _fbb.CreateString(_o->name); - auto _type_id = _o->type_id; - auto _type_name = _o->type_name.empty() ? _fbb.CreateSharedString("") : _fbb.CreateString(_o->type_name); + auto _name = _fbb.CreateString(_o->name); + auto _type_id = ::flatbuffers::Pack(_o->type_id); + auto _type_name = _fbb.CreateString(_o->type_name); auto _version = _o->version; - auto _create_time = ::flatbuffers::Pack(_o->create_time); - auto _modification_time = ::flatbuffers::Pack(_o->modification_time); return Bigfoot::Flat::CreateAssetHeader( _fbb, &_uuid, _name, - _type_id, + &_type_id, _type_name, - _version, - &_create_time, - &_modification_time); + _version); } inline const ::flatbuffers::TypeTable *AssetHeaderTypeTable() { static const ::flatbuffers::TypeCode type_codes[] = { { ::flatbuffers::ET_SEQUENCE, 0, 0 }, { ::flatbuffers::ET_STRING, 0, -1 }, - { ::flatbuffers::ET_ULONG, 0, -1 }, - { ::flatbuffers::ET_STRING, 0, -1 }, - { ::flatbuffers::ET_UINT, 0, -1 }, { ::flatbuffers::ET_SEQUENCE, 0, 1 }, - { ::flatbuffers::ET_SEQUENCE, 0, 1 } + { ::flatbuffers::ET_STRING, 0, -1 }, + { ::flatbuffers::ET_UINT, 0, -1 } }; static const ::flatbuffers::TypeFunction type_refs[] = { Bigfoot::Flat::UUIDTypeTable, - Bigfoot::Flat::TimeTypeTable + Bigfoot::Flat::AssetTypeIDTypeTable }; static const char * const names[] = { "uuid", "name", "type_id", "type_name", - "version", - "create_time", - "modification_time" + "version" }; static const ::flatbuffers::TypeTable tt = { - ::flatbuffers::ST_TABLE, 7, type_codes, type_refs, nullptr, nullptr, names + ::flatbuffers::ST_TABLE, 5, type_codes, type_refs, nullptr, nullptr, names }; return &tt; } diff --git a/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetTypeID.fbs b/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetTypeID.fbs new file mode 100644 index 0000000..d7ac3b1 --- /dev/null +++ b/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetTypeID.fbs @@ -0,0 +1,6 @@ +namespace Bigfoot.Flat; + +struct AssetTypeID (native_type: "::Bigfoot::AssetTypeID") +{ + value: ulong; +} \ No newline at end of file diff --git a/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetTypeID.hpp b/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetTypeID.hpp new file mode 100644 index 0000000..ceeb280 --- /dev/null +++ b/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetTypeID.hpp @@ -0,0 +1,24 @@ +/********************************************************************* + * \file AssetTypeID.hpp + * + * \author Romain BOULLARD + * \date February 2026 + *********************************************************************/ +#ifndef BIGFOOT_ENGINE_ASSETTYPEID_HPP +#define BIGFOOT_ENGINE_ASSETTYPEID_HPP +#include + +#include + +namespace Bigfoot +{ +using AssetTypeID = std::uint64_t; +} + +namespace flatbuffers +{ +Bigfoot::Flat::AssetTypeID Pack(const Bigfoot::AssetTypeID& p_assetTypeID); +Bigfoot::AssetTypeID UnPack(const Bigfoot::Flat::AssetTypeID& p_flatAssetTypeID); +} // namespace flatbuffers + +#endif diff --git a/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetTypeID_generated.hpp b/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetTypeID_generated.hpp new file mode 100644 index 0000000..450a892 --- /dev/null +++ b/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetTypeID_generated.hpp @@ -0,0 +1,71 @@ +// automatically generated by the FlatBuffers compiler, do not modify + + +#ifndef FLATBUFFERS_GENERATED_ASSETTYPEID_BIGFOOT_FLAT_H_ +#define FLATBUFFERS_GENERATED_ASSETTYPEID_BIGFOOT_FLAT_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 "EASTL/unique_ptr.h" +#include "EASTL/string.h" + +namespace Bigfoot { +namespace Flat { + +struct AssetTypeID; + +inline const ::flatbuffers::TypeTable *AssetTypeIDTypeTable(); + +FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) AssetTypeID FLATBUFFERS_FINAL_CLASS { + private: + uint64_t value_; + + public: + struct Traits; + static const ::flatbuffers::TypeTable *MiniReflectTypeTable() { + return AssetTypeIDTypeTable(); + } + static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { + return "Bigfoot.Flat.AssetTypeID"; + } + AssetTypeID() + : value_(0) { + } + AssetTypeID(uint64_t _value) + : value_(::flatbuffers::EndianScalar(_value)) { + } + uint64_t value() const { + return ::flatbuffers::EndianScalar(value_); + } +}; +FLATBUFFERS_STRUCT_END(AssetTypeID, 8); + +struct AssetTypeID::Traits { + using type = AssetTypeID; +}; + +inline const ::flatbuffers::TypeTable *AssetTypeIDTypeTable() { + static const ::flatbuffers::TypeCode type_codes[] = { + { ::flatbuffers::ET_ULONG, 0, -1 } + }; + static const int64_t values[] = { 0, 8 }; + static const char * const names[] = { + "value" + }; + static const ::flatbuffers::TypeTable tt = { + ::flatbuffers::ST_STRUCT, 1, type_codes, nullptr, nullptr, values, names + }; + return &tt; +} + +} // namespace Flat +} // namespace Bigfoot + +#endif // FLATBUFFERS_GENERATED_ASSETTYPEID_BIGFOOT_FLAT_H_ diff --git a/Bigfoot/Sources/System/Include/System/Time/FlatTime.hpp b/Bigfoot/Sources/System/Include/System/Time/FlatTime.hpp deleted file mode 100644 index 0ccd1f0..0000000 --- a/Bigfoot/Sources/System/Include/System/Time/FlatTime.hpp +++ /dev/null @@ -1,18 +0,0 @@ -/********************************************************************* - * \file FlatTime.hpp - * - * \author Romain BOULLARD - * \date February 2026 - *********************************************************************/ -#ifndef BIGFOOT_SYSTEM_FLATTIME_HPP -#define BIGFOOT_SYSTEM_FLATTIME_HPP -#include -#include - -namespace flatbuffers -{ -Bigfoot::Flat::Time Pack(const Bigfoot::Time& p_time); -Bigfoot::Time UnPack(const Bigfoot::Flat::Time& p_flatTime); -} // namespace flatbuffers - -#endif diff --git a/Bigfoot/Sources/System/Include/System/Time/Time.fbs b/Bigfoot/Sources/System/Include/System/Time/Time.fbs index 10bb49e..316a348 100644 --- a/Bigfoot/Sources/System/Include/System/Time/Time.fbs +++ b/Bigfoot/Sources/System/Include/System/Time/Time.fbs @@ -1,5 +1,3 @@ -native_include "System/Time/FlatTime.hpp"; - namespace Bigfoot.Flat; struct Time (native_type: "::Bigfoot::Time") diff --git a/Bigfoot/Sources/System/Include/System/Time/Time.hpp b/Bigfoot/Sources/System/Include/System/Time/Time.hpp index fa14d24..1285499 100644 --- a/Bigfoot/Sources/System/Include/System/Time/Time.hpp +++ b/Bigfoot/Sources/System/Include/System/Time/Time.hpp @@ -6,6 +6,8 @@ *********************************************************************/ #ifndef BIGFOOT_SYSTEM_TIME_HPP #define BIGFOOT_SYSTEM_TIME_HPP +#include + #include #include #include @@ -65,4 +67,12 @@ class Time }; } // namespace Bigfoot +/****************************************************************************************/ + +namespace flatbuffers +{ +Bigfoot::Flat::Time Pack(const Bigfoot::Time& p_time); +Bigfoot::Time UnPack(const Bigfoot::Flat::Time& p_flatTime); +} // namespace flatbuffers + #endif diff --git a/Bigfoot/Sources/System/Include/System/Time/Time_generated.hpp b/Bigfoot/Sources/System/Include/System/Time/Time_generated.hpp index d939ddb..fe25a56 100644 --- a/Bigfoot/Sources/System/Include/System/Time/Time_generated.hpp +++ b/Bigfoot/Sources/System/Include/System/Time/Time_generated.hpp @@ -13,8 +13,6 @@ static_assert(FLATBUFFERS_VERSION_MAJOR == 25 && FLATBUFFERS_VERSION_REVISION == 19, "Non-compatible flatbuffers version included"); -#include "System/Time/FlatTime.hpp" - #include "EASTL/unique_ptr.h" #include "EASTL/string.h" diff --git a/Bigfoot/Sources/System/Include/System/UUID/FlatUUID.hpp b/Bigfoot/Sources/System/Include/System/UUID/FlatUUID.hpp deleted file mode 100644 index d8e7f7d..0000000 --- a/Bigfoot/Sources/System/Include/System/UUID/FlatUUID.hpp +++ /dev/null @@ -1,18 +0,0 @@ -/********************************************************************* - * \file FlatUUID.hpp - * - * \author Romain BOULLARD - * \date December 2025 - *********************************************************************/ -#ifndef BIGFOOT_SYSTEM_FLATUUID_HPP -#define BIGFOOT_SYSTEM_FLATUUID_HPP -#include -#include - -namespace flatbuffers -{ -Bigfoot::Flat::UUID Pack(const Bigfoot::UUID& p_uuid); -Bigfoot::UUID UnPack(const Bigfoot::Flat::UUID& p_flatUUID); -} // namespace flatbuffers - -#endif diff --git a/Bigfoot/Sources/System/Include/System/UUID/UUID.fbs b/Bigfoot/Sources/System/Include/System/UUID/UUID.fbs index c622b85..5dab21e 100644 --- a/Bigfoot/Sources/System/Include/System/UUID/UUID.fbs +++ b/Bigfoot/Sources/System/Include/System/UUID/UUID.fbs @@ -1,5 +1,3 @@ -native_include "System/UUID/FlatUUID.hpp"; - namespace Bigfoot.Flat; struct UUID (native_type: "::Bigfoot::UUID") diff --git a/Bigfoot/Sources/System/Include/System/UUID/UUID.hpp b/Bigfoot/Sources/System/Include/System/UUID/UUID.hpp index 21ff3b1..8fbf2da 100644 --- a/Bigfoot/Sources/System/Include/System/UUID/UUID.hpp +++ b/Bigfoot/Sources/System/Include/System/UUID/UUID.hpp @@ -6,6 +6,7 @@ *********************************************************************/ #ifndef BIGFOOT_SYSTEM_UUID_HPP #define BIGFOOT_SYSTEM_UUID_HPP +#include #include @@ -118,6 +119,8 @@ struct std::formatter } }; +/****************************************************************************************/ + #if defined BIGFOOT_NOT_OPTIMIZED #include @@ -141,4 +144,12 @@ struct quill::Codec: quill::DeferredFormatCodec }; #endif +/****************************************************************************************/ + +namespace flatbuffers +{ +Bigfoot::Flat::UUID Pack(const Bigfoot::UUID& p_uuid); +Bigfoot::UUID UnPack(const Bigfoot::Flat::UUID& p_flatUUID); +} // namespace flatbuffers + #endif diff --git a/Bigfoot/Sources/System/Include/System/UUID/UUID_generated.hpp b/Bigfoot/Sources/System/Include/System/UUID/UUID_generated.hpp index f02e7fa..84b21fc 100644 --- a/Bigfoot/Sources/System/Include/System/UUID/UUID_generated.hpp +++ b/Bigfoot/Sources/System/Include/System/UUID/UUID_generated.hpp @@ -13,8 +13,6 @@ static_assert(FLATBUFFERS_VERSION_MAJOR == 25 && FLATBUFFERS_VERSION_REVISION == 19, "Non-compatible flatbuffers version included"); -#include "System/UUID/FlatUUID.hpp" - #include "EASTL/unique_ptr.h" #include "EASTL/string.h" diff --git a/Bigfoot/Sources/System/Time/Time.cpp b/Bigfoot/Sources/System/Time/Time.cpp index e71141c..c782ebc 100644 --- a/Bigfoot/Sources/System/Time/Time.cpp +++ b/Bigfoot/Sources/System/Time/Time.cpp @@ -119,3 +119,20 @@ Time Time::Now() return Time {epochInMicroSeconds}; } } // namespace Bigfoot + +/****************************************************************************************/ + +namespace flatbuffers +{ +Bigfoot::Flat::Time Pack(const Bigfoot::Time& p_time) +{ + return Bigfoot::Flat::Time {p_time.Epoch()}; +} + +/****************************************************************************************/ + +Bigfoot::Time UnPack(const Bigfoot::Flat::Time& p_flatTime) +{ + return Bigfoot::Time {p_flatTime.epoch()}; +} +} // namespace flatbuffers diff --git a/Bigfoot/Sources/System/UUID/FlatUUID.cpp b/Bigfoot/Sources/System/UUID/FlatUUID.cpp deleted file mode 100644 index 78bfeb9..0000000 --- a/Bigfoot/Sources/System/UUID/FlatUUID.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/********************************************************************* - * \file FlatUUID.cpp - * - * \author Romain BOULLARD - * \date December 2025 - *********************************************************************/ -#include - -namespace flatbuffers -{ -Bigfoot::Flat::UUID Pack(const Bigfoot::UUID& p_uuid) -{ - const std::span bytes = p_uuid; - return Bigfoot::Flat::UUID { - std::span {reinterpret_cast(bytes.data()), - bytes.size()}}; -} - -/****************************************************************************************/ - -Bigfoot::UUID UnPack(const Bigfoot::Flat::UUID& p_flatUUID) -{ - const std::span bytesView {p_flatUUID.bytes()->data(), - p_flatUUID.bytes()->size()}; - return Bigfoot::UUID {std::as_bytes(bytesView)}; -} -} // namespace flatbuffers diff --git a/Bigfoot/Sources/System/UUID/UUID.cpp b/Bigfoot/Sources/System/UUID/UUID.cpp index cd87cb6..4e3ad2d 100644 --- a/Bigfoot/Sources/System/UUID/UUID.cpp +++ b/Bigfoot/Sources/System/UUID/UUID.cpp @@ -85,3 +85,25 @@ uuids::uuid_random_generator UUID::GetUUIDGenerator() return uuids::uuid_random_generator {ms_randomGenerator}; } } // namespace Bigfoot + +/****************************************************************************************/ + +namespace flatbuffers +{ +Bigfoot::Flat::UUID Pack(const Bigfoot::UUID& p_uuid) +{ + const std::span bytes = p_uuid; + return Bigfoot::Flat::UUID { + std::span {reinterpret_cast(bytes.data()), + bytes.size()}}; +} + +/****************************************************************************************/ + +Bigfoot::UUID UnPack(const Bigfoot::Flat::UUID& p_flatUUID) +{ + const std::span bytesView {p_flatUUID.bytes()->data(), + p_flatUUID.bytes()->size()}; + return Bigfoot::UUID {std::as_bytes(bytesView)}; +} +} // namespace flatbuffers diff --git a/Bigfoot/Tests/Engine/BigFile/BigFile.cpp b/Bigfoot/Tests/Engine/BigFile/BigFile.cpp index be49e50..6f661c4 100644 --- a/Bigfoot/Tests/Engine/BigFile/BigFile.cpp +++ b/Bigfoot/Tests/Engine/BigFile/BigFile.cpp @@ -14,6 +14,7 @@ #include #include +#include #include diff --git a/Bigfoot/Tests/Engine/Include/EngineTests/BigFile/Asset/AssetA_generated.hpp b/Bigfoot/Tests/Engine/Include/EngineTests/BigFile/Asset/AssetA_generated.hpp index 93a0e72..e3b11b2 100644 --- a/Bigfoot/Tests/Engine/Include/EngineTests/BigFile/Asset/AssetA_generated.hpp +++ b/Bigfoot/Tests/Engine/Include/EngineTests/BigFile/Asset/AssetA_generated.hpp @@ -13,8 +13,9 @@ static_assert(FLATBUFFERS_VERSION_MAJOR == 25 && FLATBUFFERS_VERSION_REVISION == 19, "Non-compatible flatbuffers version included"); -#include "System/UUID/FlatUUID.hpp" -#include "System/Time/FlatTime.hpp" +#include "Engine/BigFile/Asset/AssetTypeID.hpp" +#include "Engine/BigFile/Asset/AssetTypeID.hpp" +#include "System/UUID/UUID.hpp" #include "Engine/BigFile/Asset/AssetHeader_generated.hpp" #include "EASTL/unique_ptr.h"