18 #include <basic/MetricValue.hh>
20 #include <utility/string_util.hh>
24 #include <utility/vector1.hh>
28 using namespace core::pose;
29 using namespace core::pose::metrics;
33 namespace pose_metric_calculators {
35 ResidueDecompositionCalculator::ResidueDecompositionCalculator():
44 residue_decomposition_(calculator.residue_decomposition()),
45 residue_set_numbers_(calculator.residue_set_numbers())
54 if ( key ==
"num_sets" ) {
56 }
else if ( key ==
"residue_decomposition" ) {
57 std::ostringstream sstream;
60 if (i > 1) sstream <<
", ";
61 sstream <<
"Set " << i <<
" (" <<
set_names_[i] <<
"): [";
71 }
else if ( key ==
"residue_set_numbers" ) {
72 std::ostringstream sstream;
75 if (i > 1) sstream <<
", ";
80 }
else if ( key ==
"set_names" ) {
81 std::ostringstream sstream;
84 if (i > 1) sstream <<
", ";
91 basic::Error() <<
"This Calculator cannot compute metric " << key << std::endl;
99 basic::MetricValueBase * valptr
102 if ( key ==
"num_sets" ) {
104 basic::check_cast( valptr, &dummy_size,
"num_sets expects to return a Size" );
107 }
else if ( key ==
"residue_decomposition" ) {
108 basic::check_cast( valptr, &
residue_decomposition_,
"decomposition expects to return a utility::vector1<std::set<core::Size> >" );
109 (
static_cast<basic::MetricValue<utility::vector1<std::set<core::Size>
> > *>(valptr))->set(
residue_decomposition_ );
111 }
else if ( key ==
"residue_set_numbers" ) {
112 basic::check_cast( valptr, &
residue_set_numbers_,
"set_numbers expects to return a utility::vector1< core::Size >" );
113 (
static_cast<basic::MetricValue<utility::vector1<core::Size>
> *>(valptr))->set(
residue_set_numbers_ );
115 }
else if ( key ==
"set_names" ) {
116 basic::check_cast( valptr, &
set_names_,
"set_names expects to return a utility::vector1< std::string >" );
117 (
static_cast<basic::MetricValue<utility::vector1<std::string>
> *>(valptr))->set(
set_names_ );
120 basic::Error() <<
"ResidueDecompositionCalculator cannot compute the requested metric " << key << std::endl;
147 if (residue_set_number > max_set_number) max_set_number = residue_set_number;