distortos
v0.7.0
object-oriented C++ RTOS for microcontrollers
|
#include "distortos/FileSystem/File.hpp"
Public Types | |
enum | Whence { Whence::beginning, Whence::current, Whence::end } |
seek() mode of operation More... | |
Public Member Functions | |
virtual | ~File ()=default |
File's destructor. More... | |
virtual int | close ()=0 |
Closes file. More... | |
virtual std::pair< int, off_t > | getPosition ()=0 |
Returns current file offset. More... | |
virtual std::pair< int, off_t > | getSize ()=0 |
Returns size of file. More... | |
virtual int | getStatus (struct stat &status)=0 |
Returns status of file. More... | |
virtual std::pair< int, bool > | isATerminal ()=0 |
Tells whether the file is a terminal. More... | |
virtual void | lock ()=0 |
Locks the file for exclusive use by current thread. More... | |
virtual std::pair< int, size_t > | read (void *buffer, size_t size)=0 |
Reads data from file. More... | |
virtual int | rewind ()=0 |
Resets current file offset. More... | |
virtual std::pair< int, off_t > | seek (Whence whence, off_t offset)=0 |
Moves file offset. More... | |
virtual int | synchronize ()=0 |
Synchronizes state of a file, ensuring all cached writes are finished. More... | |
virtual void | unlock ()=0 |
Unlocks the file which was previously locked by current thread. More... | |
virtual std::pair< int, size_t > | write (const void *buffer, size_t size)=0 |
Writes data to file. More... | |
File (const File &)=delete | |
File & | operator= (const File &)=delete |
File class is an interface for a file.
|
strong |
seek() mode of operation
|
virtualdefault |
File's destructor.
|
pure virtual |
Closes file.
Similar to close()
Implemented in distortos::Littlefs1File.
|
pure virtual |
Returns current file offset.
Similar to ftello()
Implemented in distortos::Littlefs1File.
|
pure virtual |
Returns size of file.
Implemented in distortos::Littlefs1File.
|
pure virtual |
Returns status of file.
Similar to fstat()
[out] | status | is a reference to stat struct into which status of file will be written |
Implemented in distortos::Littlefs1File.
|
pure virtual |
Tells whether the file is a terminal.
Similar to isatty()
Implemented in distortos::Littlefs1File.
|
pure virtual |
Locks the file for exclusive use by current thread.
When the object is locked, any call to any member function from other thread will be blocked until the object is unlocked. Locking is optional, but may be useful when more than one operation must be done atomically.
Implemented in distortos::Littlefs1File.
|
pure virtual |
Reads data from file.
Similar to read()
[out] | buffer | is the buffer into which the data will be read, must be valid |
[in] | size | is the size of buffer, bytes |
Implemented in distortos::Littlefs1File.
|
pure virtual |
Resets current file offset.
Similar to rewind()
Implemented in distortos::Littlefs1File.
|
pure virtual |
Moves file offset.
Similar to lseek()
[in] | whence | selects the mode of operation: Whence::beginning will set file offset to offset, Whence::current will set file offset to its current value plus offset, Whence::end will set file offset to the size of the file plus offset |
[in] | offset | is the value of offset, bytes |
Implemented in distortos::Littlefs1File.
|
pure virtual |
Synchronizes state of a file, ensuring all cached writes are finished.
Similar to fsync()
Implemented in distortos::Littlefs1File.
|
pure virtual |
Unlocks the file which was previously locked by current thread.
Implemented in distortos::Littlefs1File.
|
pure virtual |
Writes data to file.
Similar to write()
[in] | buffer | is the buffer with data that will be written, must be valid |
[in] | size | is the size of buffer, bytes |
Implemented in distortos::Littlefs1File.