itpp::binfile_details::Fstream_Binfile_Facade Class Reference
Base Module » IT++ File Format

Fstream Interface Facade for Binary Streams. More...

`#include <itpp/base/binfile.h>`

Inheritance diagram for itpp::binfile_details::Fstream_Binfile_Facade:

## Public Member Functions

| Fstream_Binfile_Facade ()
| Default Constructor.
| Fstream_Binfile_Facade (const char *filename, std::ios_base::openmode mode=std::ios_base::in|std::ios_base::out|std::ios_base::binary)
| Constructor from filename and stream mode.
bool | is_open ()
| Open state.
void | open (const char *filename, std::ios_base::openmode mode=std::ios_base::in|std::ios_base::out|std::ios_base::binary)
| Method to open corresponding file.
void | close ()
| Method to close corresponding file.
Fstream_Binfile_Facade & | write (const char *c, std::streamsize n)
| Output multiple characters.
Fstream_Binfile_Facade & | put (const char c)
| Output single char.
std::streampos | tellp ()
| Get position.
Fstream_Binfile_Facade & | seekp (std::streampos pos)
| Set position.
Fstream_Binfile_Facade & | seekp (std::streamoff pos, std::ios_base::seekdir way)
| Set relative position.
Fstream_Binfile_Facade & | flush ()
| Flushes stream buffer.
std::streamsize | gcount () const
| Last extracted chars count.
int | get ()
| Get single char.
Fstream_Binfile_Facade & | get (char &c)
| Get single char.
Fstream_Binfile_Facade & | get (char *s, std::streamsize n)
| Get multiple chars to c-string and add trailing 0.
Fstream_Binfile_Facade & | get (char *s, std::streamsize n, char delim)
| Get multiple chars to c-string without trailing 0.
Fstream_Binfile_Facade & | getline (char *s, std::streamsize n)
| Get multiple chars to c-string without trailing 0.
Fstream_Binfile_Facade & | getline (char *s, std::streamsize n, char delim)
Fstream_Binfile_Facade & | ignore (std::streamsize n=1, int delim=EOF)
| Extract and ignore chars.
int | peek ()
| Peak single char from the top of the buffer.
Fstream_Binfile_Facade & | read (char *s, std::streamsize n)
| Read n chars from stream.
std::streamsize | readsome (char *s, std::streamsize n)
| Read up to n available chars from stream.
Fstream_Binfile_Facade & | putback (char c)
| This method attempts to put back single char.
Fstream_Binfile_Facade & | unget ()
| Unget last extracted char.
std::streampos | tellg ()
| Get position.
Fstream_Binfile_Facade & | seekg (std::streampos pos)
| Set position.
Fstream_Binfile_Facade & | seekg (std::streamoff pos, std::ios_base::seekdir way)
| Set relative position.
bool | good () const
| This method returns true is stream state is good.
bool | eof () const
| This method returns true if eof is reached.
bool | fail () const
| This method returns true if either failbit or badbit is set.
bool | bad () const
| This method returns true if badbit is set.
bool | operator! () const
| Unary not operator to check the stream state.
| operator bool () const
| Conversion to bool to validate stream state.
std::ios_base::iostate | rdstate () const
| Method to read stream state flags.
void | setstate (std::ios_base::iostate state)
| Method to set the stream state (combines already set flags with flags provide by user)
void | clear (std::ios_base::iostate state=std::ios_base::goodbit)
| Method to set stream state (overwrites stream state flags)
std::ios_base::iostate | exceptions () const
| Method to get the exceptions mask.
void | exceptions (std::ios_base::iostate except)
| Method to set the exceptions mask.
virtual | ~Fstream_Binfile_Facade ()
| Destructor.

## Protected Member Functions

std::fstream * | stream ()
| Access to internal stream for derived classes.

## Detailed Description

Fstream Interface Facade for Binary Streams.

This class implements std::fstream facade to make ITPP binary file streams exportable from dll. This facade implements basic functionality only. It does not provide an access to the following stream facilities (all of them are useless for binary streams)

