#include <sc_store.h>

Public Member Functions

bool IsValid () const
 
 MemoryDeviceFile ()
 
 MemoryDeviceFile (MemoryDeviceFile &&source)=default
 
MemoryDeviceFileoperator= (MemoryDeviceFile &&source)=default
 
size_t Read (uint8_t *buffer, size_t num_bytes)
 
void SeekToBeginning ()
 
size_t Size () const
 
 ~MemoryDeviceFile ()
 

Detailed Description

The MemoryDevice class is an in-memory virtual file used for sandboxing file IO. These objects can be obtained from a MemoryDevice object by calling MemoryDevice::OpenFileForReading.

Constructor & Destructor Documentation

◆ MemoryDeviceFile() [1/2]

SC::Store::MemoryDeviceFile::MemoryDeviceFile ( )

Creates an invalid memory device file.

◆ ~MemoryDeviceFile()

SC::Store::MemoryDeviceFile::~MemoryDeviceFile ( )

◆ MemoryDeviceFile() [2/2]

SC::Store::MemoryDeviceFile::MemoryDeviceFile ( MemoryDeviceFile &&  source)
default

Move construction. The source file will become invalid.

Member Function Documentation

◆ IsValid()

bool SC::Store::MemoryDeviceFile::IsValid ( ) const

Determines if this is a valid file object.

Returns
true if the file is valid, or false if it not. A moved-from file object will be invalid.

◆ operator=()

MemoryDeviceFile& SC::Store::MemoryDeviceFile::operator= ( MemoryDeviceFile &&  source)
default

Move assignment. The source file will become invalid.

◆ Read()

size_t SC::Store::MemoryDeviceFile::Read ( uint8_t *  buffer,
size_t  num_bytes 
)

Read bytes from the file

Returns
The number of bytes read.

◆ SeekToBeginning()

void SC::Store::MemoryDeviceFile::SeekToBeginning ( )

Resets the file such that the next Read operation will start at the beginning.

◆ Size()

size_t SC::Store::MemoryDeviceFile::Size ( ) const

Query the size of the file.

Returns
The size, in bytes, of the given file.