Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
QuotaConfig.hh
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/QuotaSelector.hh
11 /// @brief provides a selector that picks best fragments based on their total score
12 /// @author Dominik Gront (dgront@chem.uw.edu.pl)
13 
14 #ifndef INCLUDED_protocols_frag_picker_quota_QuotaConfig_hh
15 #define INCLUDED_protocols_frag_picker_quota_QuotaConfig_hh
16 
17 // utility headers
18 #include <core/types.hh>
19 #include <utility/vector1.hh>
20 
21 // C++ headers
22 // AUTO-REMOVED #include <map>
23 #include <string>
24 
25 namespace protocols {
26 namespace frag_picker {
27 namespace quota {
28 
29 using namespace core;
30 
31 /// @brief read a config file for quota selector
32 class QuotaConfig {
33 public:
34 
35  /// @brief Constructor reads a config file
36  QuotaConfig(std::string config_file_name);
37 
38  /// @brief Constructor used by derived classes
40 
41  /// @brief how many pools have been defined in a config file
42  inline Size count_pools() { return pool_names_.size(); }
43 
44  /// @brief returns a fraction for a given pool
45  inline Real get_fraction(Size pool_id) { return pool_weights_[pool_id]; }
46 
47  /// @brief returns a fraction for a given pool
48  inline void set_fraction(Size pool_id,Real fraction) { pool_weights_[pool_id] = fraction; }
49 
50  /// @brief returns a fraction for a given pool
51  /// @detailed if the given string is not a valid name of a quota pool,
52  /// the method returns 0
53  inline Real get_fraction(std::string pool_name) {
54 
55  for(Size i=1;i<=pool_names_.size(); ++i ) {
56  if(pool_names_[i].compare(pool_name) == 0 )
57  return pool_weights_[i];
58  }
59 
60  return 0;
61  }
62 
63  /// @brief returns true if a config file defined a given pool name
65 
66  for(Size i=1;i<=pool_names_.size(); ++i ) {
67  if(pool_names_[i].compare(pool_name) == 0 )
68  return true;
69  }
70 
71  return false;
72  }
73 
74  /// @brief return a string id (name) assigned to a given pool
75  inline std::string & get_pool_name(Size pool_id) { return pool_names_[pool_id]; }
76 
77 protected:
80 };
81 
82 } // quota
83 } // frag_picker
84 } // protocols
85 
86 
87 #endif /* INCLUDED_protocols_frag_picker_quota_QuotaConfig_HH */