This commit is contained in:
jeanlemotan
2024-07-02 18:12:23 +02:00
commit b344afa9fe
89 changed files with 10568 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#pragma once
#include "ISink.h"
#include "fs/Api.h"
namespace fs
{
//Design rationale:
// Sinks are throw-away objects representing a data source or sink (the Sink).
// They are not supposed to be reused.
// There is only one owner of the sink, enforced by the tl::unique_ref wrapper. Due to this, sinks are NOT thread safe.
// There is no open/close for sinks as the open is done in the constructor and close in the destructor. This is to reinforce the idea of throw-away objects.
// If you need a persistent sink to be able to reload your data, hold a
// path to the sink instead of the sink. This is to allow the underlying file system to change (due to DLC for example). When you need the sink again, request a new one from the file system.
class FS_API IMapSink : public ISink
{
public:
IMapSink() = default;
~IMapSink() override = default;
IMapSink(IMapSink&&) = default;
IMapSink& operator=(IMapSink&&) = default;
//this maps the sink from the current pointer and size bytes. the pointer is advanced with size bytes
virtual tl::span<uint8_t> map(size_t size) = 0;
};
}