Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NamedStubID.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/NamedStubID.hh
11 /// @author Phil Bradley
12 
13 
14 #ifndef INCLUDED_core_id_NamedStubID_hh
15 #define INCLUDED_core_id_NamedStubID_hh
16 
17 
18 // Unit headers
20 #include <core/id/NamedAtomID.hh>
21 #include <core/types.hh>
22 // AUTO-REMOVED #include <core/id/AtomID.hh>
23 
24 // Utility Headers
25 #include <utility/vector1.hh>
26 
27 // C++ headers
28 
29 
30 
31 
32 namespace core {
33 namespace id {
34 
35 
36 /////////////////////////////////////////////////////////////////////////////
37 // NamedStubID
38 /////////////////////////////////////////////////////////////////////////////
39 
40 // data to uniquely specify an atom
41 // could change -- pointer?
42 
43 ///////////////////////////////////////////////////////////////////////////////
44 
45 class NamedStubID {
46 public:
48 
49  NamedStubID( NamedAtomID const & a1, NamedAtomID const & a2, NamedAtomID const & a3 ):
50  center_(),
51  atom1( a1 ),
52  atom2( a2 ),
53  atom3( a3 )
54  {}
55 
56  NamedStubID( NamedAtomID const & c, NamedAtomID const & a1, NamedAtomID const & a2, NamedAtomID const & a3 ) :
57  center_( c ),
58  atom1( a1 ),
59  atom2( a2 ),
60  atom3( a3 )
61  {}
62 
63  // convienience c'stor if the residue is the same for all atoms
64  NamedStubID( std::string const& a1, std::string const& a2, std::string const& a3, core::Size rsd );
65 
66  // convienience c'stor if the residue is the same for all atoms
67  NamedStubID( std::string const& c, std::string const& a1, std::string const& a2, std::string const& a3, core::Size rsd );
68 
69  // convienience c'stor
70  NamedStubID( std::string const& a1, Size rsd1, std::string const& a2, Size rsd2, std::string a3, core::Size rsd3 );
71 
72  // convienience c'stor takes list of strings either size 3 or size 4. If size 4 first atom is center
73  NamedStubID( AtomList const&, core::Size rsd );
74 
76  center_(),
77  atom1(),
78  atom2(),
79  atom3()
80  {}
81 
82  NamedAtomID const &
83  atom( Size const index ) const;
84 
85  NamedAtomID const &
86  center() const {
87  return center_;
88  }
89 
90  bool valid() const {
91  return atom1.valid() && atom2.valid() && atom3.valid();
92  }
93 
94  inline
95  friend
96  bool
97  operator< ( NamedStubID const & a, NamedStubID const & b )
98  {
99  return ( ( a.atom1 < b.atom1 ) ||
100  ( a.atom1 == b.atom1 && a.atom2 < b.atom2 ) ||
101  ( a.atom1 == b.atom1 && a.atom2 == b.atom2 && a.atom3 < b.atom3 ) );
102  }
103 
104 
105 
106  /// @brief input operator
107  friend std::istream & operator >>(std::istream & is, NamedStubID& e);
108 
109  /// @brief output operator
110  friend std::ostream & operator <<(std::ostream & os, NamedStubID const& e);
111 
112 
113 public: // tmp hack -- phil fix this
118 };
119 
120 
121 
122 } // namespace id
123 } // namespace core
124 
125 
126 #endif // INCLUDED_core_id_AtomID_HH