Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PoseMetricContainer.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 core/pose/metrics/PoseMetricContainer.hh
11 /// @brief container for managing PoseMetricCalculators
12 /// @author John Karanicolas
13 
14 
15 #ifndef INCLUDED_core_pose_metrics_PoseMetricContainer_hh
16 #define INCLUDED_core_pose_metrics_PoseMetricContainer_hh
17 
18 
19 // unit headers
21 
22 // package headers
23 #include <core/pose/Pose.fwd.hh>
27 #include <basic/MetricValue.fwd.hh>
28 
29 // Utility Headers
30 #include <utility/pointer/ReferenceCount.hh>
31 #include <utility/pointer/owning_ptr.hh>
32 
33 // C++ Headers
34 #include <map>
35 #include <iostream>
36 
37 #include <utility/vector1.hh>
38 
39 
40 
41 
42 namespace core {
43 namespace pose {
44 namespace metrics {
45 
46 
47 /// @brief container for managing PoseMetricCalculators
48 /// @details Attaches to a Pose and listens to Pose signals.
49 /// It then notifies stored PoseMetricCalculators to recalculate as-needed.
51 
52 
53 private: // typedefs
54 
55  typedef std::map< std::string, PoseMetricCalculatorOP > Name2Calculator;
56 
57 
58 public: // construct/destruct
59 
60 
61  /// @brief default destructor
63 
64 
65  /// @brief copy constructor
66  /// @warning observation of subject Pose in src not duplicated
68 
69 
70  /// @brief default destructor
71  virtual ~PoseMetricContainer();
72 
73 
74  /// @brief copy assignment
75  /// @warning container keeps observing whatever Pose it was originally observing
77 
78 
79 public: // calculator management
80 
81 
82  /// @brief clear the list of metric calculators, reset flags
83  void clear();
84 
85 
86  /// @brief get a value out of a PoseMetricCalculator
87  // TODO: should we really be passing a Pose pointer in...? Consider using the internal pose_ptr_;
88  void get( std::string const & calculator_name, std::string const & key, basic::MetricValueBase & val, Pose const & this_pose );
89 
90 
91  /// @brief return a string with the results of a PoseMetricCalculator
92  std::string print( std::string const & calculator_name, std::string const & key, Pose const & this_pose );
93 
94 
95 public: // observer interface
96 
97 
98  /// @brief attach to a Pose
99  void attach_to( core::pose::Pose & pose );
100 
101 
102  /// @brief detach from Pose
103  void detach_from();
104 
105 
106  /// @brief is observing a Pose?
107  /// @return the Pose if observing, otherwise NULL
108  Pose const * is_observing();
109 
110 
111  /// @brief upon receiving a pose::signals::DestructionEvent, detaches
113 
114 
115  /// @brief upon receiving a pose:signals::EnergyEvent, sets flag telling
116  /// calculators to refresh energy based calculations
118 
119 
120  /// @brief upon receiving pose::signals::ConformationEvent, sets flag telling
121  /// calculators to refresh structure based calculations
123 
124 
125 private: // calculator update
126 
127 
128  /// @brief set PoseMetricCalculator structure changed flags
130 
131 
132  /// @brief set PoseMetricCalculator energy changed flags
133  void process_energy_change();
134 
135 
136  /// @brief get a PoseMetricCalculator by name
137  PoseMetricCalculatorOP get_calculator( std::string const & calculator_name );
138 
139 
140  /// @brief add a PoseMetricCalculator by name
141  void add_calculator( std::string const & calculator_name );
142 
143 
144  /// @brief clone calculators, primarily for copy
145  void clone_calculators( Name2Calculator const & calcs );
146 
147 
148 private: // data
149 
150 
151  /// @brief pointer to the Pose being watched
153 
154 
155  /// @brief flag for structure change
157 
158 
159  /// @brief flag for energy change
161 
162 
163  /// @brief the list of metric calculators
165 
166 };
167 
168 
169 } // namespace metrics
170 } // namespace pose
171 } // namespace core
172 
173 
174 #endif