Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
QuotaConfig.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 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file protocols/frag_picker/quota/QuotaConfig.hh
11 /// @brief Reads a config file for quota selector
12 /// @author Dominik Gront (dgront@chem.uw.edu.pl)
13 
15 
16 // utility headers
17 #include <core/types.hh>
18 #include <basic/Tracer.hh>
19 #include <utility/io/izstream.hh>
20 #include <utility/exit.hh>
21 
22 #include <utility/vector1.hh>
23 
24 
25 namespace protocols {
26 namespace frag_picker {
27 namespace quota {
28 
29 using namespace core;
30 
31 static basic::Tracer trQuotaConfig(
32  "protocols.frag_picker.quota.QuotaConfig");
33 
35 
36  utility::io::izstream data(file_name.c_str());
37  trQuotaConfig.Info << "reading quota config from " << file_name << std::endl;
38  if (!data)
39  utility_exit_with_message("[ERROR] Unable to open quota config file: "
40  + file_name);
41  std::string line;
42  Size pool_id;
43  Real fraction;
44  std::string pool_name;
45  while (data) {
46  getline(data, line);
47  if(line[0]=='#') continue;
48  if (line.length() > 7) {
49  std::istringstream line_stream(line);
50  line_stream >> pool_id >> pool_name >> fraction;
51  pool_names_.push_back( pool_name );
52  pool_weights_.push_back( fraction );
53  }
54  }
55  data.close();
56 }
57 
58 } // quota
59 } // frag_picker
60 } // protocols
61