Chemical Data Processing Library C++ API - Version 1.2.0
MMFF94FormalAtomChargeDefinitionTable.hpp
Go to the documentation of this file.
1 /*
2  * MMFF94FormalAtomChargeDefinitionTable.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_FORCEFIELD_MMFF94FORMALATOMCHARGEDEFINITIONTABLE_HPP
30 #define CDPL_FORCEFIELD_MMFF94FORMALATOMCHARGEDEFINITIONTABLE_HPP
31 
32 #include <cstddef>
33 #include <iosfwd>
34 #include <string>
35 #include <vector>
36 #include <unordered_map>
37 #include <memory>
38 #include <functional>
39 
40 #include <boost/iterator/transform_iterator.hpp>
41 
43 
44 
45 namespace CDPL
46 {
47 
48  namespace ForceField
49  {
50 
52  {
53 
54  public:
55  class Entry;
56 
57  private:
58  typedef std::unordered_map<std::string, Entry> DataStorage;
59 
60  public:
61  typedef std::shared_ptr<MMFF94FormalAtomChargeDefinitionTable> SharedPointer;
62 
64  {
65 
66  public:
67  Entry();
68 
69  Entry(const std::string& atom_type, std::size_t ass_mode, double charge, const std::string& type_list);
70 
71  const std::string& getAtomType() const;
72 
73  std::size_t getAssignmentMode() const;
74 
75  double getFormalCharge() const;
76 
77  const std::string& getAtomTypeList() const;
78 
79  operator bool() const;
80 
81  private:
82  std::string atomType;
83  std::size_t assMode;
84  double charge;
85  std::string typeList;
86  bool initialized;
87  };
88 
89  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
90  DataStorage::const_iterator>
92 
93  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
94  DataStorage::iterator>
96 
98 
99  void addEntry(const std::string& atom_type, std::size_t ass_mode, double charge, const std::string& nbr_types);
100 
101  const Entry& getEntry(const std::string& atom_type) const;
102 
103  std::size_t getNumEntries() const;
104 
105  void clear();
106 
107  bool removeEntry(const std::string& atom_type);
108 
110 
112 
114 
116 
118 
120 
122 
124 
126 
127  void load(std::istream& is);
128 
129  void loadDefaults();
130 
131  static void set(const SharedPointer& table);
132 
133  static const SharedPointer& get();
134 
135  private:
136  static SharedPointer defaultTable;
137  DataStorage entries;
138  };
139  } // namespace ForceField
140 } // namespace CDPL
141 
142 #endif // CDPL_FORCEFIELD_MMFF94FORMALATOMCHARGEDEFINITIONTABLE_HPP
Definition of the preprocessor macro CDPL_FORCEFIELD_API.
#define CDPL_FORCEFIELD_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition: MMFF94FormalAtomChargeDefinitionTable.hpp:64
Entry(const std::string &atom_type, std::size_t ass_mode, double charge, const std::string &type_list)
Definition: MMFF94FormalAtomChargeDefinitionTable.hpp:52
const Entry & getEntry(const std::string &atom_type) const
EntryIterator removeEntry(const EntryIterator &it)
boost::transform_iterator< std::function< Entry &(DataStorage::value_type &)>, DataStorage::iterator > EntryIterator
Definition: MMFF94FormalAtomChargeDefinitionTable.hpp:95
bool removeEntry(const std::string &atom_type)
void addEntry(const std::string &atom_type, std::size_t ass_mode, double charge, const std::string &nbr_types)
static void set(const SharedPointer &table)
boost::transform_iterator< std::function< const Entry &(const DataStorage::value_type &)>, DataStorage::const_iterator > ConstEntryIterator
Definition: MMFF94FormalAtomChargeDefinitionTable.hpp:91
std::shared_ptr< MMFF94FormalAtomChargeDefinitionTable > SharedPointer
Definition: MMFF94FormalAtomChargeDefinitionTable.hpp:61
The namespace of the Chemical Data Processing Library.