Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
QuotaPool.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/QuotaPool.hh
11 /// @brief provides a single pool used by quota
12 /// @detailed a QuotaSelector is constructed with a few pools. At fragment selection procedure
13 /// it tries to fit each fragment candidate into the pools by a round robin procedure
14 /// @author Dominik Gront (dgront@chem.uw.edu.pl)
15 
16 #ifndef INCLUDED_protocols_frag_picker_quota_QuotaPool_hh
17 #define INCLUDED_protocols_frag_picker_quota_QuotaPool_hh
18 
21 
22 // package headers
25 
26 // utility headers
27 #include <core/types.hh>
28 #include <utility/vector1.hh>
29 
30 // C++ headers
31 #include <string>
32 
33 namespace protocols {
34 namespace frag_picker {
35 namespace quota {
36 
37 /// @brief represents a single pool used by quota selector
39 public:
40  /// @brief Creates a pool of a given size and name
41  /// @param name - name assigned to this pool. This in general may be any string that
42  /// later allows one control pool's behavior from a flag file
43  QuotaPool(std::string pool_name,Real quota_fraction) {
44  pool_name_ = pool_name;
45  quota_fraction_ = quota_fraction;
46  }
47 
48  virtual ~QuotaPool() {};
49 
50  virtual bool could_be_accepted(ScoredCandidate) const = 0;
51 
52  /// @brief Says how many fragments (in total) may fit into this pool
53  virtual Size total_size() const = 0;
54 
55  /// @brief Says how many fragments are currently in this pool
56  virtual Size current_size() const = 0;
57 
58  /// @brief Says how many fragments can still be inserted into this pool
59  virtual Size size_left() const = 0;
60 
61  /// @brief Makes the pool empty by removing all candidates
62  virtual void clear() = 0;
63 
64  /// @brief Push a fragment candidate into the pool container
65  virtual void push(ScoredCandidate) = 0;
66 
67  /// @brief Check how many candidates have been already collected for a given position
68  /// @detailed This is a very special case - collector will be used only for a given position.
69  /// Thus it returns the total number of inserted candidates, as count_candidates() does
70  virtual Size count_candidates() const = 0;
71 
72  /// @brief returns the name assigned to this quota pool
73  inline
74  std::string const &
75  get_pool_name() const {
76  return pool_name_;
77  }
78 
79  /// @brief prints information on which fragments can be accepted by this pool and how many of them
80  /// @detailed base class' impementation says the capacity that has left
81  virtual void show_availability(std::ostream & where) const {
82  where << pool_name_<<" : "<< size_left()<<std::endl;
83  }
84 
85  /// @brief returns the fraction of this quota pool in the entire population of fragments
86  Real get_fraction() const { return quota_fraction_; }
87 
88  /// @brief Sets the fraction of this quota pool in the entire population of fragments
89  virtual void set_fraction(Real new_fraction) { quota_fraction_ = new_fraction; }
90 
91  /// @brief provides the score for a candidate that was used to sort a quota pool
92  /// @detailed This base class returns the most recent total score for a fragment
93  inline virtual Real quota_score(ScoredCandidate candidate) const {
94  return candidate.second->get_most_recent_total_score();
95  }
96 private:
99 };
100 
101 } // quota
102 } // frag_picker
103 } // protocols
104 
105 
106 #endif /* INCLUDED_protocols_frag_picker_quota_QuotaPool_HH */