Interface EmuFileContents<T>
- Type Parameters:
T
- the type of values in the file
- All Known Implementing Classes:
BytesEmuFileContents
,PairedEmuFileContents
TODO: Could/should this just be the same interface as an execute state? If so, we'd need to formalize the store interface and require one for each address space in the state. Sharing that interface may not be a good idea.... I think implementors can use a common realization if that suits them.
TODO: Actually, a better idea might be to introduce an address factory with custom spaces into the emulator. Then a library/file could just create an address space and use the state to store and retrieve the file contents. Better yet, when written down, those contents and markings could appear in the user's trace.
-
Method Summary
-
Method Details
-
read
Copy values from the file into the given buffer- Parameters:
offset
- the offset in the file to readbuf
- the destination buffer, whose size must be knownfileSize
- the size of the file- Returns:
- the number of bytes (not necessarily concrete) read
-
write
Write values from the given buffer into the file- Parameters:
offset
- the offset in the file to writebuf
- the source buffer, whose size must be knowncurSize
- the current size of the file- Returns:
- the number of bytes (not necessarily concrete) written
-
truncate
void truncate()Erase the contentsNote that the file's size will be set to 0, so actual erasure of the contents may not be necessary, but if the contents are expensive to store, they ought to be disposed.
-