GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
octave::stream Class Reference

#include "oct-stream.h"

Collaboration diagram for octave::stream:

Public Member Functions

 stream (base_stream *bs=nullptr)
 
 stream (const stream &)
 
 ~stream (void)
 
void clearerr (void)
 
void close (void)
 
bool eof (void) const
 
std::string error (bool clear, int &err_num)
 
std::string error (bool clear=false)
 
void error (const std::string &msg)
 
void error (const char *msg)
 
int file_number (void)
 
mach_info::float_format float_format (void) const
 
int flush (void)
 
std::string getl (octave_idx_type max_len, bool &err, const std::string &who)
 
std::string getl (const octave_value &max_len, bool &err, const std::string &who)
 
std::string gets (octave_idx_type max_len, bool &err, const std::string &who)
 
std::string gets (const octave_value &max_len, bool &err, const std::string &who)
 
std::istream * input_stream (void)
 
bool is_open (void) const
 
bool is_valid (void) const
 
int mode (void) const
 
std::string name (void) const
 
bool ok (void) const
 
 operator bool () const
 
streamoperator= (const stream &)
 
octave_value_list oscanf (const std::string &fmt, const std::string &who)
 
octave_value_list oscanf (const octave_value &fmt, const std::string &who)
 
std::ostream * output_stream (void)
 
int printf (const std::string &fmt, const octave_value_list &args, const std::string &who)
 
int printf (const octave_value &fmt, const octave_value_list &args, const std::string &who)
 
int puts (const std::string &s, const std::string &who)
 
int puts (const octave_value &s, const std::string &who)
 
octave_value read (const Array< double > &size, octave_idx_type block_size, oct_data_conv::data_type input_type, oct_data_conv::data_type output_type, octave_idx_type skip, mach_info::float_format flt_fmt, octave_idx_type &count)
 
int rewind (void)
 
octave_value scanf (const std::string &fmt, const Array< double > &size, octave_idx_type &count, const std::string &who)
 
octave_value scanf (const octave_value &fmt, const Array< double > &size, octave_idx_type &count, const std::string &who)
 
int seek (off_t offset, int origin)
 
int seek (const octave_value &offset, const octave_value &origin)
 
bool skip_bytes (size_t n_elts)
 
off_t skipl (off_t count, bool &err, const std::string &who)
 
off_t skipl (const octave_value &count, bool &err, const std::string &who)
 
off_t tell (void)
 
octave_value textscan (const std::string &fmt, octave_idx_type ntimes, const octave_value_list &options, const std::string &who, octave_idx_type &count)
 
octave_idx_type write (const octave_value &data, octave_idx_type block_size, oct_data_conv::data_type output_type, octave_idx_type skip, mach_info::float_format flt_fmt)
 
template<typename T >
octave_idx_type write (const Array< T > &data, octave_idx_type block_size, oct_data_conv::data_type output_type, octave_idx_type skip, mach_info::float_format flt_fmt)
 
bool write_bytes (const void *data, size_t n_elts)
 

Static Public Member Functions

static std::string mode_as_string (int mode)
 

Private Member Functions

octave_value finalize_read (std::list< void *> &input_buf_list, octave_idx_type input_buf_elts, octave_idx_type elts_read, octave_idx_type nr, octave_idx_type nc, oct_data_conv::data_type input_type, oct_data_conv::data_type output_type, mach_info::float_format ffmt)
 
void invalid_operation (const std::string &who, const char *rw)
 
bool stream_ok (bool clear=true) const
 

Private Attributes

base_streamrep
 

Detailed Description

Definition at line 243 of file oct-stream.h.

Constructor & Destructor Documentation

◆ stream() [1/2]

octave::stream::stream ( base_stream bs = nullptr)

Definition at line 5958 of file oct-stream.cc.

References octave::base_stream::count, and rep.

◆ ~stream()

octave::stream::~stream ( void  )

Definition at line 5965 of file oct-stream.cc.

References octave::base_stream::count, and rep.

◆ stream() [2/2]

octave::stream::stream ( const stream s)

Definition at line 5971 of file oct-stream.cc.

References octave::base_stream::count, and rep.

Member Function Documentation

◆ clearerr()

void octave::stream::clearerr ( void  )
inline

Definition at line 376 of file oct-stream.h.

Referenced by seek().

◆ close()

void octave::stream::close ( void  )

◆ eof()

bool octave::stream::eof ( void  ) const

Definition at line 7194 of file oct-stream.cc.

References octave::base_stream::eof(), rep, retval, and stream_ok().

Referenced by octave_ostrstream::eof(), and octave::read_data().

◆ error() [1/4]