1. locale(imbue) It does not make sence to change locale settings for binary streams. Changes in formatting or char conversion can result in compatibility problems with resulting binary files
2. stream buffer (rdbuf). DLL and application can use different versions of runtime , so it would be dangerous to use buffer created in DLL in application context
3. stream extraction operators. It is assumed that stream extraction is defined in binary stream classes derived from this class
4. stream insertion operators. It is assumed that stream insertion is defined in binary stream classes derived from this class
5. formatting interface (copyfmt, fill, narrow, widen). This is not relevant to binary streams
6. ios_base-related stuff. These things are excluded since they provide unnecessarily formatting facilities.

Definition at line 354 of file binfile.h.

## Constructor & Destructor Documentation

## Fstream_Binfile_Facade() [1/2]

itpp::binfile_details::Fstream_Binfile_Facade::Fstream_Binfile_Facade | ( |  | ) |

Default Constructor.

Definition at line 62 of file binfile.cpp.

## Fstream_Binfile_Facade() [2/2]

itpp::binfile_details::Fstream_Binfile_Facade::Fstream_Binfile_Facade | ( | const char * | filename,
|  | std::ios_base::openmode | mode = `std::ios_base::in | std::ios_base::out | std::ios_base::binary`
| ) |  |

explicit

Constructor from filename and stream mode.

Definition at line 64 of file binfile.cpp.

## ~Fstream_Binfile_Facade()

itpp::binfile_details::Fstream_Binfile_Facade::~Fstream_Binfile_Facade | ( |  | ) |

virtual

Destructor.

Definition at line 67 of file binfile.cpp.

## Member Function Documentation

## is_open()

bool itpp::binfile_details::Fstream_Binfile_Facade::is_open | ( |  | ) |

inline

Open state.

Definition at line 367 of file binfile.h.

Referenced by itpp::it_file::open(), itpp::it_file_old::open(), and itpp::it_file::pack().

## open()

void itpp::binfile_details::Fstream_Binfile_Facade::open | ( | const char * | filename,
|  | std::ios_base::openmode | mode = `std::ios_base::in | std::ios_base::out | std::ios_base::binary`
| ) |  |

inline

Method to open corresponding file.

Definition at line 369 of file binfile.h.

Referenced by itpp::bfstream::open(), and itpp::bfstream::open_readonly().

## close()

void itpp::binfile_details::Fstream_Binfile_Facade::close | ( |  | ) |

inline

Method to close corresponding file.

Definition at line 373 of file binfile.h.

Referenced by itpp::it_ifile::close(), itpp::it_file::close(), itpp::it_ifile_old::close(), itpp::it_file_old::close(), itpp::it_ifile::open(), itpp::it_file::open(), itpp::it_ifile_old::open(), itpp::it_file_old::open(), and itpp::it_file::pack().

## write()

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::write | ( | const char * | c,
|  | std::streamsize | n
| ) |  |

inline

Output multiple characters.

Definition at line 376 of file binfile.h.

References write().

Referenced by itpp::bfstream::operator<<(), itpp::bfstream::operator<<(), write(), itpp::it_file::write_file_header(), and itpp::it_file_old::write_file_header().

## put()

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::put | ( | const char | c | ) |

inline

Output single char.

Definition at line 379 of file binfile.h.

References put().

Referenced by itpp::bfstream::operator<<(), itpp::bfstream::operator<<(), itpp::bfstream::operator<<(), itpp::it_file::pack(), put(), and itpp::it_file::write_file_header().

## tellp()

std::streampos itpp::binfile_details::Fstream_Binfile_Facade::tellp | ( |  | ) |

inline

Get position.

Definition at line 382 of file binfile.h.

Referenced by itpp::it_file::remove(), itpp::it_file_old::remove(), itpp::it_file_old::write_data_header(), and itpp::it_file::write_data_header().

## seekp() [1/2]

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::seekp | ( | std::streampos | pos | ) |

inline

Set position.

Definition at line 384 of file binfile.h.

References seekp().

Referenced by itpp::it_file::pack(), itpp::it_file::remove(), itpp::it_file_old::remove(), seekp(), seekp(), itpp::it_file_old::write_data_header(), and itpp::it_file::write_data_header().

