OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rule_based.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_CONOP_RULE_BASED_HH
20 #define OST_CONOP_RULE_BASED_HH
21 
22 #include <ost/mol/entity_handle.hh>
23 #include "compound_lib.hh"
24 #include "diag.hh"
25 #include "processor.hh"
26 
27 namespace ost { namespace conop {
28 
31  CompoundPtr compound);
32 
34 
35 typedef boost::shared_ptr<RuleBasedProcessor> RuleBasedProcessorPtr;
36 
38 public:
40  lib_(compound_lib), fix_element_(true), strict_hydrogens_(false),
41  unk_res_treatment_(CONOP_WARN), unk_atom_treatment_(CONOP_WARN)
42  {
43  }
44 
45  RuleBasedProcessor(CompoundLibPtr compound_lib, bool fe, bool sh, ConopAction ur,
46  ConopAction ua, bool bf, bool at, bool cn, bool aa, ConopAction zo):
47  Processor(bf, at, cn, aa, zo), lib_(compound_lib), fix_element_(fe),
48  strict_hydrogens_(sh), unk_res_treatment_(ur),
49  unk_atom_treatment_(ua) {}
51  return unk_res_treatment_;
52  }
53 
55  return unk_atom_treatment_;
56  }
57 
58  bool GetFixElement() const {
59  return fix_element_;
60  }
61  void SetFixElement(bool flag) {
62  fix_element_ = flag;
63  }
64  bool GetStrictHydrogens() const {
65  return strict_hydrogens_;
66  }
67 
68  void SetStrictHydrogens(bool flag) {
69  strict_hydrogens_ = flag;
70  }
72  unk_res_treatment_ = action;
73  }
74 
76  unk_atom_treatment_ = action;
77  }
78  virtual ProcessorPtr Copy() const {
79  return ProcessorPtr(new RuleBasedProcessor(*this));
80  }
81 
82  virtual String ToString() const;
83 protected:
84  void ProcessUnkResidue(DiagnosticsPtr diags,
85  mol::ResidueHandle res,
86  mol::AtomHandleList& remaining) const;
87  void ProcessUnkAtoms(DiagnosticsPtr diags,
90  mol::AtomHandleList& remaining) const;
91  virtual void DoProcess(DiagnosticsPtr diags,
92  mol::EntityHandle ent) const;
93 private:
94  CompoundLibPtr lib_;
95  bool fix_element_;
96  bool strict_hydrogens_;
97  ConopAction unk_res_treatment_;
98  ConopAction unk_atom_treatment_;
99 };
100 
101 
102 
103 }}
104 #endif
105