Rosetta
|
izstream: Input file stream wrapper for uncompressed and compressed files More...
#include <izstream.hh>
Public Member Functions | |
izstream () | |
Default constructor. More... | |
izstream (std::string const &filename_a, std::ios_base::openmode open_mode=std::ios_base::in) | |
Filename constructor. More... | |
~izstream () override | |
Destructor. More... | |
operator bool () const override | |
bool conversion More... | |
operator std::istream const & () const override | |
Stream conversion. More... | |
operator std::istream & () override | |
Stream conversion. More... | |
template<typename T > | |
std::istream & | operator>> (T &t) |
Stream input. More... | |
std::istream & | operator>> (manipulator m) |
Stream manipulator input. More... | |
std::istream & | operator>> (std_manipulator m) override |
Stream manipulator input. More... | |
void | open (std::string const &filename_a, std::ios_base::openmode open_mode=std::ios_base::in) |
Open a file. More... | |
void | clear () override |
Clear the stream(s) More... | |
void | close () |
Close the ifstream and reset the state. More... | |
void | seek_beg () override |
Seek to the beginning. More... | |
int | get () override |
Get the next character. More... | |
izstream & | get (char &c) override |
Get the next character. More... | |
izstream & | get (char *str, std::streamsize const count) override |
Get the next specified number of characters. More... | |
izstream & | get (char *str, std::streamsize const count, char const delim) override |
Get the next specified number of characters. More... | |
izstream & | get (std::string &str, std::streamsize const count) override |
Get the next specified number of characters. More... | |
izstream & | get (std::string &str, std::streamsize const count, char const delim) override |
Get the next specified number of characters. More... | |
izstream & | getline (char *line, std::streamsize const count) override |
Get the rest of the line. More... | |
izstream & | getline (char *line, std::streamsize const count, char const delim) override |
Get the rest of the line. More... | |
izstream & | getline (std::string &line) override |
Get the rest of the line. More... | |
izstream & | getline (std::string &line, char const delim) override |
Get the rest of the line. More... | |
izstream & | read (char *str, std::streamsize const count) override |
Read the next specified number of characters. More... | |
izstream & | read (std::string &str, std::streamsize const count) override |
Read the next specified number of characters. More... | |
std::streamsize | readsome (char *str, std::streamsize const count) override |
Read the next available specified number of characters. More... | |
std::streamsize | readsome (std::string &str, std::streamsize const count) override |
Read the next available specified number of characters. More... | |
izstream & | ignore () override |
Skip over the next character. More... | |
izstream & | ignore (std::streamsize const count) override |
Skip over the next specified number of characters. More... | |
izstream & | ignore (std::streamsize const count, char const delim) override |
Skip over the next specified number of characters. More... | |
int | peek () override |
Returns the next character without extracting it. More... | |
izstream & | unget () override |
Put the last character read back into the stream. More... | |
izstream & | putback (char c) override |
Put the last character read back into the stream and check that passed character is correct. More... | |
std::istream const & | operator() () const override |
Stream access. More... | |
std::istream & | operator() () override |
Stream access. More... | |
std::istream const & | stream () const override |
Stream access. More... | |
std::istream & | stream () override |
Stream access. More... | |
std::streambuf * | rdbuf () const override |
Pointer to the stream buffer. More... | |
std::string const & | filename () const |
File name. More... | |
std::streamsize | gcount () const |
Get the number of characters read by the last unformatted read. More... | |
bool | good () const override |
Good? More... | |
bool | eof () const override |
End of file? More... | |
bool | fail () const override |
Fail? More... | |
bool | bad () const override |
Bad? More... | |
bool | compressed () const override |
Compressed? More... | |
bool | uncompressed () const override |
Uncompressed? More... | |
bool | gzipped () const override |
gzipped? More... | |
![]() | |
virtual | ~irstream () |
Destructor. More... | |
template<typename T > | |
irstream & | operator>> (T &t) |
Stream input. More... | |
Static Public Member Functions | |
static void | set_alternative_search_paths (vector1< std::string > alternative_search_paths) |
static vector1< std::string > | get_alternative_search_paths () |
Private Types | |
enum | Compression { NONE , UNCOMPRESSED , GZIP } |
typedef std::istream &(* | manipulator) (izstream &) |
typedef std::istream &(* | std_manipulator) (std::istream &) |
Private Member Functions | |
bool | is_gzip () const |
Is stream attached to a gzip file? More... | |
bool | check_crc () const |
CRC of gzip file valid? More... | |
long | get_crc () const |
CRC of the uncompressed data (see zipstream documentation) More... | |
long | get_in_size () const |
Compressed data size. More... | |
long | get_out_size () const |
Uncompressed data size. More... | |
void | open_ifstream (std::string const &name, std::ios_base::openmode open_mode) |
Helper function for opening files with alternative search paths. More... | |
Private Attributes | |
Compression | compression_ |
Compression state. More... | |
std::ifstream | if_stream_ |
File stream. More... | |
std::string | filename_ |
File name. More... | |
zlib_stream::zip_istream * | zip_stream_p_ |
Zip file stream pointer (owning) More... | |
Static Private Attributes | |
static vector1< std::string > | alternative_search_paths_ |
Alternative search paths This initialized by the option system -in:path:path Notice that izstream cannot access the option system (because the utility library comes before the basic library), so setting the alternate search paths is it the responsibility of core::init::init() More... | |
Friends | |
long | utility::file::gzip (std::string const &uncompressedfile, bool overwrite) |
long | utility::file::gunzip (std::string const &compressedfile, bool overwrite) |
Additional Inherited Members | |
![]() | |
typedef std::istream &(* | std_manipulator) (std::istream &) |
![]() | |
irstream ()=default | |
Default constructor. More... | |
izstream: Input file stream wrapper for uncompressed and compressed files
|
private |
|
private |
|
private |
|
inline |
Default constructor.
|
inlineexplicit |
Filename constructor.
References open().
|
inlineoverride |
Destructor.
References if_stream_, and zip_stream_p_.
|
inlineoverridevirtual |
|
inlineprivate |
CRC of gzip file valid?
References zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::check_crc(), and zip_stream_p_.
|
inlineoverridevirtual |
Clear the stream(s)
Implements utility::io::irstream.
References if_stream_, and zip_stream_p_.
Referenced by pyrosetta.bindings.pose.ResidueLabelAccessor::discard(), and basic::database::open().
|
inline |
Close the ifstream and reset the state.
References compression_, filename_, if_stream_, NONE, and zip_stream_p_.
Referenced by pyrosetta.distributed.utility.log.LoggingContext::__exit__(), ez_setup.ContextualZipFile::__exit__(), PyMOL-Rosetta-relay-client.SecretInputDialog::__init__(), InterfaceStrandFinderMover::apply(), utility::file_contents(), get_sc(), utility::options::OptionCollection::load_option_from_file(), main(), open(), basic::database::open(), read_rama_map_file(), read_sphere(), numeric::read_tensor_from_file(), basic::sampling::orientations::QuaternionGridManager::request_by_name(), run(), scheme_score(), setup_activity_table(), sphere_coverage(), SphereSampler::SphereSampler(), basic::options::start_files(), PyMOL-Rosetta-relay-client.SecretInputDialog::start_server(), and symmetrize_map().
|
inlineoverridevirtual |
Compressed?
Implements utility::io::irstream.
References compression_, and GZIP.
Referenced by pyrosetta.distributed.cluster.io.IO::_save_results().
|
inlineoverridevirtual |
End of file?
Implements utility::io::irstream.
References stream().
Referenced by calculate_total_hASA_within_distance_avg_values(), calculate_total_hASA_within_distance_avgresiduevalues_allnbs_conditionalonnumnbs(), main(), read_rama_map_file(), setup_activity_table(), and symmetrize_map().
|
inlineoverridevirtual |
Fail?
Implements utility::io::irstream.
References stream().
Referenced by read_alignment_fasta_file(), read_embeddings(), read_in_extension(), read_membrane(), read_parameters(), and read_penalties().
|
inline |
File name.
References filename_.
Referenced by pyrosetta.io.silent_file_map.SilentFileMap::write_file().
|
inline |
Get the number of characters read by the last unformatted read.
References stream().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Get the next character.
Implements utility::io::irstream.
References kmeans_adaptive_kernel_density_bb_dependent_rotlib::c, and stream().
|
inlineoverridevirtual |
Get the next specified number of characters.
Implements utility::io::irstream.
|
inlineoverridevirtual |
Get the next specified number of characters.
Implements utility::io::irstream.
|
inlineoverridevirtual |
Get the next specified number of characters.
Implements utility::io::irstream.
References count, basic::options::OptionKeys::cp::cp, str(), and stream().
|
inlineoverridevirtual |
Get the next specified number of characters.
Implements utility::io::irstream.
References count, basic::options::OptionKeys::cp::cp, str(), and stream().
|
inlinestatic |
References alternative_search_paths_.
Referenced by basic::resource_manager::locator::FileStream::FileStream().
|
inlineprivate |
CRC of the uncompressed data (see zipstream documentation)
References zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::get_crc(), and zip_stream_p_.
|
inlineprivate |
Compressed data size.
References zlib_stream::basic_zip_istreambase< Elem, Tr, ElemA, ByteT, ByteAT >::get_in_size(), and zip_stream_p_.
|
inlineprivate |
Uncompressed data size.
References zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::get_out_size(), and zip_stream_p_.
|
inlineoverridevirtual |
Get the rest of the line.
Implements utility::io::irstream.
References count, line, and stream().
Referenced by InterfaceStrandFinderMover::apply(), InterfaceDDGBindJobInputter::fill_jobs(), main(), read_rama_map_file(), basic::options::start_files(), and symmetrize_map().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Get the rest of the line.
Implements utility::io::irstream.
|
inlineoverridevirtual |
Get the rest of the line.
Implements utility::io::irstream.
|
inlineoverridevirtual |
Good?
Implements utility::io::irstream.
References stream().
Referenced by protocols::abinitio::JumpSpecificAbrelax::add_constraints(), InterfaceStrandFinderMover::apply(), compute_intrinsic_deviation(), InterfaceDDGBindJobInputter::fill_jobs(), basic::database::find_database_path(), main(), basic::database::open(), read_rama_map_file(), recover_clustered_frags(), CloudArchiveManagerWrapper::restore_batchlist(), protocols::abinitio::JumpSpecificAbrelax::setup_jumps(), SphereSampler::SphereSampler(), basic::options::start_files(), symmetrize_map(), and write_cluster_frags().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Skip over the next character.
Implements utility::io::irstream.
References stream().
Referenced by utility::io::skip().
|
inlineoverridevirtual |
Skip over the next specified number of characters.
Implements utility::io::irstream.
|
inlineoverridevirtual |
Skip over the next specified number of characters.
Implements utility::io::irstream.
|
inlineprivate |
Is stream attached to a gzip file?
References zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::is_gzip(), and zip_stream_p_.
void utility::io::izstream::open | ( | std::string const & | filename_a, |
std::ios_base::openmode | open_mode = std::ios_base::in |
||
) |
Open a file.
References job_manager::app, utility::io::oc::cerr, close(), compression_, utility::file::file_extension(), utility::SingletonBase< Inline_File_Provider >::get_instance(), utility::Inline_File_Provider::get_istream(), GZIP, if_stream_, basic::options::OptionKeys::in::in, zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::is_gzip(), NONE, open_ifstream(), erraser_single_res_analysis::out, utility::file::trytry_ifstream_open(), UNCOMPRESSED, and zip_stream_p_.
Referenced by compute_intrinsic_deviation(), izstream(), main(), basic::resource_manager::locator::FileStream::open(), basic::database::open(), myspace::read_input(), read_rama_map_file(), recover_clustered_frags(), setup_activity_table(), symmetrize_map(), and write_cluster_frags().
|
private |
Helper function for opening files with alternative search paths.
References alternative_search_paths_, filename_, create_a3b_hbs::i, if_stream_, basic::options::OptionKeys::in::in, platform::file::PATH_SEPARATOR(), and utility::file::trytry_ifstream_open().
Referenced by open().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inline |
Stream manipulator input.
References kmeans_adaptive_kernel_density_bb_dependent_rotlib::m.
|
inlineoverridevirtual |
Stream manipulator input.
Implements utility::io::irstream.
References kmeans_adaptive_kernel_density_bb_dependent_rotlib::m.
|
inline |
Stream input.
References stream(), and predPRE::t.
|
inlineoverridevirtual |
Returns the next character without extracting it.
Implements utility::io::irstream.
References stream().
|
inlineoverridevirtual |
Put the last character read back into the stream and check that passed character is correct.
Implements utility::io::irstream.
References kmeans_adaptive_kernel_density_bb_dependent_rotlib::c, and stream().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Read the next specified number of characters.
Implements utility::io::irstream.
References count, str(), and stream().
Referenced by numeric::read_tensor_from_file().
|
inlineoverridevirtual |
Read the next specified number of characters.
Implements utility::io::irstream.
References count, basic::options::OptionKeys::cp::cp, str(), and stream().
|
inlineoverridevirtual |
Read the next available specified number of characters.
Implements utility::io::irstream.
|
inlineoverridevirtual |
Read the next available specified number of characters.
Implements utility::io::irstream.
References count, basic::options::OptionKeys::cp::cp, str(), and stream().
|
inlineoverridevirtual |
Seek to the beginning.
Implements utility::io::irstream.
References if_stream_, zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::is_gzip(), and zip_stream_p_.
|
inlinestatic |
References alternative_search_paths_.
|
inlineoverridevirtual |
Stream access.
Implements utility::io::irstream.
References if_stream_, and zip_stream_p_.
Referenced by bad(), eof(), fail(), gcount(), get(), getline(), good(), ignore(), operator>>(), peek(), putback(), rdbuf(), read(), readsome(), and unget().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Put the last character read back into the stream.
Implements utility::io::irstream.
References stream().
|
friend |
|
friend |
|
staticprivate |
Alternative search paths This initialized by the option system -in:path:path Notice that izstream cannot access the option system (because the utility library comes before the basic library), so setting the alternate search paths is it the responsibility of core::init::init()
Referenced by get_alternative_search_paths(), open_ifstream(), and set_alternative_search_paths().
|
private |
Compression state.
Referenced by close(), compressed(), gzipped(), open(), and uncompressed().
|
private |
File name.
Referenced by close(), filename(), and open_ifstream().
|
private |
File stream.
Referenced by clear(), close(), open(), open_ifstream(), operator bool(), operator std::istream &(), operator std::istream const &(), operator()(), seek_beg(), stream(), and ~izstream().
|
private |
Zip file stream pointer (owning)
Referenced by check_crc(), clear(), close(), get_crc(), get_in_size(), get_out_size(), is_gzip(), open(), operator bool(), operator std::istream &(), operator std::istream const &(), operator()(), seek_beg(), stream(), and ~izstream().