#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 map(size_t size) = 0; }; }