binfile.h
Go to the documentation of this file.
#ifndef BINFILE_H
#define BINFILE_H
#include <itpp/itexports.h>
#include <itpp/base/ittypes.h>
#include <itpp/base/binary.h>
#include <fstream>
#ifdef _MSC_VER
#pragma warning( disable : 4250 )
#endif
namespace itpp
{
bool exist(const std::string& name);
class ITPP_EXPORT bfstream_base
{
public:
enum endian { l_endian, b_endian };
bfstream_base(endian e = b_endian);
endian get_endianity() const {
if (switch_endianity) {
if (native_endianity == l_endian)
return b_endian;
else
return l_endian;
}
else
return native_endianity;
}
endian get_native_endianity() const { return native_endianity; }
void set_endianity(endian e) {
if (native_endianity == e)
switch_endianity = false;
else
switch_endianity = true;
}
void set_native_endianity() { switch_endianity = false; }
protected:
bool switch_endianity;
endian native_endianity;
};
namespace binfile_details
{
class ITPP_EXPORT Ofstream_Binfile_Facade
{
std::ofstream* _str;
//following makes class non-copiable
Ofstream_Binfile_Facade(const Ofstream_Binfile_Facade& o);
void operator= (const Ofstream_Binfile_Facade& o);
public:
Ofstream_Binfile_Facade ( );
explicit Ofstream_Binfile_Facade ( const char * filename,
std::ios_base::openmode mode = std::ios_base::out | std::ios_base::binary);
bool is_open() {return _str->is_open();}
void open ( const char * filename,
std::ios_base::openmode mode = std::ios_base::out | std::ios_base::binary )
{_str->open(filename,mode);}
void close()
{_str->close();}
Ofstream_Binfile_Facade& write (const char* c, std::streamsize n)
{_str->write(c,n); return *this;}
Ofstream_Binfile_Facade& put (const char c)
{_str->put(c); return *this;};
std::streampos tellp()
{return _str->tellp();}
Ofstream_Binfile_Facade& seekp (std::streampos pos)
{_str->seekp(pos); return *this;}
Ofstream_Binfile_Facade& seekp (std::streamoff pos, std::ios_base::seekdir way)
{_str->seekp(pos,way); return *this;}
Ofstream_Binfile_Facade& flush()
{_str->flush(); return *this;}
bool good() const {return _str->good();}
bool eof() const {return _str->eof();}
bool fail() const {return _str->fail();}
bool bad() const {return _str->bad();}
bool operator!() const {return _str->fail();}
operator bool() const {return _str->good();}
std::ios_base::iostate rdstate() const {return _str->rdstate();}
void setstate (std::ios_base::iostate state) {_str->setstate(state);}
void clear (std::ios_base::iostate state = std::ios_base::goodbit) {_str->clear(state);}
std::ios_base::iostate exceptions() const {return _str->exceptions();}
void exceptions (std::ios_base::iostate except) {_str->exceptions(except);}
virtual ~Ofstream_Binfile_Facade();
protected:
std::ofstream* stream() {return _str;}
};
class ITPP_EXPORT Ifstream_Binfile_Facade
{
std::ifstream* _str;
//following makes class non-copiable
Ifstream_Binfile_Facade(const Ifstream_Binfile_Facade& o);
void operator= (const Ifstream_Binfile_Facade& o);
public:
Ifstream_Binfile_Facade ( );
explicit Ifstream_Binfile_Facade ( const char * filename,
std::ios_base::openmode mode = std::ios_base::in | std::ios_base::binary);
bool is_open()
{return _str->is_open();}
void open ( const char * filename,
std::ios_base::openmode mode = std::ios_base::in | std::ios_base::binary)
{_str->open(filename,mode);}
void close() {_str->close();}
std::streamsize gcount() const {return _str->gcount();}
int get() {return _str->get();}
Ifstream_Binfile_Facade& get(char& c) {_str->get(c); return *this;}
Ifstream_Binfile_Facade& get (char* s, std::streamsize n)
{_str->get(s,n); return *this;}
Ifstream_Binfile_Facade& get (char* s, std::streamsize n, char delim)
{_str->get(s,n,delim); return *this;}
Ifstream_Binfile_Facade& getline (char* s, std::streamsize n )
{_str->getline(s,n); return *this;}
Ifstream_Binfile_Facade& getline (char* s, std::streamsize n, char delim )
{_str->getline(s,n,delim); return *this;}
Ifstream_Binfile_Facade& ignore (std::streamsize n = 1, int delim = EOF)
{_str->ignore(n,delim); return *this;}
int peek() {return _str->peek();}
Ifstream_Binfile_Facade& read (char* s, std::streamsize n)
{_str->read(s,n); return *this;}
std::streamsize readsome (char* s, std::streamsize n)
{return _str->readsome(s,n);}
Ifstream_Binfile_Facade& putback (char c)
{_str->putback(c); return *this;}
Ifstream_Binfile_Facade& unget() {_str->unget(); return *this;}
std::streampos tellg() {return _str->tellg();}
Ifstream_Binfile_Facade& seekg (std::streampos pos)
{_str->seekg(pos); return *this;}
Ifstream_Binfile_Facade& seekg (std::streamoff pos, std::ios_base::seekdir way)
{_str->seekg(pos,way); return *this;}
bool good() const {return _str->good();}
bool eof() const {return _str->eof();}
bool fail() const {return _str->fail();}
bool bad() const {return _str->bad();}
bool operator!() const {return _str->fail();}
operator bool() const {return _str->good();}
std::ios_base::iostate rdstate() const {return _str->rdstate();}
void setstate (std::ios_base::iostate state) {_str->setstate(state);}
void clear (std::ios_base::iostate state = std::ios_base::goodbit) {_str->clear(state);}
std::ios_base::iostate exceptions() const {return _str->exceptions();}
void exceptions (std::ios_base::iostate except) {_str->exceptions(except);}
virtual ~Ifstream_Binfile_Facade();
protected:
std::ifstream* stream() {return _str;}
};
class ITPP_EXPORT Fstream_Binfile_Facade
{
std::fstream* _str;
//following makes class non-copiable
Fstream_Binfile_Facade(const Fstream_Binfile_Facade& o);
void operator= (const Fstream_Binfile_Facade& o);
public:
Fstream_Binfile_Facade ( );
explicit Fstream_Binfile_Facade ( const char * filename,
std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out | std::ios_base::binary);
bool is_open() {return _str->is_open();}
void open ( const char * filename,
std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out | std::ios_base::binary)
{_str->open(filename,mode);}
void close() {_str->close();}
Fstream_Binfile_Facade& write (const char* c, std::streamsize n)
{_str->write(c,n); return *this;};
Fstream_Binfile_Facade& put (const char c)
{_str->put(c); return *this;};
std::streampos tellp() {return _str->tellp();}
Fstream_Binfile_Facade& seekp (std::streampos pos)
{_str->seekp(pos); return *this;}
Fstream_Binfile_Facade& seekp (std::streamoff pos, std::ios_base::seekdir way)
{_str->seekp(pos,way); return *this;}
Fstream_Binfile_Facade& flush() {_str->flush(); return *this;}
std::streamsize gcount() const {return _str->gcount();}
int get() {return _str->get();}
Fstream_Binfile_Facade& get(char& c){_str->get(c); return *this;}
Fstream_Binfile_Facade& get(char* s, std::streamsize n)
{_str->get(s,n); return *this;}
Fstream_Binfile_Facade& get(char* s, std::streamsize n, char delim)
{_str->get(s,n,delim); return *this;}
Fstream_Binfile_Facade& getline(char* s, std::streamsize n)
{_str->getline(s,n); return *this;}
Fstream_Binfile_Facade& getline(char* s, std::streamsize n, char delim)
{_str->getline(s,n,delim); return *this;}
Fstream_Binfile_Facade& ignore (std::streamsize n = 1, int delim = EOF)
{_str->ignore(n,delim); return *this;}
int peek() {return _str->peek();}
Fstream_Binfile_Facade& read (char* s, std::streamsize n)
{_str->read(s,n); return *this;}
std::streamsize readsome (char* s, std::streamsize n)
{return _str->readsome(s,n);}
Fstream_Binfile_Facade& putback (char c)
{_str->putback(c); return *this;}
Fstream_Binfile_Facade& unget()
{_str->unget(); return *this;}
std::streampos tellg() {return _str->tellg();}
Fstream_Binfile_Facade& seekg (std::streampos pos)
{_str->seekg(pos); return *this;}
Fstream_Binfile_Facade& seekg (std::streamoff pos, std::ios_base::seekdir way)
{_str->seekg(pos,way); return *this;}
bool good() const {return _str->good();}
bool eof() const {return _str->eof();}
bool fail() const {return _str->fail();}
bool bad() const {return _str->bad();}
bool operator!() const {return _str->fail();}
operator bool() const {return _str->good();}
std::ios_base::iostate rdstate() const {return _str->rdstate();}
void setstate (std::ios_base::iostate state) {_str->setstate(state);}
void clear (std::ios_base::iostate state = std::ios_base::goodbit)
{_str->clear(state);}
std::ios_base::iostate exceptions() const {return _str->exceptions();}
void exceptions (std::ios_base::iostate except) {_str->exceptions(except);}
virtual ~Fstream_Binfile_Facade();
protected:
std::fstream* stream() {return _str;}
};
}
class ITPP_EXPORT bofstream : public bfstream_base, public binfile_details::Ofstream_Binfile_Facade
{
public:
bofstream(const std::string& name, endian e = b_endian);
bofstream();
~bofstream() { }
void open(const std::string& name, bool trunc = false, endian e = b_endian);
bofstream& operator<<(char a);
bofstream& operator<<(int8_t a);
bofstream& operator<<(uint8_t a);
bofstream& operator<<(int16_t a);
bofstream& operator<<(uint16_t a);
bofstream& operator<<(int32_t a);
bofstream& operator<<(uint32_t a);
bofstream& operator<<(int64_t a);
bofstream& operator<<(uint64_t a);
bofstream& operator<<(float a);
bofstream& operator<<(double a);
bofstream& operator<<(bin a);
bofstream& operator<<(const char* a);
bofstream& operator<<(const std::string& a);
};
class ITPP_EXPORT bifstream : public bfstream_base, public binfile_details::Ifstream_Binfile_Facade
{
public:
bifstream(const std::string& name, endian e = b_endian);
bifstream();
~bifstream() { }
void open(const std::string& name, endian e = b_endian);
int length();
bifstream& operator>>(char& a);
bifstream& operator>>(int8_t& a);
bifstream& operator>>(uint8_t& a);
bifstream& operator>>(int16_t& a);
bifstream& operator>>(uint16_t& a);
bifstream& operator>>(int32_t& a);
bifstream& operator>>(uint32_t& a);
bifstream& operator>>(int64_t& a);
bifstream& operator>>(uint64_t& a);
bifstream& operator>>(float& a);
bifstream& operator>>(double& a);
bifstream& operator>>(bin& a);
bifstream& operator>>(char* a);
bifstream& operator>>(std::string& a);
};
class ITPP_EXPORT bfstream : public bfstream_base, public binfile_details::Fstream_Binfile_Facade
{
public:
bfstream(const std::string& name, endian e = b_endian);
bfstream();
~bfstream() { }
void open(const std::string& name, bool trunc = false, endian e = b_endian);
void open_readonly(const std::string& name, endian e = b_endian);
int length();
bfstream& operator<<(char a);
bfstream& operator<<(int8_t a);
bfstream& operator<<(uint8_t a);
bfstream& operator<<(int16_t a);
bfstream& operator<<(uint16_t a);
bfstream& operator<<(int32_t a);
bfstream& operator<<(uint32_t a);
bfstream& operator<<(int64_t a);
bfstream& operator<<(uint64_t a);
bfstream& operator<<(float a);
bfstream& operator<<(double a);
bfstream& operator<<(bin a);
bfstream& operator<<(const char* a);
bfstream& operator<<(const std::string& a);
bfstream& operator>>(char& a);
bfstream& operator>>(int8_t& a);
bfstream& operator>>(uint8_t & a);
bfstream& operator>>(int16_t& a);
bfstream& operator>>(uint16_t& a);
bfstream& operator>>(int32_t& a);
bfstream& operator>>(uint32_t& a);
bfstream& operator>>(int64_t& a);
bfstream& operator>>(uint64_t& a);
bfstream& operator>>(float& a);
bfstream& operator>>(double& a);
bfstream& operator>>(bin& a);
bfstream& operator>>(char* a);
bfstream& operator>>(std::string& a);
};
} //namespace itpp
#endif // #ifndef BINFILE_H
binary.h
Binary class definition.
itpp::bfstream_base
Base class for binary file classes.
Definition: binfile.h:60
itpp::bfstream_base::get_native_endianity
endian get_native_endianity() const
Returns the native endianity for this computer architecture.
Definition: binfile.h:105
itpp::bfstream_base::set_endianity
void set_endianity(endian e)
Set the endianity for this class.
Definition: binfile.h:110
itpp::bfstream_base::set_native_endianity
void set_native_endianity()
Set the endianity of this class to the native endianity for this computer architecture.
Definition: binfile.h:121
itpp::bfstream_base::endian
endian
Definition of the endian data type.
Definition: binfile.h:74
itpp::bfstream_base::switch_endianity
bool switch_endianity
Indicates if the endianity of the processed data needs to be changed.
Definition: binfile.h:125
itpp::bfstream_base::native_endianity
endian native_endianity
The native endianity for this computer architecture.
Definition: binfile.h:127
itpp::bfstream_base::get_endianity
endian get_endianity() const
Returns the endianity of the class.
Definition: binfile.h:88
itpp::bfstream
Binary in/out-file Class.
Definition: binfile.h:604
itpp::bfstream::~bfstream
~bfstream()
Class Destructor.
Definition: binfile.h:620
itpp::bifstream
Binary Infile Class.
Definition: binfile.h:539
itpp::bifstream::~bifstream
~bifstream()
Class Destructor.
Definition: binfile.h:555
itpp::bin
Binary arithmetic (boolean) class.
Definition: binary.h:57
itpp::binfile_details::Fstream_Binfile_Facade
Fstream Interface Facade for Binary Streams.
Definition: binfile.h:355
itpp::binfile_details::Fstream_Binfile_Facade::seekp
Fstream_Binfile_Facade & seekp(std::streamoff pos, std::ios_base::seekdir way)
Set relative position.
Definition: binfile.h:387
itpp::binfile_details::Fstream_Binfile_Facade::get
Fstream_Binfile_Facade & get(char &c)
Get single char.
Definition: binfile.h:396
itpp::binfile_details::Fstream_Binfile_Facade::good
bool good() const
This method returns true is stream state is good.
Definition: binfile.h:435
itpp::binfile_details::Fstream_Binfile_Facade::eof
bool eof() const
This method returns true if eof is reached.
Definition: binfile.h:437
itpp::binfile_details::Fstream_Binfile_Facade::putback
Fstream_Binfile_Facade & putback(char c)
This method attempts to put back single char.
Definition: binfile.h:420
itpp::binfile_details::Fstream_Binfile_Facade::get
Fstream_Binfile_Facade & get(char *s, std::streamsize n, char delim)
Get multiple chars to c-string without trailing 0.
Definition: binfile.h:401
itpp::binfile_details::Fstream_Binfile_Facade::seekg
Fstream_Binfile_Facade & seekg(std::streamoff pos, std::ios_base::seekdir way)
Set relative position.
Definition: binfile.h:431
itpp::binfile_details::Fstream_Binfile_Facade::write
Fstream_Binfile_Facade & write(const char *c, std::streamsize n)
Output multiple characters.
Definition: binfile.h:376
itpp::binfile_details::Fstream_Binfile_Facade::unget
Fstream_Binfile_Facade & unget()
Unget last extracted char.
Definition: binfile.h:423
itpp::binfile_details::Fstream_Binfile_Facade::get
int get()
Get single char.
Definition: binfile.h:394
itpp::binfile_details::Fstream_Binfile_Facade::peek
int peek()
Peak single char from the top of the buffer.
Definition: binfile.h:412
itpp::binfile_details::Fstream_Binfile_Facade::readsome
std::streamsize readsome(char *s, std::streamsize n)
Read up to n available chars from stream.
Definition: binfile.h:417
itpp::binfile_details::Fstream_Binfile_Facade::exceptions
void exceptions(std::ios_base::iostate except)
Method to set the exceptions mask.
Definition: binfile.h:458
itpp::binfile_details::Fstream_Binfile_Facade::get
Fstream_Binfile_Facade & get(char *s, std::streamsize n)
Get multiple chars to c-string and add trailing 0.
Definition: binfile.h:398
itpp::binfile_details::Fstream_Binfile_Facade::flush
Fstream_Binfile_Facade & flush()
Flushes stream buffer.
Definition: binfile.h:390
itpp::binfile_details::Fstream_Binfile_Facade::close
void close()
Method to close corresponding file.
Definition: binfile.h:373
itpp::binfile_details::Fstream_Binfile_Facade::is_open
bool is_open()
Open state.
Definition: binfile.h:367
itpp::binfile_details::Fstream_Binfile_Facade::open
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.
Definition: binfile.h:369
itpp::binfile_details::Fstream_Binfile_Facade::operator!
bool operator!() const
Unary not operator to check the stream state.
Definition: binfile.h:444
itpp::binfile_details::Fstream_Binfile_Facade::read
Fstream_Binfile_Facade & read(char *s, std::streamsize n)
Read n chars from stream.
Definition: binfile.h:414
itpp::binfile_details::Fstream_Binfile_Facade::bad
bool bad() const
This method returns true if badbit is set.
Definition: binfile.h:441
itpp::binfile_details::Fstream_Binfile_Facade::put
Fstream_Binfile_Facade & put(const char c)
Output single char.
Definition: binfile.h:379
itpp::binfile_details::Fstream_Binfile_Facade::setstate
void setstate(std::ios_base::iostate state)
Method to set the stream state (combines already set flags with flags provide by user)
Definition: binfile.h:451
itpp::binfile_details::Fstream_Binfile_Facade::gcount
std::streamsize gcount() const
Last extracted chars count.
Definition: binfile.h:392
itpp::binfile_details::Fstream_Binfile_Facade::getline
Fstream_Binfile_Facade & getline(char *s, std::streamsize n)
Get multiple chars to c-string without trailing 0.
Definition: binfile.h:404
itpp::binfile_details::Fstream_Binfile_Facade::clear
void clear(std::ios_base::iostate state=std::ios_base::goodbit)
Method to set stream state (overwrites stream state flags)
Definition: binfile.h:453
itpp::binfile_details::Fstream_Binfile_Facade::tellp
std::streampos tellp()
Get position.
Definition: binfile.h:382
itpp::binfile_details::Fstream_Binfile_Facade::seekp
Fstream_Binfile_Facade & seekp(std::streampos pos)
Set position.
Definition: binfile.h:384
itpp::binfile_details::Fstream_Binfile_Facade::seekg
Fstream_Binfile_Facade & seekg(std::streampos pos)
Set position.
Definition: binfile.h:428
itpp::binfile_details::Fstream_Binfile_Facade::fail
bool fail() const
This method returns true if either failbit or badbit is set.
Definition: binfile.h:439
itpp::binfile_details::Fstream_Binfile_Facade::rdstate
std::ios_base::iostate rdstate() const
Method to read stream state flags.
Definition: binfile.h:449
itpp::binfile_details::Fstream_Binfile_Facade::exceptions
std::ios_base::iostate exceptions() const
Method to get the exceptions mask.
Definition: binfile.h:456
itpp::binfile_details::Fstream_Binfile_Facade::ignore
Fstream_Binfile_Facade & ignore(std::streamsize n=1, int delim=EOF)
Extract and ignore chars.
Definition: binfile.h:409
itpp::binfile_details::Fstream_Binfile_Facade::tellg
std::streampos tellg()
Get position.
Definition: binfile.h:426
itpp::binfile_details::Fstream_Binfile_Facade::stream
std::fstream * stream()
Access to internal stream for derived classes.
Definition: binfile.h:464
itpp::binfile_details::Ifstream_Binfile_Facade
Ifstream Interface Facade for Binary Streams.
Definition: binfile.h:241
itpp::binfile_details::Ifstream_Binfile_Facade::operator!
bool operator!() const
Unary not operator to check the stream state.
Definition: binfile.h:313
itpp::binfile_details::Ifstream_Binfile_Facade::good
bool good() const
This method returns true is stream state is good.
Definition: binfile.h:304
itpp::binfile_details::Ifstream_Binfile_Facade::seekg
Ifstream_Binfile_Facade & seekg(std::streampos pos)
Set position.
Definition: binfile.h:297
itpp::binfile_details::Ifstream_Binfile_Facade::unget
Ifstream_Binfile_Facade & unget()
Unget last extracted char.
Definition: binfile.h:293
itpp::binfile_details::Ifstream_Binfile_Facade::rdstate
std::ios_base::iostate rdstate() const
Method to read stream state flags.
Definition: binfile.h:318
itpp::binfile_details::Ifstream_Binfile_Facade::bad
bool bad() const
This method returns true if badbit is set.
Definition: binfile.h:310
itpp::binfile_details::Ifstream_Binfile_Facade::clear
void clear(std::ios_base::iostate state=std::ios_base::goodbit)
Method to set stream state (overwrites stream state flags)
Definition: binfile.h:322
itpp::binfile_details::Ifstream_Binfile_Facade::readsome
std::streamsize readsome(char *s, std::streamsize n)
Read up to n available chars from stream.
Definition: binfile.h:287
itpp::binfile_details::Ifstream_Binfile_Facade::peek
int peek()
Peak single char from the top of the buffer.
Definition: binfile.h:282
itpp::binfile_details::Ifstream_Binfile_Facade::fail
bool fail() const
This method returns true if either failbit or badbit is set.
Definition: binfile.h:308
itpp::binfile_details::Ifstream_Binfile_Facade::stream
std::ifstream * stream()
Access to internal stream for derived classes.
Definition: binfile.h:332
itpp::binfile_details::Ifstream_Binfile_Facade::get
Ifstream_Binfile_Facade & get(char *s, std::streamsize n)
Get multiple chars to c-string and add trailing 0.
Definition: binfile.h:268
itpp::binfile_details::Ifstream_Binfile_Facade::gcount
std::streamsize gcount() const
Last extracted chars count.
Definition: binfile.h:262
itpp::binfile_details::Ifstream_Binfile_Facade::read
Ifstream_Binfile_Facade & read(char *s, std::streamsize n)
Read n chars from stream.
Definition: binfile.h:284
itpp::binfile_details::Ifstream_Binfile_Facade::open
void open(const char *filename, std::ios_base::openmode mode=std::ios_base::in|std::ios_base::binary)
Method to open corresponding file.
Definition: binfile.h:256
itpp::binfile_details::Ifstream_Binfile_Facade::ignore
Ifstream_Binfile_Facade & ignore(std::streamsize n=1, int delim=EOF)
Extract and ignore chars.
Definition: binfile.h:279
itpp::binfile_details::Ifstream_Binfile_Facade::get
Ifstream_Binfile_Facade & get(char &c)
Get single char.
Definition: binfile.h:266
itpp::binfile_details::Ifstream_Binfile_Facade::exceptions
std::ios_base::iostate exceptions() const
Method to get the exceptions mask.
Definition: binfile.h:324
itpp::binfile_details::Ifstream_Binfile_Facade::get
Ifstream_Binfile_Facade & get(char *s, std::streamsize n, char delim)
Get multiple chars to c-string without trailing 0.
Definition: binfile.h:271
itpp::binfile_details::Ifstream_Binfile_Facade::close
void close()
Method to close corresponding file.
Definition: binfile.h:260
itpp::binfile_details::Ifstream_Binfile_Facade::setstate
void setstate(std::ios_base::iostate state)
Method to set the stream state (combines already set flags with flags provide by user)
Definition: binfile.h:320
itpp::binfile_details::Ifstream_Binfile_Facade::get
int get()
Get single char.
Definition: binfile.h:264
itpp::binfile_details::Ifstream_Binfile_Facade::tellg
std::streampos tellg()
Get position.
Definition: binfile.h:295
itpp::binfile_details::Ifstream_Binfile_Facade::putback
Ifstream_Binfile_Facade & putback(char c)
This method attempts to put back single char.
Definition: binfile.h:290
itpp::binfile_details::Ifstream_Binfile_Facade::exceptions
void exceptions(std::ios_base::iostate except)
Method to set the exceptions mask.
Definition: binfile.h:326
itpp::binfile_details::Ifstream_Binfile_Facade::eof
bool eof() const
This method returns true if eof is reached.
Definition: binfile.h:306
itpp::binfile_details::Ifstream_Binfile_Facade::seekg
Ifstream_Binfile_Facade & seekg(std::streamoff pos, std::ios_base::seekdir way)
Set relative position.
Definition: binfile.h:300
itpp::binfile_details::Ifstream_Binfile_Facade::getline
Ifstream_Binfile_Facade & getline(char *s, std::streamsize n)
Get multiple chars to c-string without trailing 0.
Definition: binfile.h:274
itpp::binfile_details::Ifstream_Binfile_Facade::is_open
bool is_open()
Open state.
Definition: binfile.h:253
itpp::binfile_details::Ofstream_Binfile_Facade
Ofstream Interface Facade for Binary Streams.
Definition: binfile.h:151
itpp::binfile_details::Ofstream_Binfile_Facade::operator!
bool operator!() const
Unary not operator to check the stream state.
Definition: binfile.h:200
itpp::binfile_details::Ofstream_Binfile_Facade::tellp
std::streampos tellp()
Get position.
Definition: binfile.h:178
itpp::binfile_details::Ofstream_Binfile_Facade::is_open
bool is_open()
Open state.
Definition: binfile.h:163
itpp::binfile_details::Ofstream_Binfile_Facade::eof
bool eof() const
This method returns true if eof is reached.
Definition: binfile.h:193
itpp::binfile_details::Ofstream_Binfile_Facade::exceptions
std::ios_base::iostate exceptions() const
Method to get the exceptions mask.
Definition: binfile.h:211
itpp::binfile_details::Ofstream_Binfile_Facade::exceptions
void exceptions(std::ios_base::iostate except)
Method to set the exceptions mask.
Definition: binfile.h:213
itpp::binfile_details::Ofstream_Binfile_Facade::bad
bool bad() const
This method returns true if badbit is set.
Definition: binfile.h:197
itpp::binfile_details::Ofstream_Binfile_Facade::seekp
Ofstream_Binfile_Facade & seekp(std::streamoff pos, std::ios_base::seekdir way)
Set relative position.
Definition: binfile.h:184
itpp::binfile_details::Ofstream_Binfile_Facade::seekp
Ofstream_Binfile_Facade & seekp(std::streampos pos)
Set position.
Definition: binfile.h:181
itpp::binfile_details::Ofstream_Binfile_Facade::rdstate
std::ios_base::iostate rdstate() const
Method to read stream state flags.
Definition: binfile.h:205
itpp::binfile_details::Ofstream_Binfile_Facade::fail
bool fail() const
This method returns true if either failbit or badbit is set.
Definition: binfile.h:195
itpp::binfile_details::Ofstream_Binfile_Facade::clear
void clear(std::ios_base::iostate state=std::ios_base::goodbit)
Method to set stream state (overwrites stream state flags)
Definition: binfile.h:209
itpp::binfile_details::Ofstream_Binfile_Facade::close
void close()
Method to close corresponding file.
Definition: binfile.h:169
itpp::binfile_details::Ofstream_Binfile_Facade::good
bool good() const
This method returns true is stream state is good.
Definition: binfile.h:191
itpp::binfile_details::Ofstream_Binfile_Facade::flush
Ofstream_Binfile_Facade & flush()
Flushes stream buffer.
Definition: binfile.h:187
itpp::binfile_details::Ofstream_Binfile_Facade::put
Ofstream_Binfile_Facade & put(const char c)
Output single char.
Definition: binfile.h:175
itpp::binfile_details::Ofstream_Binfile_Facade::stream
std::ofstream * stream()
Access to internal stream for derived classes.
Definition: binfile.h:219
itpp::binfile_details::Ofstream_Binfile_Facade::setstate
void setstate(std::ios_base::iostate state)
Method to set the stream state (combines already set flags with flags provide by user)
Definition: binfile.h:207
itpp::binfile_details::Ofstream_Binfile_Facade::open
void open(const char *filename, std::ios_base::openmode mode=std::ios_base::out|std::ios_base::binary)
Method to open corresponding file.
Definition: binfile.h:165
itpp::binfile_details::Ofstream_Binfile_Facade::write
Ofstream_Binfile_Facade & write(const char *c, std::streamsize n)
Output multiple characters.
Definition: binfile.h:172
itpp::bofstream
Binary Outfile Class.
Definition: binfile.h:475
itpp::bofstream::~bofstream
~bofstream()
Class Destructor.
Definition: binfile.h:492
itpp::exist
bool exist(const std::string &name)
Checks if a file named name already exists on the disk.
Definition: binfile.cpp:98
itpp::length
int length(const Vec< T > &v)
Length of vector.
Definition: matfunc.h:51
ittypes.h
IT++ type definitions.
itpp
itpp namespace
Definition: itmex.h:37
itpp::operator<<
std::ostream & operator<<(std::ostream &output, const bin &inbin)
Output stream of bin.
Definition: binary.cpp:36
itpp::operator>>
std::istream & operator>>(std::istream &input, bin &outbin)
Input stream of bin.
Definition: binary.cpp:42

Generated on Tue Aug 17 2021 10:59:15 for IT++ by Doxygen 1.9.1