Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SingleStateEntityData.cc
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 SingleStateEntityData.cc
11 /// @brief
12 /// @author Colin A. Smith
13 
15 
16 #include <basic/MetricValueIO.hh>
17 
18 
19 namespace protocols {
20 namespace multistate_design {
21 
22 void
24  std::ostream & os
25 ) const
26 {
27  os << "fitness " << fitness_;
28  os << " metrics " << metric_value_map_.size();
29  for (MetricValueMap::const_iterator iter = metric_value_map_.begin(); iter != metric_value_map_.end(); ++iter) {
30  os << " " << iter->first << " ";
31  runtime_assert(basic::write_metric_value(os, *(iter->second)));
32  }
33 }
34 
35 bool
37  std::istream & is
38 )
39 {
40  std::string word;
41  core::Size num_metrics;
42 
43  if (!(is >> word)) return false;
44  if (word != "fitness") return false;
45  if (!(is >> fitness_)) return false;
46 
47  if (!(is >> word)) return false;
48  if (word != "metrics") return false;
49  if (!(is >> num_metrics)) return false;
50 
51  for (core::Size i = 1; i <= num_metrics; ++i) {
52  if (!(is >> word)) return false;
53  basic::MetricValueBaseOP metric_value(basic::read_metric_value(is));
54  if (!metric_value) return false;
56  }
57 
58  return true;
59 }
60 
61 } // namespace multistate_design
62 } // namespace protocols