## seekp() [2/2]

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::seekp | ( | std::streamoff | pos,
|  | std::ios_base::seekdir | way
| ) |  |

inline

Set relative position.

Definition at line 387 of file binfile.h.

References seekp().

## flush()

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::flush | ( |  | ) |

inline

Flushes stream buffer.

Definition at line 390 of file binfile.h.

References flush().

Referenced by flush(), itpp::it_file::flush(), and itpp::it_file_old::flush().

## gcount()

std::streamsize itpp::binfile_details::Fstream_Binfile_Facade::gcount | ( |  | ) | const

inline

Last extracted chars count.

Definition at line 392 of file binfile.h.

## get() [1/4]

int itpp::binfile_details::Fstream_Binfile_Facade::get | ( |  | ) |

inline

Get single char.

Definition at line 394 of file binfile.h.

Referenced by get(), get(), get(), itpp::bfstream::operator>>(), itpp::bfstream::operator>>(), itpp::bfstream::operator>>(), and itpp::it_file::pack().

## get() [2/4]

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::get | ( | char & | c | ) |

inline

Get single char.

Definition at line 396 of file binfile.h.

References get().

## get() [3/4]

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::get | ( | char * | s,
|  | std::streamsize | n
| ) |  |

inline

Get multiple chars to c-string and add trailing 0.

Definition at line 398 of file binfile.h.

References get().

## get() [4/4]

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::get | ( | char * | s,
|  | std::streamsize | n,
|  | char | delim
| ) |  |

inline

Get multiple chars to c-string without trailing 0.

Definition at line 401 of file binfile.h.

References get().

## getline() [1/2]

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::getline | ( | char * | s,
|  | std::streamsize | n
| ) |  |

inline

Get multiple chars to c-string without trailing 0.

Definition at line 404 of file binfile.h.

References getline().

Referenced by getline(), and itpp::bfstream::operator>>().

## getline() [2/2]

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::getline | ( | char * | s,
|  | std::streamsize | n,
|  | char | delim
| ) |  |

inline

Definition at line 406 of file binfile.h.

## ignore()

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::ignore | ( | std::streamsize | n = `1`,
|  | int | delim = `EOF`
| ) |  |

inline

Extract and ignore chars.

Definition at line 409 of file binfile.h.

References ignore().

Referenced by ignore().

## peek()

int itpp::binfile_details::Fstream_Binfile_Facade::peek | ( |  | ) |

inline

Peak single char from the top of the buffer.

Definition at line 412 of file binfile.h.

## read()

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::read | ( | char * | s,
|  | std::streamsize | n
| ) |  |

inline

Read n chars from stream.

Definition at line 414 of file binfile.h.

References read().

Referenced by read(), itpp::it_ifile::read_check_file_header(), and itpp::it_ifile_old::read_check_file_header().

## readsome()

std::streamsize itpp::binfile_details::Fstream_Binfile_Facade::readsome | ( | char * | s,
|  | std::streamsize | n
| ) |  |

inline

Read up to n available chars from stream.

Definition at line 417 of file binfile.h.

## putback()

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::putback | ( | char | c | ) |

inline

This method attempts to put back single char.

Definition at line 420 of file binfile.h.

References putback().

Referenced by putback().

## unget()

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::unget | ( |  | ) |

inline

Unget last extracted char.

Definition at line 423 of file binfile.h.

References unget().

Referenced by unget().

## tellg()

std::streampos itpp::binfile_details::Fstream_Binfile_Facade::tellg | ( |  | ) |

inline

Get position.

Definition at line 426 of file binfile.h.

Referenced by itpp::it_ifile_old::info(), itpp::it_ifile::info(), itpp::bfstream::length(), itpp::it_file::pack(), itpp::it_ifile_old::read_data_header(), itpp::it_ifile::seek(), itpp::it_ifile_old::seek(), itpp::it_ifile::seek(), and itpp::it_ifile_old::seek().

## seekg() [1/2]

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::seekg | ( | std::streampos | pos | ) |

inline

Set position.

Definition at line 428 of file binfile.h.

References seekg().

