Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TorsionID.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/id/AtomID.hh
11 /// @author Phil Bradley
12 
13 
14 #ifndef INCLUDED_core_id_TorsionID_hh
15 #define INCLUDED_core_id_TorsionID_hh
16 
17 
18 // Unit headers
19 #include <core/id/TorsionID.fwd.hh>
20 
21 // Package headers
22 // AUTO-REMOVED #include <core/id/AtomID.fwd.hh>
23 #include <core/id/types.hh>
24 
25 // AUTO-REMOVED #include <basic/Tracer.fwd.hh>
26 
27 // C++ headers
28 #include <iostream>
29 
30 
31 namespace core {
32 namespace id {
33 
34 
35 /// /brief Torsion identifier class
36 ///
37 /// Note the order of the elements in construction calls:
38 ///
39 /// ( residue, type, torsion )
40 ///
41 /// sort of from least to most specific
42 
43 class TorsionID
44 {
45 
46 public: // Creation
47 
48  /// @brief Default constructor
49  inline
51  rsd_( 0 ),
52  type_( BB ),
53  torsion_( 0 )
54  {};
55 
56  /// @brief Copy constructor
57  inline
58  TorsionID( TorsionID const & src ) :
59  rsd_( src.rsd_ ),
60  type_( src.type_ ),
61  torsion_( src.torsion_ )
62  {}
63 
64  /// @brief Property constructor
65  inline
67  Size const rsd_in,
68  TorsionType const & type_in,
69  Size const torsion_in
70  ) :
71  rsd_( rsd_in ),
72  type_( type_in ),
73  torsion_( torsion_in )
74  {}
75 
76 public: // Properties
77 
78  inline
79  Size
80  rsd() const { return rsd_; }
81 
82  inline
83  Size &
84  rsd() { return rsd_; }
85 
86  inline
88  type() const { return type_; }
89 
90  inline
91  TorsionType &
92  type() { return type_; }
93 
94  inline
95  Size
96  torsion() const { return torsion_; }
97 
98  inline
99  Size &
100  torsion() { return torsion_; }
101 
102  /// @brief Is this id valid?
103  /// \note Must return false for BOGUS_TORSION_ID
104  inline
105  bool
106  valid() const { return ( rsd_ > 0 && torsion_ > 0 ); }
107 
108 public: // Friends
109 
110  friend
111  inline
112  std::ostream &
114  std::ostream & os,
115  TorsionID const & a
116  )
117  {
118  os << "TorsionID " << a.rsd_ << ' ' << a.type_ << ' ' << a.torsion_;
119  return os;
120  }
121 
122  friend
123  inline
124  bool
126  TorsionID const & a,
127  TorsionID const & b
128  )
129  {
130  return a.type_ == b.type_ && a.torsion_ == b.torsion_ && a.rsd_ == b.rsd_;
131  }
132 
133  friend
134  inline
135  bool
137  TorsionID const & a,
138  TorsionID const & b
139  )
140  {
141  return a.type_ != b.type_ || a.torsion_ != b.torsion_ || a.rsd_ != b.rsd_;
142  }
143 
144  friend
145  inline
146  bool
148  TorsionID const & a,
149  TorsionID const & b
150  )
151  {
152  if ( a.rsd_ < b.rsd_ ) return true;
153  else if ( a.rsd_ > b.rsd_ ) return false;
154 
155  if ( a.type_ < b.type_ ) return true;
156  else if ( a.type_ > b.type_ ) return false;
157 
158  if ( a.torsion_ < b.torsion_ ) return true;
159 
160  return false;
161  }
162 
163 private: // Fields
164 
165 
166  /// @brief Residue number within the complex
168 
169  /// @brief The type (BB,CHI,JUMP) of this torsion
171 
172  /// @brief Torsion number of the given type within the residue
174 
175 
176 }; // TorsionID
177 
178 
179 /// @brief Globals
181 
182 
183 } // namespace id
184 } // namespace core
185 
186 
187 #endif // INCLUDED_core_id_TorsionID_HH