BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
anonymous_namespace{OutputDataReader.cpp} Namespace Reference

Functions

std::stringstream getFromFilteredStream (std::istream &input_stream, const std::string &fname)
 

Function Documentation

◆ getFromFilteredStream()

std::stringstream anonymous_namespace{OutputDataReader.cpp}::getFromFilteredStream ( std::istream &  input_stream,
const std::string &  fname 
)

Definition at line 34 of file OutputDataReader.cpp.

35 {
36  boost::iostreams::filtering_streambuf<boost::iostreams::input> input_filtered;
37  if (DataFormatUtils::isGZipped(fname))
38  input_filtered.push(boost::iostreams::gzip_decompressor());
39  else if (DataFormatUtils::isBZipped(fname))
40  input_filtered.push(boost::iostreams::bzip2_decompressor());
41  input_filtered.push(input_stream);
42  // we use stringstream since it provides random access which is important for tiff files
43  std::stringstream ret;
44  boost::iostreams::copy(input_filtered, ret);
45  return ret;
46 }
bool isBZipped(const std::string &name)
Returns true if name contains *.bz2 extension.
bool isGZipped(const std::string &name)
Returns true if name contains *.gz extension.

References DataFormatUtils::isBZipped(), and DataFormatUtils::isGZipped().

Referenced by OutputDataReader::getOutputData().

Here is the call graph for this function: