Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UpstreamHitCacher.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 // :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 protocols/match/output/UpstreamHitCacher.hh
12 /// @brief Declaration for class to cache and recall the conformations of upstream hits.
13 /// @author Alex Zanghellini (zanghell@u.washington.edu)
14 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com), porting to mini
15 
16 #ifndef INCLUDED_protocols_match_output_UpstreamHitCacher_hh
17 #define INCLUDED_protocols_match_output_UpstreamHitCacher_hh
18 
19 // Unit headers
21 
22 // Package headers
26 
27 // Utility headers
28 #include <utility/pointer/ReferenceCount.hh>
29 #ifdef WIN32
30 #include <utility/OrderedTuple.hh>
31 #include <utility/vector1.hh>
32 #endif
33 
34 // C++ headers
35 #include <map>
36 
37 #include <utility/OrderedTuple.fwd.hh>
38 #include <utility/vector1_bool.hh>
39 
40 
41 namespace protocols {
42 namespace match {
43 namespace output {
44 
46 public:
47 
48  typedef utility::fixedsizearray1< Size, 2 > ScaffoldRotamerPair;
49  typedef utility::OrderedTuple< ScaffoldRotamerPair > ScaffoldRotamerTuple;
50 
51 public:
52  UpstreamHitCacher( MatcherCOP matcher );
53  virtual ~UpstreamHitCacher();
54 
55  void
56  set_cache_size( Size n_rotamers_to_cache );
57 
59  upstream_conformation_for_hit( Size geometric_constraint_id, Hit const & hit );
60 
61 public:
62 
63  /// @brief The method by which the UpstreamHitCacher communicates with the UpstreamBuilders.
64  /// CAUTION: this class should not be handed to an UpstreamBuilder directly. It should only
65  /// hand itself to an UpstreamBuilder. Ask the UpstreamHitCacher for a particular hit, and it
66  /// will call recover_rotamer() on the upstream builder; it's doing bookkeeping in the background
67  /// and that bookkeeping is important for the success of this function.
68  virtual
69  void
71  Hit const & hit,
72  core::conformation::Residue const & upstream_conformation
73  );
74 
75 
76 private:
77 
78  /// @brief Allocate space in the arrays dependent on n_geometric_constraints_ and
79  /// n_confs_to_cache_.
80  void
81  resize_arrays();
82 
83  /// @brief Returns 0 if the scaffold/rotamer pair is not already in the queue, and
84  /// the non-zero index in the queue if it is.
85  Size
86  already_in_queue( Size cst_id, ScaffoldRotamerTuple const & rotid ) const;
87 
88  /// @brief Construct the rotamer for the requested scaffold/rotamer pair and
89  /// put it into the queue, evicting the previous queue resident if necessary.
90  Size
91  fetch( Size cst_id, ScaffoldRotamerTuple const & rotid );
92 
93 private:
95 
98 
100 
102 
106 
107 };
108 
109 }
110 }
111 }
112 
113 #endif