Referenced by itpp::it_ifile_old::info(), itpp::it_ifile::info(), itpp::bfstream::length(), itpp::it_file::pack(), itpp::it_ifile_old::read_data_header(), itpp::it_ifile::seek(), itpp::it_ifile_old::seek(), itpp::it_ifile::seek(), itpp::it_ifile_old::seek(), seekg(), seekg(), itpp::it_file_old::write_data_header(), and itpp::it_file::write_data_header().

## seekg() [2/2]

Fstream_Binfile_Facade & itpp::binfile_details::Fstream_Binfile_Facade::seekg | ( | std::streamoff | pos,
|  | std::ios_base::seekdir | way
| ) |  |

inline

Set relative position.

Definition at line 431 of file binfile.h.

References seekg().

## good()

bool itpp::binfile_details::Fstream_Binfile_Facade::good | ( |  | ) | const

inline

This method returns true is stream state is good.

Definition at line 435 of file binfile.h.

## eof()

bool itpp::binfile_details::Fstream_Binfile_Facade::eof | ( |  | ) | const

inline

This method returns true if eof is reached.

Definition at line 437 of file binfile.h.

Referenced by itpp::it_file::pack(), itpp::it_ifile_old::read_data_header(), itpp::it_ifile::seek(), itpp::it_ifile_old::seek(), itpp::it_ifile::seek(), itpp::it_ifile_old::seek(), itpp::it_file_old::write_data_header(), and itpp::it_file::write_data_header().

## fail()

bool itpp::binfile_details::Fstream_Binfile_Facade::fail | ( |  | ) | const

inline

This method returns true if either failbit or badbit is set.

Definition at line 439 of file binfile.h.

## bad()

bool itpp::binfile_details::Fstream_Binfile_Facade::bad | ( |  | ) | const

inline

This method returns true if badbit is set.

Definition at line 441 of file binfile.h.

## operator!()

bool itpp::binfile_details::Fstream_Binfile_Facade::operator! | ( |  | ) | const

inline

Unary not operator to check the stream state.

Definition at line 444 of file binfile.h.

## operator bool()

itpp::binfile_details::Fstream_Binfile_Facade::operator bool | ( |  | ) | const

inline

Conversion to bool to validate stream state.

Definition at line 446 of file binfile.h.

## rdstate()

std::ios_base::iostate itpp::binfile_details::Fstream_Binfile_Facade::rdstate | ( |  | ) | const

inline

Method to read stream state flags.

Definition at line 449 of file binfile.h.

## setstate()

void itpp::binfile_details::Fstream_Binfile_Facade::setstate | ( | std::ios_base::iostate | state | ) |

inline

Method to set the stream state (combines already set flags with flags provide by user)

Definition at line 451 of file binfile.h.

## clear()

void itpp::binfile_details::Fstream_Binfile_Facade::clear | ( | std::ios_base::iostate | state = `std::ios_base::goodbit` | ) |

inline

Method to set stream state (overwrites stream state flags)

Definition at line 453 of file binfile.h.

Referenced by itpp::it_file::pack(), itpp::it_ifile_old::read_data_header(), itpp::it_ifile::read_data_header(), itpp::it_ifile::seek(), itpp::it_ifile_old::seek(), itpp::it_ifile::seek(), itpp::it_ifile_old::seek(), itpp::it_file_old::write_data_header(), and itpp::it_file::write_data_header().

## exceptions() [1/2]

std::ios_base::iostate itpp::binfile_details::Fstream_Binfile_Facade::exceptions | ( |  | ) | const

inline

Method to get the exceptions mask.

Definition at line 456 of file binfile.h.

## exceptions() [2/2]

void itpp::binfile_details::Fstream_Binfile_Facade::exceptions | ( | std::ios_base::iostate | except | ) |

inline

Method to set the exceptions mask.

Definition at line 458 of file binfile.h.

## stream()

std::fstream * itpp::binfile_details::Fstream_Binfile_Facade::stream | ( |  | ) |

inlineprotected

Access to internal stream for derived classes.

Definition at line 464 of file binfile.h.

Referenced by itpp::bfstream::operator>>().

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

- itpp/base/binfile.h
- itpp/base/binfile.cpp

Generated on Mon Jun 10 2024 11:49:41 for IT++ by Doxygen 1.9.8