CatapultServer
v0.5.0.1 (Elephant)
|
Wrapper for low-level i/o operations on files. More...
Classes | |
class | FileDescriptorHolder |
Public Member Functions | |
RawFile (const std::string &pathname, OpenMode mode, LockMode lockMode=LockMode::File) | |
RawFile (RawFile &&rhs)=default | |
Move construct a raw file from rhs. More... | |
RawFile & | operator= (RawFile &&rhs)=delete |
Disallow move-assign. More... | |
void | write (const RawBuffer &dataBuffer) |
void | seek (uint64_t position) |
void | read (const MutableRawBuffer &dataBuffer) |
uint64_t | size () const |
Returns size of the file. More... | |
uint64_t | position () const |
Returns position in the file. More... | |
Public Member Functions inherited from catapult::utils::MoveOnly | |
constexpr | MoveOnly ()=default |
Default constructor. More... | |
~MoveOnly ()=default | |
Default destructor. More... | |
MoveOnly (const NonCopyable &)=delete | |
Disabled copy constructor. More... | |
MoveOnly (MoveOnly &&)=default | |
Default move constructor. More... | |
MoveOnly & | operator= (const MoveOnly &)=delete |
Disabled assignment operator. More... | |
MoveOnly & | operator= (MoveOnly &&)=default |
Default move assignment operator. More... | |
Private Attributes | |
const std::string | m_pathname |
FileDescriptorHolder | m_fd |
uint64_t | m_fileSize |
uint64_t | m_position |
Wrapper for low-level i/o operations on files.
catapult::io::RawFile::RawFile | ( | const std::string & | pathname, |
OpenMode | mode, | ||
LockMode | lockMode = LockMode::File |
||
) |
Opens file pointed to by pathname either for reading or both for reading and writing as specified by mode. Optionally file locking can be disabled via lockMode.
|
default |
Move construct a raw file from rhs.
uint64_t catapult::io::RawFile::position | ( | ) | const |
Returns position in the file.
void catapult::io::RawFile::read | ( | const MutableRawBuffer & | dataBuffer | ) |
Reads data from the file into dataBuffer Throws catapult_file_io_error exception if requested amount of data could not be read.
void catapult::io::RawFile::seek | ( | uint64_t | position | ) |
Seeks to given absolute position. Throws catapult_file_io_error exception if seek has failed.
uint64_t catapult::io::RawFile::size | ( | ) | const |
Returns size of the file.
void catapult::io::RawFile::write | ( | const RawBuffer & | dataBuffer | ) |
Writes data pointed to by dataBuffer to the file. If proper amount of data could not be written catapult_file_io_error exception will be thrown.
|
private |
|
private |
|
private |
|
private |