std::string octave::stream::error ( bool  clear,
int &  err_num 
)

◆ error() [2/4]

std::string octave::stream::error ( bool  clear = false)
inline

Definition at line 334 of file oct-stream.h.

References error().

◆ error() [3/4]

void octave::stream::error ( const std::string msg)
inline

Definition at line 342 of file oct-stream.h.

◆ error() [4/4]

void octave::stream::error ( const char *  msg)
inline

Definition at line 348 of file oct-stream.h.

References error(), and string.

Referenced by error().

◆ file_number()

int octave::stream::file_number ( void  )
inline

Definition at line 350 of file oct-stream.h.

Referenced by Fdup2(), and octave::stream_list::insert().

◆ finalize_read()

◆ float_format()

mach_info::float_format octave::stream::float_format ( void  ) const

◆ flush()

int octave::stream::flush ( void  )

◆ getl() [1/2]

std::string octave::stream::getl ( octave_idx_type  max_len,
bool err,
const std::string who 
)

Definition at line 6007 of file oct-stream.cc.

References err, octave::base_stream::getl(), rep, retval, stream_ok(), and string.

Referenced by getl().

◆ getl() [2/2]

std::string octave::stream::getl ( const octave_value max_len,
bool err,
const std::string who 
)

◆ gets() [1/2]

std::string octave::stream::gets ( octave_idx_type  max_len,
bool err,
const std::string who 
)

Definition at line 6042 of file oct-stream.cc.

References err, octave::base_stream::gets(), rep, retval, stream_ok(), and string.

Referenced by gets().

◆ gets() [2/2]

std::string octave::stream::gets ( const octave_value max_len,
bool err,
const std::string who 
)

◆ input_stream()

std::istream* octave::stream::input_stream ( void  )
inline

Definition at line 366 of file oct-stream.h.

Referenced by read().

◆ invalid_operation()

void octave::stream::invalid_operation ( const std::string who,
const char *  rw 
)
inlineprivate

Definition at line 398 of file oct-stream.h.

References octave::base_stream::invalid_operation().

Referenced by read(), and write().

◆ is_open()

bool octave::stream::is_open ( void  ) const

Definition at line 6252 of file oct-stream.cc.

References octave::base_stream::is_open(), rep, retval, and stream_ok().

◆ is_valid()

bool octave::stream::is_valid ( void  ) const
inline

Definition at line 352 of file oct-stream.h.

Referenced by octave::stream_list::clear(), and octave::stream_list::remove().

◆ mode()

int octave::stream::mode ( void  ) const

◆ mode_as_string()

std::string octave::stream::mode_as_string ( int  mode)
static

Definition at line 7249 of file oct-stream.cc.

References mode(), retval, string, and octave::math::trunc().

◆ name()

◆ ok()

bool octave::stream::ok ( void  ) const
inline

Definition at line 354 of file oct-stream.h.

◆ operator bool()

octave::stream::operator bool ( ) const
inline

Definition at line 356 of file oct-stream.h.

◆ operator=()

stream & octave::stream::operator= ( const stream s)

Definition at line 5979 of file oct-stream.cc.

References octave::base_stream::count, rep, and s.

◆ oscanf() [1/2]

octave_value_list octave::stream::oscanf ( const std::string fmt,
const std::string who 
)

Definition at line 7082 of file oct-stream.cc.

References octave::base_stream::oscanf(), rep, retval, and stream_ok().

Referenced by oscanf().

◆ oscanf() [2/2]

octave_value_list octave::stream::oscanf ( const octave_value fmt,
const std::string who 
)

◆ output_stream()

std::ostream* octave::stream::output_stream ( void  )
inline

Definition at line 371 of file oct-stream.h.

Referenced by skip_bytes(), and write_bytes().

◆ printf() [1/2]

int octave::stream::printf ( const std::string fmt,
const octave_value_list args,
const std::string who 
)

Definition at line 7126 of file oct-stream.cc.

References octave::base_stream::printf(), rep, retval, and stream_ok().

Referenced by printf().

◆ printf() [2/2]

int octave::stream::printf ( const octave_value fmt,
const octave_value_list args,
const std::string who 
)

◆ puts() [1/2]

int octave::stream::puts ( const std::string s,
const std::string who 
)

Definition at line 7162 of file oct-stream.cc.

References octave::base_stream::puts(), rep, retval, s, and stream_ok().

Referenced by puts().

◆ puts() [2/2]

int octave::stream::puts ( const octave_value s,
const std::string who 
)

◆ read()

◆ rewind()

int octave::stream::rewind ( void  )

Definition at line 6246 of file oct-stream.cc.

