OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
heuristic_block_modifiers.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-2015 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 
20 #ifndef OST_MM_HEURISTIC_BLOCK_MODIFIERS_HH
21 #define OST_MM_HEURISTIC_BLOCK_MODIFIERS_HH
22 
23 
24 #include <boost/shared_ptr.hpp>
25 
26 #include <ost/message.hh>
27 #include <ost/mol/bond_handle.hh>
29 #include <ost/mol/entity_handle.hh>
30 #include <ost/mol/atom_handle.hh>
31 #include <ost/mol/xcs_editor.hh>
32 #include <ost/geom/vec3.hh>
35 
36 
37 namespace ost{ namespace mol{ namespace mm{
38 
39 class HeuristicHydrogenConstructor;
40 class HeuristicTerminiConstructor;
42 
43 typedef boost::shared_ptr<HeuristicHydrogenConstructor> HeuristicHydrogenConstructorPtr;
44 typedef boost::shared_ptr<HeuristicTerminiConstructor> HeuristicTerminiConstructorPtr;
45 typedef boost::shared_ptr<HeuristicBlockModifier> HeuristicBlockModifierPtr;
46 
47 
49 
50 public:
51 
53 
55 
57 
58  virtual void OnSave(ost::io::BinaryDataSink& ds) { ds << *this; }
59 
61 
62  template <typename DS>
63 
64  void Serialize(DS& ds){
65 
66  if(ds.IsSource()){
67  int num_anchor_atoms = 0;
68  int num_antecendents = 0;
69  int num_hydrogens = 0;
70  String loaded_string;
71 
72  ds & num_anchor_atoms;
73 
74  for(int i = 0; i < num_anchor_atoms; ++i){
75  ds & num_antecendents;
76  ds & num_hydrogens;
77 
78  ds & loaded_string;
79  anchor_atom_names_.push_back(loaded_string);
80 
81  antecedent_names_.push_back(std::vector<String>());
82  for(int j = 0; j < num_antecendents; ++j){
83  ds & loaded_string;
84  antecedent_names_[i].push_back(loaded_string);
85  }
86 
87  hydrogen_names_.push_back(std::vector<String>());
88  for(int j = 0; j < num_hydrogens; ++j){
89  ds & loaded_string;
90  hydrogen_names_[i].push_back(loaded_string);
91  }
92  }
93  }
94  else{
95  int num_anchor_atoms = anchor_atom_names_.size();
96  int num_antecendents = 0;
97  int num_hydrogens = 0;
98 
99  ds & num_anchor_atoms;
100 
101  for(int i = 0; i < num_anchor_atoms; ++i){
102 
103  num_antecendents = antecedent_names_[i].size();
104  num_hydrogens = hydrogen_names_[i].size();
105  ds & num_antecendents;
106  ds & num_hydrogens;
107  ds & anchor_atom_names_[i];
108 
109 
110  for(std::vector<String>::iterator j = antecedent_names_[i].begin();
111  j != antecedent_names_[i].end(); ++j){
112  ds & *j;
113  }
114 
115  for(std::vector<String>::iterator j = hydrogen_names_[i].begin();
116  j != hydrogen_names_[i].end(); ++j){
117  ds & *j;
118  }
119  }
120 
121  }
122  }
123 
124 private:
125  std::vector<String> anchor_atom_names_;
126  std::vector<std::vector<String> > antecedent_names_;
127  std::vector<std::vector<String> > hydrogen_names_;
128 };
129 
130 
132 
133 public:
134 
136 
137  virtual void ApplyOnBuildingBlock(BuildingBlockPtr p);
138 
140 
142 
143  virtual void OnSave(ost::io::BinaryDataSink& ds) { ds << *this; }
144 
145  template <typename DS>
146 
147  void Serialize(DS& ds){
148 
149  }
150 
151 };
152 
153 
154 
155 }}}
156 
157 #endif
virtual void OnSave(ost::io::BinaryDataSink &ds)
std::string String
Definition: base.hh:54
boost::shared_ptr< HeuristicTerminiConstructor > HeuristicTerminiConstructorPtr
virtual void ApplyOnBuildingBlock(BuildingBlockPtr p)
virtual void ApplyOnResidue(ost::mol::ResidueHandle &res, ost::mol::XCSEditor &ed)
boost::shared_ptr< HeuristicBlockModifier > HeuristicBlockModifierPtr
pointer_it< T > begin(const std::vector< T > &values)
HeuristicHydrogenConstructor(BuildingBlockPtr block)
virtual BlockModifierType GetBlockModifierType()
external coordinate system editor
Definition: xcs_editor.hh:36
boost::shared_ptr< HeuristicHydrogenConstructor > HeuristicHydrogenConstructorPtr
virtual void ApplyOnBuildingBlock(BuildingBlockPtr)
virtual void OnSave(ost::io::BinaryDataSink &ds)
virtual void ApplyOnResidue(ost::mol::ResidueHandle &res, ost::mol::XCSEditor &ed)
boost::shared_ptr< BuildingBlock > BuildingBlockPtr