CatapultServer  v0.5.0.1 (Elephant)
catapult::io::RawFile Class Referencefinal

Wrapper for low-level i/o operations on files. More...

Inheritance diagram for catapult::io::RawFile:
Collaboration diagram for catapult::io::RawFile:

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...
 
RawFileoperator= (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...
 
MoveOnlyoperator= (const MoveOnly &)=delete
 Disabled assignment operator. More...
 
MoveOnlyoperator= (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
 

Detailed Description

Wrapper for low-level i/o operations on files.

Constructor & Destructor Documentation

◆ RawFile() [1/2]

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.

◆ RawFile() [2/2]

catapult::io::RawFile::RawFile ( RawFile &&  rhs)
default

Move construct a raw file from rhs.

Member Function Documentation

◆ operator=()

RawFile& catapult::io::RawFile::operator= ( RawFile &&  rhs)
delete

Disallow move-assign.

◆ position()

uint64_t catapult::io::RawFile::position ( ) const

Returns position in the file.

Here is the caller graph for this function:

◆ read()

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.

Here is the caller graph for this function:

◆ seek()

void catapult::io::RawFile::seek ( uint64_t  position)

Seeks to given absolute position. Throws catapult_file_io_error exception if seek has failed.

◆ size()

uint64_t catapult::io::RawFile::size ( ) const

Returns size of the file.

Here is the caller graph for this function:

◆ write()

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.

Here is the caller graph for this function:

Member Data Documentation

◆ m_fd

FileDescriptorHolder catapult::io::RawFile::m_fd
private

◆ m_fileSize

uint64_t catapult::io::RawFile::m_fileSize
private

◆ m_pathname

const std::string catapult::io::RawFile::m_pathname
private

◆ m_position

uint64_t catapult::io::RawFile::m_position
private

The documentation for this class was generated from the following files: