33 #include <boost/iostreams/filtering_stream.hpp> 
   34 #include <boost/iostreams/filter/gzip.hpp> 
   35 #include <boost/iostreams/device/file_descriptor.hpp> 
   36 #include <boost/iostreams/copy.hpp> 
   39 using namespace pwiz::util;
 
   41 using namespace pwiz::data;
 
   42 using namespace pwiz::msdata;
 
   55     if (!sfs.empty()) sfs.erase(sfs.end()-1);
 
   57     if (!sws.empty()) sws.erase(sws.end()-1);
 
   70     if (
os_) *
os_ << 
"validateWriteRead()\n  " << writeConfig << endl; 
 
   93             std::vector< boost::shared_ptr< MSDataFile > > msds; 
 
   94             for (
int i=0;i<100;i++) 
 
   96                 boost::shared_ptr<MSDataFile> msd1(
new MSDataFile(filename1));
 
  109         if (diff && 
os_) *
os_ << diff << endl;
 
  113         msd1.
write(filename2, writeConfig);
 
  121         if (diff && 
os_) *
os_ << diff << endl;
 
  125         bio::filtering_istream tinyGZ(bio::gzip_compressor() | bio::file_descriptor_source(filename1));
 
  126         bio::copy(tinyGZ, bio::file_descriptor_sink(filename1+
".gz", ios::out|ios::binary));
 
  133         if (diff && 
os_) *
os_ << diff << endl;
 
  138         msd1.
write(oss, writeConfig);
 
  139         string ossStr = oss.str();
 
  140         ofstream ofs(filename3.c_str());
 
  141         ofs.write(ossStr.c_str(), ossStr.length());
 
  150         if (diff && 
os_) *
os_ << diff << endl;
 
  155     boost::filesystem::remove(filename1);
 
  156     boost::filesystem::remove(filename2);
 
  157     boost::filesystem::remove(filename1 + 
".gz");
 
  158     boost::filesystem::remove(filename3);
 
  216     'F', 
'\0', 
'i', 
'\0', 
'n', 
'\0', 
'n', 
'\0', 
 
  217     'i', 
'\0', 
'g', 
'\0', 
'a', 
'\0', 
'n', 
'\0'};
 
  226     virtual std::string identify(
const std::string& filename, 
const std::string& head)
 const 
  228         if (filename.size()<=4 || filename.substr(filename.size()-4)!=
".RAW")
 
  229             return std::string(
"");
 
  233             return std::string(
"");
 
  239     virtual void read(
const std::string& filename, 
const std::string& head, 
MSData& result, 
int runIndex = 0,
 
  240                       const Config& config = Config())
 const 
  245     virtual void read(
const std::string& filename,
 
  246                       const std::string& head,
 
  247                       std::vector<MSDataPtr>& results,
 
  248                       const Config& config = Config())
 const 
  251         read(filename, head, *results.back(), 0, config);
 
  254     const char *
getType()
 const {
return "testReader";} 
 
  264     ofstream os(filename.c_str());
 
  276     boost::filesystem::remove(filename);
 
  284     if (
os_) *
os_ << 
"testSHA1()\n";
 
  299             *
os_ << 
"no SHA-1:\n";
 
  313             *
os_ << 
"with SHA-1:\n";
 
  315             IO::write(writer, *msd_sha1.fileDescription.sourceFilePtrs.back());
 
  318         unit_assert(!msd_sha1.fileDescription.sourceFilePtrs.empty());
 
  324     boost::filesystem::remove(filename);
 
  329 int main(
int argc, 
char* argv[])
 
  335         if (argc>1 && !strcmp(argv[1],
"-v")) 
os_ = &cout;