References seek(), and SEEK_SET.

Referenced by Ffrewind().

◆ scanf() [1/2]

octave_value octave::stream::scanf ( const std::string fmt,
const Array< double > &  size,
octave_idx_type count,
const std::string who 
)

Definition at line 7046 of file oct-stream.cc.

References rep, retval, octave::base_stream::scanf(), and stream_ok().

Referenced by scanf().

◆ scanf() [2/2]

octave_value octave::stream::scanf ( const octave_value fmt,
const Array< double > &  size,
octave_idx_type count,
const std::string who 
)

◆ seek() [1/2]

int octave::stream::seek ( off_t  offset,
int  origin 
)

◆ seek() [2/2]

◆ skip_bytes()

bool octave::stream::skip_bytes ( size_t  n_elts)

Definition at line 6900 of file oct-stream.cc.

References os, output_stream(), seek(), SEEK_CUR, SEEK_END, SEEK_SET, tell(), write(), and zero().

Referenced by write().

◆ skipl() [1/2]

off_t octave::stream::skipl ( off_t  count,
bool err,
const std::string who 
)

Definition at line 6077 of file oct-stream.cc.

References err, rep, retval, octave::base_stream::skipl(), and stream_ok().

Referenced by skipl().

◆ skipl() [2/2]

off_t octave::stream::skipl ( const octave_value count,
bool err,
const std::string who 
)

◆ stream_ok()

bool octave::stream::stream_ok ( bool  clear = true) const
inlineprivate

◆ tell()

off_t octave::stream::tell ( void  )

Definition at line 6235 of file oct-stream.cc.

References rep, retval, stream_ok(), and octave::base_stream::tell().

Referenced by read(), and skip_bytes().

◆ textscan()

octave_value octave::stream::textscan ( const std::string fmt,
octave_idx_type  ntimes,
const octave_value_list options,
const std::string who,
octave_idx_type count 
)

◆ write() [1/2]

octave_idx_type octave::stream::write ( const octave_value data,
octave_idx_type  block_size,
oct_data_conv::data_type  output_type,
octave_idx_type  skip,
mach_info::float_format  flt_fmt 
)

Definition at line 6704 of file oct-stream.cc.

References error(), float_format(), flt_fmt, octave::mach_info::flt_fmt_unknown, invalid_operation(), retval, stream_ok(), and octave_value::write().

Referenced by do_fwrite(), octave_char_matrix_str::save_ascii(), octave_fcn_inline::save_binary(), octave_float_complex_diag_matrix::save_binary(), octave_complex_diag_matrix::save_binary(), octave_float_diag_matrix::save_binary(), octave_base_int_matrix< intNDArray< OCTAVE_INT_T > >::save_binary(), octave_diag_matrix::save_binary(), octave_sparse_bool_matrix::save_binary(), octave_fcn_handle::save_binary(), octave_sparse_complex_matrix::save_binary(), octave_struct::save_binary(), octave_sparse_matrix::save_binary(), octave_float_complex_matrix::save_binary(), octave_cell::save_binary(), octave_complex_matrix::save_binary(), octave_char_matrix_str::save_binary(), octave_base_int_scalar< OCTAVE_INT_T >::save_binary(), octave_float_complex::save_binary(), octave_complex::save_binary(), octave_class::save_binary(), octave_float_matrix::save_binary(), octave_bool_matrix::save_binary(), octave_perm_matrix::save_binary(), octave_matrix::save_binary(), octave_bool::save_binary(), octave_float_scalar::save_binary(), octave_scalar::save_binary(), octave_scalar_struct::save_binary(), octave_range::save_binary(), save_binary_data(), save_mat5_binary_element(), save_mat_binary_data(), skip_bytes(), octave_float_complex_matrix::write(), octave_complex_matrix::write(), octave_char_matrix_str::write(), octave_float_complex::write(), octave_complex::write(), octave_float_matrix::write(), octave_bool_matrix::write(), octave_matrix::write(), octave_bool::write(), octave_float_scalar::write(), octave_scalar::write(), octave_range::write(), OCTAVE_VALUE_INT_MATRIX_T::write(), OCTAVE_VALUE_INT_SCALAR_T::write(), write_bytes(), octave::write_data(), write_doubles(), write_floats(), write_header(), write_mat5_array(), and write_mat5_integer_data().

◆ write() [2/2]

◆ write_bytes()

bool octave::stream::write_bytes ( const void *  data,
size_t  n_elts 
)

Definition at line 6877 of file oct-stream.cc.

References os, output_stream(), and write().

Referenced by write().

Member Data Documentation

◆ rep


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