libassetmap  1.0.0
Hash-table based archive format containing compressed data
DirectoryMetadata.h
Go to the documentation of this file.
1 #ifndef LIBASSETMAP_DIRECTORYMETADATA_H
2 #define LIBASSETMAP_DIRECTORYMETADATA_H
3 
4 #include "ICompress.h"
5 #include "IHasher.h"
6 
7 #include <cstdint>
8 #include <cstdlib>
9 #include <filesystem>
10 #include <vector>
11 
12 // clang-format off
16 
63 // clang-format on
64 
65 namespace AssetMap {
67  std::vector<std::vector<std::filesystem::directory_entry>> buckets;
68  size_t totalCompressBound = 0;
69  size_t totalNumFiles = 0;
70  size_t totalFileNameSize = 0;
71  size_t totalAlignmentPadding = 0;
72  size_t dictionarySize = 0;
73 
74  public:
83  explicit DirectoryMetadata(const IHasher& hasher,
84  ICompress& comp,
85  const std::filesystem::directory_entry& ent);
86 
90  [[nodiscard]] size_t TotalRequiredSpace() const noexcept;
91 
94  [[nodiscard]] ptrdiff_t DataStart() const noexcept;
95 
104  [[nodiscard]] const decltype(buckets)& Buckets() const noexcept;
105  };
106 } // namespace AssetMap
107 
108 #endif // LIBASSETMAP_DIRECTORYMETADATA_H
AssetMap::DirectoryMetadata
Definition: DirectoryMetadata.h:66
AssetMap::ICompress
Definition: ICompress.h:10
AssetMap::DirectoryMetadata::TotalRequiredSpace
size_t TotalRequiredSpace() const noexcept
Obtain the worst-case required space to compress the directory passed to the constructor for the give...
AssetMap::DirectoryMetadata::Buckets
decltype(buckets) const & Buckets() const noexcept
Obtain a list of buckets and their entries.
AssetMap::DirectoryMetadata::DataStart
ptrdiff_t DataStart() const noexcept
Obtain the offset for the beginning of data entries.
AssetMap::DirectoryMetadata::DirectoryMetadata
DirectoryMetadata(const IHasher &hasher, ICompress &comp, const std::filesystem::directory_entry &ent)
Construct an instance of DirectoryMetadata.
AssetMap
Definition: DirectoryMetadata.h:65
AssetMap::IHasher
Definition: IHasher.h:8