Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Rules.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
11 /// @author Oliver Lange
12 
13 #ifndef INCLUDED_core_coarse_Rules_hh
14 #define INCLUDED_core_coarse_Rules_hh
15 
16 // Unit headers
17 #include <core/coarse/Rules.fwd.hh>
18 // you cannot #include yourself #include <core/coarse/Rules.hh>
19 
20 
21 // Project headers
22 //#include <core/chemical/ResidueTypeSet.hh>
23 //#include <core/chemical/ResidueTypeSet.fwd.hh>
24 //#include <core/conformation/Residue.hh>
25 // AUTO-REMOVED #include <core/chemical/AtomTypeSet.hh>
26 #include <core/chemical/AA.hh>
27 // AUTO-REMOVED #include <core/pose/Pose.fwd.hh>
28 
29 // Utility headers
30 // AUTO-REMOVED #include <utility/vector1.hh>
31 #include <utility/pointer/access_ptr.hh>
32 #include <utility/pointer/owning_ptr.hh>
33 #include <utility/pointer/ReferenceCount.hh>
34 
35 
36 // std headers
37 #include <iostream>
38 
39 //Auto Headers
40 #include <utility/vector1_bool.hh>
41 #include <map>
42 
43 
44 namespace core {
45 namespace coarse {
46 class Rule;
51 
52 
54 public:
56  typedef std::vector<std::string> Tokens;
58  typedef std::map<BeadName, Tokens> BeadRules;
59  typedef BeadRules::const_iterator ConstBeadIterator;
60  typedef Tokens::const_iterator ConstTokenIterator;
61 
62  class BeadAdder {
63  public:
64  BeadAdder(Tokens& tokens) : tokens_(tokens) {};
65  BeadAdder& operator << (std::string token) {tokens_.push_back(token); return *this;};
66  private:
67  Tokens& tokens_;
68  };
69 
70 public:
71  Rule() : my_AA_(chemical::aa_unk) {};
72  Rule(chemical::AA _AA) : my_AA_(_AA) {};
73  void pretty_print(std::ostream &os);
74  static const BeadName FULL_ATOM;
75  static const AtomToken REST_SIDECHAIN;
76  static const AtomToken REST_ALL;
77  // void add_token(std::string bead,std::string token);
78  BeadAdder add_to_bead(BeadName bead) {return BeadAdder(rules_[bead]); };
79  ConstBeadIterator begin() const {return rules_.begin(); };
80  ConstBeadIterator end() const {return rules_.end(); }
81 private:
84 };
85 
86 class GenericRule : public Rule {
87  // the generic rule: momentarily in doubt all atoms remain full-atom
88 public:
91  };
92 };
93 
95  typedef std::map<chemical::AA,RuleOP> RuleMap;
96  // might become AA-> vector<Rule> if we have more than 1 possible rule per AA-type
97 public:
98  RuleSet() {};
99  RuleSet(std::string tag);
100  void create_rules();
101  void pretty_print(std::ostream &os);
102  //void read_rules_from_file(std::istream&) {};
103  bool has(chemical::AA aa) const;
105  if (has(aa))
106  return rules_[aa];
107  else {
108  std::cerr << "WARNING: no rule for AA type " << aa << std::endl << "returning generic rule" << std::endl;
109  return RuleCOP(new GenericRule(aa) );
110  }
111  }
112 
113 private:
114  mutable RuleMap rules_; //because is not a const function operator[]
115 
116 };
117 } //namespace coarse
118 } // namespace core
119 #endif