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

Ofstream Interface Facade for Binary Streams. More...

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

Inheritance diagram for itpp::binfile_details::Ofstream_Binfile_Facade:

## Public Member Functions

| Ofstream_Binfile_Facade ()
| Default Constructor.
| Ofstream_Binfile_Facade (const char *filename, std::ios_base::openmode mode=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::out|std::ios_base::binary)
| Method to open corresponding file.
void | close ()
| Method to close corresponding file.
Ofstream_Binfile_Facade & | write (const char *c, std::streamsize n)
| Output multiple characters.
Ofstream_Binfile_Facade & | put (const char c)
| Output single char.
std::streampos | tellp ()
| Get position.
Ofstream_Binfile_Facade & | seekp (std::streampos pos)
| Set position.
Ofstream_Binfile_Facade & | seekp (std::streamoff pos, std::ios_base::seekdir way)
| Set relative position.
Ofstream_Binfile_Facade & | flush ()
| Flushes stream buffer.
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 | ~Ofstream_Binfile_Facade ()
| Destructor.

## Protected Member Functions

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

## Detailed Description

Ofstream Interface Facade for Binary Streams.

This class implements std::ofstream 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 insertion operators. It is assumed that stream insertion is defined in binary stream classes derived from this class
4. formatting interface (copyfmt, fill, narrow, widen). This is not relevant to binary streams
5. ios_base-related stuff. These things are excluded since they provide unnecessarily formatting facilities.

Definition at line 150 of file binfile.h.

## Constructor & Destructor Documentation

## Ofstream_Binfile_Facade() [1/2]

itpp::binfile_details::Ofstream_Binfile_Facade::Ofstream_Binfile_Facade | ( |  | ) |

Default Constructor.

Definition at line 46 of file binfile.cpp.

## Ofstream_Binfile_Facade() [2/2]

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

explicit

Constructor from filename and stream mode.

Definition at line 48 of file binfile.cpp.

## ~Ofstream_Binfile_Facade()

itpp::binfile_details::Ofstream_Binfile_Facade::~Ofstream_Binfile_Facade | ( |  | ) |

virtual

Destructor.

Definition at line 51 of file binfile.cpp.

## Member Function Documentation

## is_open()

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

inline

Open state.

Definition at line 163 of file binfile.h.

## open()

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

inline

Method to open corresponding file.

Definition at line 165 of file binfile.h.

## close()

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

inline

Method to close corresponding file.

Definition at line 169 of file binfile.h.

## write()

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

inline

Output multiple characters.

Definition at line 172 of file binfile.h.

References write().

Referenced by itpp::bofstream::operator<<(), itpp::bofstream::operator<<(), and write().

## put()

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

inline

Output single char.

Definition at line 175 of file binfile.h.

References put().

Referenced by itpp::bofstream::operator<<(), itpp::bofstream::operator<<(), itpp::bofstream::operator<<(), and put().

## tellp()

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

inline

Get position.

Definition at line 178 of file binfile.h.

## seekp() [1/2]

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

inline

Set position.

Definition at line 181 of file binfile.h.

References seekp().

Referenced by seekp(), and seekp().

## seekp() [2/2]

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

inline

Set relative position.

Definition at line 184 of file binfile.h.

References seekp().

## flush()

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

inline

Flushes stream buffer.

Definition at line 187 of file binfile.h.

References flush().

Referenced by flush().

## good()

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

inline

This method returns true is stream state is good.

Definition at line 191 of file binfile.h.

## eof()

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

inline

This method returns true if eof is reached.

Definition at line 193 of file binfile.h.

## fail()

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

inline

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

Definition at line 195 of file binfile.h.

## bad()

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

inline

This method returns true if badbit is set.

Definition at line 197 of file binfile.h.

## operator!()

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

inline

Unary not operator to check the stream state.

Definition at line 200 of file binfile.h.

## operator bool()

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

inline

Conversion to bool to validate stream state.

Definition at line 202 of file binfile.h.

## rdstate()

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

inline

Method to read stream state flags.

Definition at line 205 of file binfile.h.

## setstate()

void itpp::binfile_details::Ofstream_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 207 of file binfile.h.

## clear()

void itpp::binfile_details::Ofstream_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 209 of file binfile.h.

## exceptions() [1/2]

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

inline

Method to get the exceptions mask.

Definition at line 211 of file binfile.h.

## exceptions() [2/2]

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

inline

Method to set the exceptions mask.

Definition at line 213 of file binfile.h.

## stream()

std::ofstream * itpp::binfile_details::Ofstream_Binfile_Facade::stream | ( |  | ) |

inlineprotected

Access to internal stream for derived classes.

Definition at line 219 of file binfile.h.

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