Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EnergyNames.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 core/io/silent/EnergyNames.hh
12 ///
13 /// @brief class representing a set of energy names used in silent-file input/output
14 /// @author James Thompson
15 
16 #ifndef INCLUDED_core_io_silent_EnergyNames_hh
17 #define INCLUDED_core_io_silent_EnergyNames_hh
18 
19 // mini headers
20 // AUTO-REMOVED #include <utility/vector1.hh>
22 
23 // C++ Headers
24 #include <string>
25 #include <sstream>
26 
27 #include <utility/vector1_bool.hh>
28 
29 
30 namespace core {
31 namespace io {
32 namespace silent {
33 
34 
35 class EnergyNames : public SharedSilentData {
36 
37 public:
39  EnergyNames( std::string const & line ) {
40  std::istringstream score_line_stream( line );
41  std::string tag;
42  //tr.debug << "reading score names from " << line << std::endl;
43  score_line_stream >> tag; // score:
44  if ( score_line_stream.fail() || tag != "SCORE:" ) {
45  //tr.error << "bad format in score line of silent file" << std::endl;
46  //tr.error << "tag = " << tag << std::endl;
47  //tr.error << "line = " << line << std::endl;
48  }
49 
50  score_line_stream >> tag; // first score name
51  while ( !score_line_stream.fail() ) {
52  energy_names_.push_back( tag );
53  score_line_stream >> tag;
54  }
55  } // EnergyNames( std::string const & line )
56 
58  energy_names_ = new_e_names;
59  }
60 
62  return energy_names_;
63  }
64 
65  bool operator == (const EnergyNames & other) const {
66  using std::string;
67  using utility::vector1;
68 
69  vector1< string > other_names = other.energy_names();
70  if ( energy_names_.size() != other_names.size() ) {
71  return false;
72  }
73 
74  for ( vector1< string >::const_iterator it1 = energy_names_.begin(), it2 = other_names.begin(),
75  end1 = energy_names_.end(), end2 = other_names.end();
76  it1 != end1 && it2 != end2; ++it1, ++it2
77  ) {
78  if ( *it1 != *it2 ) return false;
79  }
80 
81  return true;
82  } // operator ==
83 
84 
85 private:
87 }; // EnergyNames
88 
89 
90 } // namespace silent
91 } // namespace io
92 } // namespace core
93 
94 #endif