Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JumpID.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_JumpID_hh
15 #define INCLUDED_core_id_JumpID_hh
16 
17 
18 // Unit headers
19 #include <core/id/JumpID.fwd.hh>
20 
21 // Package headers
22 // AUTO-REMOVED #include <core/id/AtomID.fwd.hh>
23 // AUTO-REMOVED #include <core/id/types.hh>
24 
25 // AUTO-REMOVED #include <basic/Tracer.fwd.hh>
26 
27 // C++ headers
28 #include <iostream>
29 
30 #include <core/types.hh>
31 
32 
33 
34 namespace core {
35 namespace id {
36 
37 /// /brief Torsion identifier class
38 ///
39 /// Note the order of the elements in construction calls:
40 ///
41 /// ( residue, type, torsion )
42 ///
43 /// sort of from least to most specific
44 
45 class JumpID
46 {
47 
48 public: // Creation
49 
50  /// @brief Default constructor
51  inline
52  JumpID() :
53  rsd1_( 0 ),
54  rsd2_( 0 )
55  {};
56 
57  /// @brief Property constructor
58  inline
60  Size const rsd1_in,
61  Size const rsd2_in
62  )
63  {
64  rsd1_ = rsd1_in < rsd2_in ? rsd1_in : rsd2_in;
65  rsd2_ = rsd1_in >= rsd2_in ? rsd1_in : rsd2_in;
66  }
67 
68 public: // Properties
69 
70  inline
71  Size
72  rsd1() const { return rsd1_; }
73 
74  inline
75  Size &
76  rsd2() { return rsd2_; }
77 
78  /// @brief Is this id valid?
79  /// \note Must return false for BOGUS_TORSION_ID
80  inline
81  bool
82  valid() const { return ( rsd1_ > 0 && rsd2_ > rsd1_ ); }
83 
84 public: // Friends
85 
86  friend
87  inline
88  std::ostream &
90  std::ostream & os,
91  JumpID const & a
92  )
93  {
94  os << "JumpID " << a.rsd1_ << ' ' << a.rsd2_;
95  return os;
96  }
97 
98  friend
99  inline
100  bool
102  JumpID const & a,
103  JumpID const & b
104  )
105  {
106  return a.rsd1_ == b.rsd1_ && a.rsd2_ == b.rsd2_;
107  }
108 
109  friend
110  inline
111  bool
113  JumpID const & a,
114  JumpID const & b
115  )
116  {
117  return a.rsd1_ != b.rsd1_ || a.rsd2_ != b.rsd2_;
118  }
119 
120  friend
121  inline
122  bool
124  JumpID const & a,
125  JumpID const & b
126  )
127  {
128  if ( a.rsd1_ < b.rsd1_ ) return true;
129  else if ( a.rsd1_ == b.rsd1_ && a.rsd2_ < b.rsd2_ ) return true;
130 
131  return false;
132  }
133 
134 private: // Fields
135 
136 
137  /// @brief Residue number within the complex
140 
141 }; // JumpID
142 
143 } // namespace id
144 } // namespace core
145 
146 
147 #endif // INCLUDED_core_id_JumpID_HH