Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
util.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 // :noTabs=false:tabSize=4:indentSize=4:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available under license.
7 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
8 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
9 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
10 
11 /// @file core/io/silent/util.cc
12 /// @brief utility functions for silent-file classes.
13 /// @author James Thompson
14 
15 // C++ Headers
16 #include <string>
17 
18 // mini headers
19 #include <basic/Tracer.hh>
20 
21 #include <utility/io/izstream.hh>
22 // AUTO-REMOVED #include <utility/io/ozstream.hh>
23 #include <utility/file/gzip_util.hh>
24 
25 // option key includes
26 
27 #include <basic/options/option.hh>
28 #include <basic/options/keys/out.OptionKeys.gen.hh>
29 
30 #include <utility/vector1.hh>
31 
32 
33 namespace core {
34 namespace io {
35 namespace silent {
36 
37 static basic::Tracer tr("core.io.silent");
38 
39 void
40 gzip() {
41  using basic::options::option;
42  using namespace basic::options::OptionKeys;
43  // gzip output file if desired
44  std::string const basename = option[ out::file::silent ]();
45  if ( option[ out::silent_gz ]() ) {
47  file_list.push_back( basename );
48 
50  fn = file_list.begin(), end = file_list.end(); fn != end; ++fn
51  ) {
52  utility::io::izstream in_stream( *fn );
53  if ( in_stream ) {
54  in_stream.close();
55  in_stream.clear();
56  tr.Info << "GZIP SILENT FILE: " << *fn << std::endl;
57  utility::file::gzip( *fn, true );
58  } // file exists
59  } // loop over each file
60  } // if ( option[ out::silent_gz ]() )
61 } // gzip
62 
63 } // namespace silent
64 } // namespace io
65 } // namespace core