SAGA C++ API 1.6
saga::filesystem::file Class Reference

The SAGA file package file API. More...

#include <file.hpp>

Inheritance diagram for saga::filesystem::file:

List of all members.

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.
fileoperator= (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.

Detailed Description

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.


Constructor & Destructor Documentation

saga::filesystem::file::file ( session const &  s,
saga::url  url,
int  mode = Read 
)

Creates the object.

Definition at line 34 of file file.cpp.

saga::filesystem::file::file ( saga::url  url,
int  mode = Read 
) [explicit]

Creates the object.

Definition at line 46 of file file.cpp.

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().

saga::filesystem::file::file ( void  )

Creates the object.

Definition at line 61 of file file.cpp.

saga::filesystem::file::~file ( void  )

Destroys the object.

Definition at line 65 of file file.cpp.


Member Function Documentation

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.

Definition at line 178 of file file.hpp.

static file saga::filesystem::file::create ( saga::url  url,
int  mode = Read 
) [inline, static]

Factory function resembling file(url, int) constructor.

Reimplemented from saga::name_space::entry.

Definition at line 186 of file file.hpp.

template<typename Tag >
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.

Definition at line 191 of file file.hpp.

file & saga::filesystem::file::operator= ( saga::object const &  o)

Brief description starts here.

Reimplemented from saga::name_space::entry.

Definition at line 69 of file file.cpp.

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.

Parameters:
lengthNumber of bytes to be read
bufferBuffer to read into
Returns:
Number of bytes successfully read

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.

Parameters:
lengthNumber of bytes to write
bufferData to write
Returns:
Number of bytes successfully written

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.

Parameters:
offsetOffset in bytes to move pointer
modeOffset is relative to mode
Returns:
position of pointer after seek

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.

Parameters:
buffer_vecArray 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.

Parameters:
buffer_vecArray 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.

Parameters:
patternPattern to determine size for
Returns:
Size required for I/O operation with that pattern

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.

Parameters:
patternPattern specification for read operation
bufferBuffer to store read bytes into
Returns:
Number of successfully read bytes

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.

Parameters:
patternPattern specification for read operation
bufferBuffer to store read bytes into
Returns:
number of bytes successfully written

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.

Parameters:
retPattern to determine size for
Returns:
Size required for I/O operation with that pattern

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.

Parameters:
ext_modeExtended mode to use
specificationSpecification of read operation
bufferBuffer to store read bytes into
Returns:
Number of successfully read bytes

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.

Parameters:
ext_modeExtended mode to use
specificationSpecification of write operation
bufferBuffer to store read bytes into
Returns:
Number of successfully read bytes

Definition at line 392 of file file.hpp.

References saga::task::get_result().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines