The SAGA file package file API. More...
#include <file.hpp>
Public Member Functions | |
file (session const &s, saga::url url, int mode=Read) | |
Creates the object. | |
file (saga::url url, int mode=Read) | |
Creates the object. | |
file (saga::object const &o) | |
Creates the object. | |
file (void) | |
Creates the object. | |
~file (void) | |
Destroys the object. | |
file & | operator= (saga::object const &o) |
Brief description starts here. | |
saga::off_t | get_size (void) |
Returns the number of bytes in the file. | |
saga::ssize_t | read (saga::mutable_buffer buffer, saga::ssize_t length=0) |
Reads up to length bytes from the file into the buffer. | |
saga::ssize_t | write (saga::const_buffer buffer, saga::ssize_t length=0) |
Writes up to length bytes from buffer into the file at the current file position. | |
saga::off_t | seek (saga::off_t offset, seek_mode mode) |
Reposition the file pointer. | |
void | read_v (std::vector< saga::filesystem::iovec > buffer_vec) |
Gather/scatter read. | |
void | write_v (std::vector< saga::filesystem::const_iovec > buffer_vec) |
Gather/scatter write. | |
saga::ssize_t | size_p (std::string pattern) |
Determine the storage size required for a pattern I/O operation. | |
saga::ssize_t | read_p (std::string pattern, saga::mutable_buffer buffer) |
Pattern-based read. | |
saga::ssize_t | write_p (std::string pattern, saga::const_buffer buffer) |
Pattern-based write. | |
std::vector< std::string > | modes_e () |
List the extended modes available in this implementation, and/or on server side. | |
saga::size_t | size_e (std::string ext_mode, std::string specification) |
determine the storage size required for an extended I/O operation | |
saga::ssize_t | read_e (std::string ext_mode, std::string specification, saga::mutable_buffer buffer) |
Extended read. | |
saga::ssize_t | write_e (std::string ext_mode, std::string specification, saga::const_buffer buffer) |
Extended write. | |
Static Public Member Functions | |
static file | create (session const &s, saga::url url, int mode=Read) |
Factory function resembling file(session, url, int) constructor. | |
static file | create (saga::url url, int mode=Read) |
Factory function resembling file(url, int) constructor. | |
template<typename Tag > | |
static saga::task | create (saga::url url, int mode=Read) |
Factory function resembling entry(url, int) constructor. |
The SAGA file package file API.
This class represents an open file descriptor for read/write operations on a physical file. Its concept is similar to the file descriptor returned by the open (2) call in POSIX.
Example:
Definition at line 103 of file file.hpp.
saga::filesystem::file::file | ( | saga::url | url, | |
int | mode = Read | |||
) | [explicit] |
saga::filesystem::file::file | ( | saga::object const & | o | ) | [explicit] |
Creates the object.
Definition at line 52 of file file.cpp.
References saga::BadParameter, saga::object::File, and saga::object::get_type().
static file saga::filesystem::file::create | ( | session const & | s, | |
saga::url | url, | |||
int | mode = Read | |||
) | [inline, static] |
Factory function resembling file(session, url, int) constructor.
Reimplemented from saga::name_space::entry.
Factory function resembling file(url, int) constructor.
Reimplemented from saga::name_space::entry.
static saga::task saga::filesystem::file::create | ( | saga::url | url, | |
int | mode = Read | |||
) | [inline, static] |
Factory function resembling entry(url, int) constructor.
Reimplemented from saga::name_space::entry.
file & saga::filesystem::file::operator= | ( | saga::object const & | o | ) |
Brief description starts here.
Reimplemented from saga::name_space::entry.
saga::off_t saga::filesystem::file::get_size | ( | void | ) | [inline] |
Returns the number of bytes in the file.
Definition at line 206 of file file.hpp.
References saga::task::get_result().
saga::ssize_t saga::filesystem::file::read | ( | saga::mutable_buffer | buffer, | |
saga::ssize_t | length = 0 | |||
) | [inline] |
Reads up to length bytes from the file into the buffer.
length | Number of bytes to be read | |
buffer | Buffer to read into |
Definition at line 222 of file file.hpp.
References saga::task::get_result().
saga::ssize_t saga::filesystem::file::write | ( | saga::const_buffer | buffer, | |
saga::ssize_t | length = 0 | |||
) | [inline] |
Writes up to length bytes from buffer into the file at the current file position.
length | Number of bytes to write | |
buffer | Data to write |
Definition at line 239 of file file.hpp.
References saga::task::get_result().
saga::off_t saga::filesystem::file::seek | ( | saga::off_t | offset, | |
seek_mode | mode | |||
) | [inline] |
Reposition the file pointer.
offset | Offset in bytes to move pointer | |
mode | Offset is relative to mode |
Definition at line 255 of file file.hpp.
References saga::task::get_result().
void saga::filesystem::file::read_v | ( | std::vector< saga::filesystem::iovec > | buffer_vec | ) | [inline] |
Gather/scatter read.
buffer_vec | Array of buffer_vec structs defining start (offset) and length (length) of each individual read, buffer to read into, and integer to store result into. |
Definition at line 271 of file file.hpp.
References saga::task::get_result().
void saga::filesystem::file::write_v | ( | std::vector< saga::filesystem::const_iovec > | buffer_vec | ) | [inline] |
Gather/scatter write.
buffer_vec | Array of buffer_vec structs defining start (offset) and length (length) of each individual write, and buffers containing the data to write |
Definition at line 286 of file file.hpp.
References saga::task::get_result().
saga::ssize_t saga::filesystem::file::size_p | ( | std::string | pattern | ) | [inline] |
Determine the storage size required for a pattern I/O operation.
pattern | Pattern to determine size for |
Definition at line 299 of file file.hpp.
References saga::task::get_result().
saga::ssize_t saga::filesystem::file::read_p | ( | std::string | pattern, | |
saga::mutable_buffer | buffer | |||
) | [inline] |
Pattern-based read.
pattern | Pattern specification for read operation | |
buffer | Buffer to store read bytes into |
Definition at line 314 of file file.hpp.
References saga::task::get_result().
saga::ssize_t saga::filesystem::file::write_p | ( | std::string | pattern, | |
saga::const_buffer | buffer | |||
) | [inline] |
Pattern-based write.
pattern | Pattern specification for read operation | |
buffer | Buffer to store read bytes into |
Definition at line 329 of file file.hpp.
References saga::task::get_result().
std::vector<std::string> saga::filesystem::file::modes_e | ( | ) | [inline] |
List the extended modes available in this implementation, and/or on server side.
ret | Pattern to determine size for |
Definition at line 344 of file file.hpp.
References saga::task::get_result().
saga::size_t saga::filesystem::file::size_e | ( | std::string | ext_mode, | |
std::string | specification | |||
) | [inline] |
determine the storage size required for an extended I/O operation
Definition at line 356 of file file.hpp.
References saga::task::get_result().
saga::ssize_t saga::filesystem::file::read_e | ( | std::string | ext_mode, | |
std::string | specification, | |||
saga::mutable_buffer | buffer | |||
) | [inline] |
Extended read.
ext_mode | Extended mode to use | |
specification | Specification of read operation | |
buffer | Buffer to store read bytes into |
Definition at line 371 of file file.hpp.
References saga::task::get_result().
saga::ssize_t saga::filesystem::file::write_e | ( | std::string | ext_mode, | |
std::string | specification, | |||
saga::const_buffer | buffer | |||
) | [inline] |
Extended write.
ext_mode | Extended mode to use | |
specification | Specification of write operation | |
buffer | Buffer to store read bytes into |
Definition at line 392 of file file.hpp.
References saga::task::get_result().