Plasma Engine  2.0
Loading...
Searching...
No Matches
DependencyFile.h
1#pragma once
2
3#include <Foundation/Basics.h>
4#include <Foundation/Containers/HybridArray.h>
5#include <Foundation/Containers/Map.h>
6#include <Foundation/IO/Stream.h>
7#include <Foundation/Time/Timestamp.h>
8
14class PL_FOUNDATION_DLL plDependencyFile
15{
16public:
18
20 void Clear();
21
23 void AddFileDependency(plStringView sFile);
24
26 const plHybridArray<plString, 16>& GetFileDependencies() const { return m_AssetTransformDependencies; }
27
30 plResult WriteDependencyFile(plStreamWriter& inout_stream) const;
31
34 plResult ReadDependencyFile(plStreamReader& inout_stream);
35
38 plResult WriteDependencyFile(plStringView sFile) const;
39
42 plResult ReadDependencyFile(plStringView sFile);
43
46 bool HasAnyFileChanged() const;
47
50 void StoreCurrentTimeStamp();
51
52private:
53 static plResult RetrieveFileTimeStamp(plStringView sFile, plTimestamp& out_Result);
54
55 plHybridArray<plString, 16> m_AssetTransformDependencies;
56 plInt64 m_iMaxTimeStampStored = 0;
57 plUInt64 m_uiSumTimeStampStored = 0;
58
59 struct FileCheckCache
60 {
61 plTimestamp m_FileTimestamp;
62 plTime m_LastCheck;
63 };
64
65 static plMap<plString, FileCheckCache> s_FileTimestamps;
66};
This class represents a set of files of which one wants to know when any one of them changes.
Definition DependencyFile.h:15
const plHybridArray< plString, 16 > & GetFileDependencies() const
Allows read access to all currently stored file dependencies.
Definition DependencyFile.h:26
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
Definition Map.h:408
Interface for binary in (read) streams.
Definition Stream.h:22
Interface for binary out (write) streams.
Definition Stream.h:107
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
The timestamp class encapsulates a date in time as microseconds since Unix epoch.
Definition Timestamp.h:23
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12