Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FragID.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 // :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/fragments/FragID.cc
12 /// @brief set of fragments for a certain alignment frame
13 /// @author Oliver Lange (olange@u.washington.edu)
14 /// @author James Thompson
15 /// @date Wed Oct 20 12:08:31 2007
16 
17 // Unit Headers
18 #include <core/fragment/FragID.hh>
19 
20 // Package Headers
21 #include <core/fragment/Frame.hh>
22 
24 #include <utility/vector1.hh>
25 
26 
27 namespace core {
28 namespace fragment {
29 
30 
31 FragID::FragID() : first( 0 ), second( 0 ) {}
32 
33 FragID::FragID( FrameOP frame, Size frag_id )
34  : first( frame ), second( frag_id )
35 {
36  assert( frame->nr_frags() >= frag_id );
37 }
38 
39 FragID::FragID( FragID const & src ) :
40  first( src.first ),
41  second( src.second )
42 {}
43 
45 
46 FragID const & FragID::operator = ( FragID const & rhs )
47 {
48  if ( this != &rhs ) {
49  first = rhs.first;
50  second = rhs.second;
51  }
52  return *this;
53 }
54 
55 
57 FragID::frame_ptr() const { return first; }
58 
59 Frame const&
60 FragID::frame() const { return *first; }
61 
62 Frame&
63 FragID::frame() { return *first; }
64 
65 Size
66 FragID::id() const { return second; } // stores the nr you get by asking frame.frag_id ( nr );
67 
68 FragData &
69 FragID::fragment() { return frame().fragment( id() ); }
70 
71 FragData const &
72 FragID::fragment() const { return frame().fragment( id() ); }
73 
75 FragID::fragment_ptr() const { return frame().fragment_ptr( id() ); }
76 
77 Size
79 {
80  return frame().apply( mm, id(), pose );
81 }
82 
83 Size FragID::apply( pose::Pose & pose ) const
84 {
85  return frame().apply( id(), pose );
86 }
87 // if we enable id != nr frame will need a map that can do frag_id --> nr
88 bool
90 {
91  return frame_ptr() && ( id() > 0 ) && fragment().is_valid();
92 }
93 
94 Size
96  return frame().apply_ss( mm, id(), ss );
97 }
98 
99 bool FragID::operator == ( FragID const & other ) const
100 {
101  return first == other.first && second == other.second;
102 }
103 
104 bool FragID::operator < ( FragID const & other ) const
105 {
106  if ( first < other.first ) return true;
107  else if ( first == other.first && second < other.second ) return true;
108 
109  return false;
110 }
111 
112 
113 } //fragment
114 } //core