Rosetta 3.5
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
core
scoring
ScoreType.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
11
/// @brief
12
/// @author Phil Bradley
13
14
15
// Rosetta headers
16
#include <
core/scoring/ScoreType.hh
>
17
#include <
core/scoring/ScoreTypeManager.hh
>
18
#include <
core/types.hh
>
19
20
// ObjexxFCL headers
21
22
23
// Numeric headers
24
25
26
// Utility headers
27
28
// C++ headers
29
#include <map>
30
#ifdef WIN32
31
#include <string>
32
#endif
33
#include <iostream>
34
35
#include <utility/vector1.hh>
36
37
38
namespace
core {
39
namespace
scoring {
40
41
//////////////////////////////////////////////////////////////////////////////
42
/// @brief give a ScoreType string name and return its enum type
43
ScoreType
44
score_type_from_name
(
std::string
const
& name )
45
{
46
return
ScoreTypeManager::score_type_from_name
( name );
47
}
48
49
//////////////////////////////////////////////////////////////////////////////
50
/// @brief input operator for ScoreType enum type
51
///
52
/// @details read in a string name from a file or std::cin and directly convert
53
/// it to an ScoreType enum type, for example, std::cin >> ScoreType. This will first check
54
/// if the lookup map has been set up already. If the string name cannot be
55
/// converted properly, it will flag the input stream as failure
56
/// (e.g., istream.fail() is true) and set ScoreType enum type to total_score.
57
58
std::istream &
59
operator >>
(
60
std::istream & is,
61
ScoreType
& score_type
62
)
63
{
64
std::string
name;
65
is >> name;
66
if
(
ScoreTypeManager::is_score_type
( name ) ) {
67
//std::cout << "score_typeextract succeeded " << name << std::endl;
68
score_type =
ScoreTypeManager::score_type_from_name
( name );
69
}
else
{
70
std::cout <<
"score_typeextract failed: "
<< name << std::endl;
71
score_type =
total_score
;
72
is.setstate( std::ios_base::failbit );
73
}
74
return
is;
75
}
76
77
//////////////////////////////////////////////////////////////////////////////
78
/// @brief output operator for ScoreType enum type
79
///
80
/// @details example usage: std::cout << score_type_gly << std::endl;
81
std::ostream &
82
operator <<
(
83
std::ostream & os,
84
ScoreType
const
& score_type
85
)
86
{
87
os <<
ScoreTypeManager::name_from_score_type
( score_type );
88
return
os;
89
}
90
91
//////////////////////////////////////////////////////////////////////////////
92
/// @brief output operator for ScoreTypes list type
93
std::ostream &
94
operator <<
(
95
std::ostream & os,
96
ScoreTypes
const
& score_types
97
)
98
{
99
for
(
core::Size
ii(1); ii <= score_types.size(); ++ii) {
100
if
(ii == 1) {
101
os <<
"( "
;
102
}
else
{
103
os <<
", "
;
104
}
105
os << score_types[ii];
106
}
107
os <<
" )"
;
108
return
os;
109
}
110
111
std::string
112
name_from_score_type
(
ScoreType
score_type ) {
113
return
ScoreTypeManager::name_from_score_type
( score_type );
114
}
115
116
117
}
// chemical
118
}
// core
Generated on Sat Jun 1 2013 11:40:16 for Rosetta 3.5 by
1.8.4