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
trie
RotamerDescriptor.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/scoring/trie/RotamerDescriptor.hh
11
/// @brief
12
/// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
13
14
#ifndef INCLUDED_core_scoring_trie_RotamerDescriptor_hh
15
#define INCLUDED_core_scoring_trie_RotamerDescriptor_hh
16
17
#include <
core/types.hh
>
18
19
// AUTO-REMOVED #include <iostream>
20
21
#include <utility/vector1.fwd.hh>
22
23
namespace
core {
24
namespace
scoring {
25
namespace
trie {
26
27
template
<
class
AT,
class
CPDAT >
28
class
RotamerDescriptorAtom
29
{
30
public
:
31
RotamerDescriptorAtom
() {}
32
RotamerDescriptorAtom
( AT
atom
, CPDAT
cp_data
) :
atom_
( atom ),
cp_data_
( cp_data ) {}
33
34
AT
const
&
atom
()
const
{
return
atom_
; }
35
CPDAT
const
&
cp_data
()
const
{
return
cp_data_
; }
36
37
void
atom
( AT setting ) {
atom_
= setting; }
38
void
cp_data
( CPDAT setting ) {
cp_data_
= setting; }
39
40
bool
operator < ( RotamerDescriptorAtom< AT, CPDAT >
const
& other )
const
41
{
42
if
(
atom_
< other.atom_ )
return
true
;
43
else
if
(
atom_
== other.atom_ &&
cp_data_
< other.cp_data_ )
return
true
;
44
return
false
;
45
}
46
47
bool
operator ==
(
RotamerDescriptorAtom< AT, CPDAT >
const
& other )
const
48
{
49
return
(
atom_
== other.
atom_
) && (
cp_data_
== other.
cp_data_
);
50
}
51
52
private
:
53
AT
atom_
;
54
CPDAT
cp_data_
;
55
};
56
57
58
template
<
class
AT,
class
CPDAT >
59
class
RotamerDescriptor
60
{
61
public
:
62
RotamerDescriptor
() :
rotamer_id_
( 0 ),
natoms_
( 0 ) {}
63
64
// Setters
65
void
natoms
(
Size
setting ) {
natoms_
= setting;
atoms_
.resize( setting ); }
66
void
atom
(
Size
index,
RotamerDescriptorAtom< AT, CPDAT >
const
& newatom ) {
atoms_
[ index ] = newatom; }
67
void
rotamer_id
(
Size
setting ) {
rotamer_id_
= setting; }
68
69
// Getters
70
Size
natoms
()
const
{
return
natoms_
; }
71
Size
rotamer_id
()
const
{
return
rotamer_id_
; }
72
RotamerDescriptorAtom< AT, CPDAT >
const
&
atom
(
Size
index ) {
return
atoms_
[ index ]; }
73
74
// Comparison operator for sorting.
75
bool
operator < ( RotamerDescriptor< AT, CPDAT >
const
& other )
const
76
{
77
if
(
natoms_
< other.natoms_ ) {
return
true
; }
78
else
if
(
natoms_
> other.natoms_ ) {
return
false
; }
79
else
{
80
for
(
Size
ii = 1; ii <=
natoms_
; ++ii ) {
81
if
(
atoms_
[ ii ] < other.atoms_[ ii ] ) {
82
//std::cout << "atom " << ii << "lt" << std::endl;
83
//atoms_[ ii ].atom().print();
84
//other.atoms_[ ii ].atom().print();
85
return
true
;
86
}
else
if
( other.atoms_[ ii ] <
atoms_
[ ii ] ) {
87
//std::cout << "atom " << ii << "gt" << std::endl;
88
//atoms_[ ii ].atom().print();
89
//other.atoms_[ ii ].atom().print();
90
return
false
;
91
}
92
}
93
}
94
return
false
;
95
}
96
97
98
Size
99
count_atoms_in_common
(
RotamerDescriptor< AT, CPDAT >
const
& other )
const
100
{
101
Size
const
n_to_compare =
natoms_
< other.
natoms_
?
natoms_
: other.
natoms_
;
102
for
(
Size
ii = 1; ii <= n_to_compare; ++ii ) {
103
if
( ! (
atoms_
[ ii ] == other.
atoms_
[ ii ]) ) {
104
return
ii - 1;
105
}
106
}
107
return
n_to_compare;
108
}
109
110
private
:
111
Size
rotamer_id_
;
112
typename
utility::vector1< RotamerDescriptorAtom< AT, CPDAT >
>
atoms_
;
113
Size
natoms_
;
114
115
};
116
117
118
}
// namespace trie
119
}
// namespace scoring
120
}
// namespace core
121
122
#endif
123
Generated on Sat Jun 1 2013 11:40:19 for Rosetta 3.5 by
1.8.4