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
fragment
picking_old
vall
VallSection.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/fragment/picking_old/vall/VallSection.hh
11
/// @brief class implementing the Book concept for a continuous section of lines in the Vall library
12
/// @author Yih-En Andrew Ban (yab@u.washington.edu)
13
14
#ifndef INCLUDED_core_fragment_picking_old_vall_VallSection_hh
15
#define INCLUDED_core_fragment_picking_old_vall_VallSection_hh
16
17
// unit headers
18
#include <
core/fragment/picking_old/vall/VallSection.fwd.hh
>
19
20
// package headers
21
#include <
core/fragment/picking_old/concepts/Book.hh
>
22
#include <
core/fragment/picking_old/vall/VallResidue.hh
>
23
24
#include <utility/vector1.hh>
25
26
27
// utility headers
28
29
30
namespace
core {
31
namespace
fragment {
32
namespace
picking_old {
33
namespace
vall {
34
35
36
/// @brief class implementing the Book concept for a continuous section of lines in the Vall library
37
class
VallSection
:
public
core::fragment::picking_old::concepts::Book
< VallResidues >{
38
39
40
private
:
// typedefs
41
42
43
typedef
core::fragment::picking_old::concepts::Book< VallResidues >
Super
;
44
45
46
public
:
// concept typedefs
47
48
49
/// @brief typedef for Book concept
50
typedef
Super::PageConstIterator
PageConstIterator
;
51
52
53
/// @brief typedef for Book concept
54
typedef
Super::PageIterator
PageIterator
;
55
56
57
public
:
// concept translation typedefs
58
59
60
typedef
PageConstIterator
VallResidueConstIterator
;
61
typedef
PageIterator
VallResidueIterator
;
62
63
64
public
:
// construct/destruct
65
66
67
public
:
// operators
68
69
70
/// @brief access a specific VallResidue within this section, 1-based indexing
71
inline
72
VallResidue
const
&
operator[]
(
Size
const
idx )
const
{
73
return
residues
()[ idx ];
74
}
75
76
77
public
:
// page management
78
79
80
/// @brief append a residue to the end of this section
81
inline
82
void
append_residue
(
VallResidue
const
& r ) {
83
residues
().push_back( r );
84
residues
().back().position_index(
residues
().
size
() );
85
residues
().back().section_index(
index_
);
86
}
87
88
89
/// @brief re-index VallResidues within this library so they number 1 .. n
90
inline
91
void
reindex_residues
() {
92
Size
count = 0;
93
for
(
VallResidueIterator
i =
begin
(), ie =
end
(); i != ie; ++i ) {
94
i->position_index( ++count );
95
}
96
}
97
98
99
public
:
// accessors
100
101
102
/// @brief stores the 1-based indexing for accessing this section
103
/// via VallLibrary::operator []
104
inline
105
Size
index
()
const
{
106
return
index_
;
107
}
108
109
110
public
:
// mutators
111
112
113
/// @brief stores the 1-based indexing for accessing this section
114
/// via VallLibrary::operator []
115
inline
116
void
index
(
Size
const
idx ) {
117
index_
= idx;
118
for
(
VallResidueIterator
r =
begin
(), re =
end
(); r != re; ++r ) {
119
r->section_index( idx );
120
}
121
}
122
123
public
:
// memory
124
125
126
/// @brief ensure storage currently allocated for residues is at least the
127
/// given size
128
inline
129
void
reserve
(
Size
const
n ) {
130
residues
().reserve( n );
131
}
132
133
134
/// @brief tighten memory usage
135
/// @details Shrinks the capacity of the VallResidues by performing
136
/// a swap, so this operation will effectively require a
137
/// similar amount of memory as the current residue object.
138
inline
139
void
tighten_memory
() {
140
if
(
residues
().
size
() <
residues
().capacity() ) {
141
VallResidues
(
residues
() ).swap(
residues
() );
142
}
143
}
144
145
146
private
:
// concept translation
147
148
149
/// @brief return residues container
150
inline
151
VallResidues
const
&
residues
()
const
{
152
return
pages
();
153
}
154
155
156
/// @brief return residues container
157
inline
158
VallResidues
&
residues
() {
159
return
pages
();
160
}
161
162
163
private
:
// data
164
165
166
/// @brief stores the 1-based indexing for accessing this section
167
/// via VallLibrary::operator []
168
Size
index_
;
169
170
171
};
172
173
174
/// @brief wrapper for a collection of VallSection
175
class
VallSections
:
public
utility::vector1
< VallSection > {
176
177
178
public
:
// concept typedefs
179
180
181
/// @brief Book typedef required to satisfy concept
182
typedef
VallSection
Book
;
183
184
185
};
186
187
188
}
// vall
189
}
// picking_old
190
}
// fragment
191
}
// core
192
193
194
#endif
/* INCLUDED_core_fragment_picking_old_vall_VallSection_HH */
Generated on Sat Jun 1 2013 11:32:46 for Rosetta 3.5 by
1.8.4