First
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "ISource.h"
|
||||
#include "fs/Api.h"
|
||||
#include "tl/span.h"
|
||||
|
||||
namespace fs
|
||||
{
|
||||
|
||||
//Design rationale:
|
||||
// Sources 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 source, enforced by the tl::unique_ref wrapper. Due to this, sources are NOT thread safe.
|
||||
// There is no open/close for sources 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 source to be able to reload your data, hold a
|
||||
// path to the source instead of the source. This is to allow the underlying file system to change (due to DLC for example). When you need the source again, request a new one from the file system.
|
||||
|
||||
class FS_API IMapSource : public ISource
|
||||
{
|
||||
public:
|
||||
IMapSource() = default;
|
||||
~IMapSource() override = default;
|
||||
|
||||
IMapSource(IMapSource&&) = default;
|
||||
IMapSource& operator=(IMapSource&&) = default;
|
||||
|
||||
//this maps the source from the current pointer and size bytes. the pointer is advanced with size bytes
|
||||
virtual tl::span<const uint8_t> map(size_t size) = 0;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user