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

#include "oct-stream.h"

Collaboration diagram for stream:

Public Member Functions

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

Static Public Member Functions

static OCTINTERP_API std::string mode_as_string (int mode)
 

Private Member Functions

OCTINTERP_API 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

std::shared_ptr< base_streamm_rep
 

Detailed Description

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

Constructor & Destructor Documentation

◆ stream() [1/2]

stream::stream ( base_stream bs = nullptr)
inline

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

◆ stream() [2/2]

stream::stream ( const stream )
default

◆ ~stream()

stream::~stream ( void  )
default

Member Function Documentation

◆ clearerr()

void stream::clearerr ( void  )
inline

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

References m_rep.

Referenced by Ffclear(), and seek().

◆ close()

void stream::close ( void  )

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

References m_rep, and stream_ok().

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

◆ encoding()

std::string stream::encoding ( void  )
inline

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

References m_rep.

Referenced by stream_list::get_info().

◆ eof()

bool stream::eof ( void  ) const

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

References m_rep, and stream_ok().

Referenced by Ffeof(), Fsscanf(), load_save_system::load_vars(), and read_data().

◆ error() [1/4]

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

◆ error() [2/4]

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

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

References error().

◆ error() [3/4]

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

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

References error().

Referenced by error().

◆ error() [4/4]

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

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

References m_rep.

◆ file_number()

int stream::file_number ( void  )
inline

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

References m_rep.

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

◆ finalize_read()

◆ float_format()

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

◆ flush()

int stream::flush ( void  )

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

References m_rep, and stream_ok().

Referenced by Ffflush().

◆ getl() [1/2]

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

◆ getl() [2/2]

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

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

References m_rep, stream_ok(), and textscan_format_list::who.

Referenced by Ffgetl(), and getl().

◆ gets() [1/2]

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

◆ gets() [2/2]

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

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

References m_rep, stream_ok(), and textscan_format_list::who.

Referenced by Ffgets(), and gets().

◆ input_stream()

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

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

References m_rep.

Referenced by Fdlmread(), and read().

◆ invalid_operation()

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

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

References m_rep.

Referenced by read(), and write().

◆ is_open()

bool stream::is_open ( void  ) const

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

References m_rep, and stream_ok().

Referenced by base_stream::close().

◆ is_valid()

bool stream::is_valid ( void  ) const
inline

◆ mode()

int stream::mode ( void  ) const

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

References m_rep, and stream_ok().

Referenced by stream_list::get_info(), stream_list::list_open_files(), and mode_as_string().

◆ mode_as_string()

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

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

References mode(), and trunc().

Referenced by stream_list::get_info(), and stream_list::list_open_files().

◆ name()

std::string stream::name ( void  ) const

◆ ok()

bool stream::ok ( void  ) const
inline

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

References m_rep.

Referenced by operator bool().

◆ operator bool()

stream::operator bool ( ) const
inline

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

References ok().

◆ operator=()

stream& stream::operator= ( const stream )
default

◆ oscanf() [1/2]

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

◆ oscanf() [2/2]

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

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

References m_rep, and stream_ok().

Referenced by Fsscanf(), oscanf(), and scanf_internal().

◆ output_stream()

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

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

References m_rep.

Referenced by Ffdisp(), base_stream::preferred_output_stream(), skip_bytes(), and write_bytes().

◆ printf() [1/2]

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

◆ printf() [2/2]

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

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

References m_rep, and stream_ok().

Referenced by Fsprintf(), printf(), and printf_internal().

◆ puts() [1/2]

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

◆ puts() [2/2]

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

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

References m_rep, and stream_ok().

Referenced by puts(), and puts_internal().

◆ read()

octave_value stream::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 
)

◆ rewind()

int stream::rewind ( void  )

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

References seek(), and SEEK_SET.

Referenced by Ffrewind().

◆ scanf() [1/2]

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

◆ scanf() [2/2]

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

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

References m_rep, and stream_ok().

Referenced by Fsscanf(), scanf(), and scanf_internal().

◆ seek() [1/2]

◆ seek() [2/2]

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

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

References clearerr(), m_rep, SEEK_CUR, SEEK_END, SEEK_SET, and stream_ok().

Referenced by Ffseek(), rewind(), seek(), and skip_bytes().

◆ skip_bytes()

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

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

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

Referenced by write().

◆ skipl() [1/2]

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

◆ skipl() [2/2]

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

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

References m_rep, stream_ok(), and textscan_format_list::who.

Referenced by Ffskipl(), and skipl().

◆ stream_ok()

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

◆ tell()

off_t stream::tell ( void  )

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

References m_rep, and stream_ok().

Referenced by Fftell(), Fsscanf(), and skip_bytes().

◆ textscan()

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

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

References m_rep, and stream_ok().

Referenced by textscan_internal().

◆ write() [1/3]

◆ write() [2/3]

template<typename T >
OCTINTERP_API octave_idx_type stream::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 
)

◆ write() [3/3]

octave_idx_type 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 
)

◆ write_bytes()

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

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

References output_stream().

Referenced by write().

Member Data Documentation

◆ m_rep


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