mirror of
https://github.com/JorjBauer/aiie.git
synced 2025-04-10 10:37:36 +00:00
add flush method
This commit is contained in:
parent
b2e36b4dfe
commit
da8910cdaf
@ -141,7 +141,9 @@ class FileManager {
|
||||
virtual int write(int8_t fd, const void *buf, int nbyte) = 0;
|
||||
virtual int read(int8_t fd, void *buf, int nbyte) = 0;
|
||||
virtual int lseek(int8_t fd, int offset, int whence) = 0;
|
||||
|
||||
|
||||
virtual void flush() = 0;
|
||||
|
||||
protected:
|
||||
volatile unsigned long fileSeekPositions[MAXFILES];
|
||||
char cachedNames[MAXFILES][MAXPATH];
|
||||
|
@ -290,3 +290,8 @@ int NixFileManager::lseek(int8_t fd, int offset, int whence)
|
||||
exit(1); // this is an error condition we need to find and fix if it happens
|
||||
return -1;
|
||||
};
|
||||
|
||||
void NixFileManager::flush()
|
||||
{
|
||||
// No files are kept open, so there's nothing to flush
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ class NixFileManager : public FileManager {
|
||||
virtual int read(int8_t fd, void *buf, int nbyte);
|
||||
virtual int lseek(int8_t fd, int offset, int whence);
|
||||
|
||||
virtual void flush();
|
||||
private:
|
||||
int8_t numCached;
|
||||
|
||||
|
@ -300,3 +300,12 @@ int TeensyFileManager::lseek(int8_t fd, int offset, int whence)
|
||||
return -1;
|
||||
};
|
||||
|
||||
void TeensyFileManager::flush()
|
||||
{
|
||||
if (cacheFd == -1)
|
||||
return;
|
||||
|
||||
cacheFile.close();
|
||||
cacheFd = -1;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,9 @@ class TeensyFileManager : public FileManager {
|
||||
virtual int write(int8_t fd, const void *buf, int nbyte);
|
||||
virtual int read(int8_t fd, void *buf, int nbyte);
|
||||
virtual int lseek(int8_t fd, int offset, int whence);
|
||||
|
||||
|
||||
virtual void flush();
|
||||
|
||||
private:
|
||||
bool _prepCache(int8_t fd);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user