/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/Foundation/IO/DependencyFile.h
67 строк
3 KB
Sanakan8472
Shader Compiler Multi-Treading Support and Renderer Fixes (#1606)
12 июл 2025, 11:27
Не верифицирован
12 июл 2025, 11:27
260ca74
Код
Авторство
О чём код?
#pragma once #include <Foundation/Basics.h> #include <Foundation/Containers/HybridArray.h> #include <Foundation/Containers/Map.h> #include <Foundation/IO/Stream.h> #include <Foundation/Time/Timestamp.h> /// \brief This class represents a set of files of which one wants to know when any one of them changes. /// /// ezDependencyFile stores a list of files that are the 'dependency set'. It can be serialized. /// Through HasAnyFileChanged() one can detect whether any of the files has changed, since the last call to StoreCurrentTimeStamp(). /// The time stamp that is retrieved through StoreCurrentTimeStamp() will also be serialized. class EZ_FOUNDATION_DLL ezDependencyFile { public: ezDependencyFile(); /// \brief Clears all files that were added with AddFileDependency() void Clear(); /// \brief Adds one file as a dependency to the list void AddFileDependency(ezStringView sFile); /// \brief Allows read access to all currently stored file dependencies const ezHybridArray<ezString, 16>& GetFileDependencies() const { return m_AssetTransformDependencies; } /// \brief Writes the current state to a stream. Note that you probably should call StoreCurrentTimeStamp() before this, to serialize the latest /// file stamp ezResult WriteDependencyFile(ezStreamWriter& inout_stream) const; /// \brief Reads the state from a stream. Call HasAnyFileChanged() afterwards to determine whether anything has changed since when the data was /// serialized. ezResult ReadDependencyFile(ezStreamReader& inout_stream); /// \brief Writes the current state to a file. Note that you probably should call StoreCurrentTimeStamp() before this, to serialize the latest file /// stamp ezResult WriteDependencyFile(ezStringView sFile) const; /// \brief Reads the state from a file. Call HasAnyFileChanged() afterwards to determine whether anything has changed since when the data was /// serialized. ezResult ReadDependencyFile(ezStringView sFile); /// \brief Retrieves the current file time stamps from the filesystem and determines whether any file has changed since the last call to /// StoreCurrentTimeStamp() (or ReadDependencyFile()) bool HasAnyFileChanged() const; /// \brief Retrieves the current file time stamps from the filesystem and stores it for later comparison. This value is also serialized through /// WriteDependencyFile(), so it should be called before that, to store the latest state. void StoreCurrentTimeStamp(); private: static ezResult RetrieveFileTimeStamp(ezStringView sFile, ezTimestamp& out_Result); ezHybridArray<ezString, 16> m_AssetTransformDependencies; ezInt64 m_iMaxTimeStampStored = 0; ezUInt64 m_uiSumTimeStampStored = 0; struct FileCheckCache { ezTimestamp m_FileTimestamp; ezTime m_LastCheck; }; static ezMutex s_FileTimestampsLock; static ezMap<ezString, FileCheckCache> s_FileTimestamps; };