Chemical Data Processing Library C++ API - Version 1.1.1
MMFF94PrimaryToParameterAtomTypeMap.hpp
Go to the documentation of this file.
1 /*
2  * MMFF94PrimaryToParameterAtomTypeMap.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_MMFF94PRIMARYTOPARAMETERATOMTYPEMAP_HPP
30 #define CDPL_FORCEFIELD_MMFF94PRIMARYTOPARAMETERATOMTYPEMAP_HPP
31 
32 #include <iosfwd>
33 #include <cstddef>
34 #include <unordered_map>
35 #include <memory>
36 #include <functional>
37 
38 #include <boost/iterator/transform_iterator.hpp>
39 
41 
42 
43 namespace CDPL
44 {
45 
46  namespace ForceField
47  {
48 
50  {
51 
52  public:
53  class Entry;
54 
55  private:
56  typedef std::unordered_map<unsigned int, Entry> DataStorage;
57 
58  public:
59  typedef std::shared_ptr<MMFF94PrimaryToParameterAtomTypeMap> SharedPointer;
60 
62  {
63 
64  public:
65  static constexpr std::size_t NUM_TYPES = 4;
66 
67  Entry();
68 
69  Entry(unsigned int atom_type, unsigned int param_types[]);
70 
71  unsigned int getAtomType() const;
72 
73  const unsigned int* getParameterTypes() const;
74 
75  operator bool() const;
76 
77  private:
78  unsigned int atomType;
79  unsigned int paramTypes[NUM_TYPES];
80  bool initialized;
81  };
82 
83  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
84  DataStorage::const_iterator>
86 
87  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
88  DataStorage::iterator>
90 
92 
93  void addEntry(unsigned int atom_type, unsigned int param_types[]);
94 
95  const Entry& getEntry(unsigned int atom_type) const;
96 
97  std::size_t getNumEntries() const;
98 
99  void clear();
100 
101  bool removeEntry(unsigned int atom_type);
102 
104 
106 
108 
110 
112 
114 
116 
118 
120 
121  void load(std::istream& is);
122 
123  void loadDefaults();
124 
125  static void set(const SharedPointer& table);
126 
127  static const SharedPointer& get();
128 
129  private:
130  static SharedPointer defaultMap;
131  DataStorage entries;
132  };
133  } // namespace ForceField
134 } // namespace CDPL
135 
136 #endif // CDPL_FORCEFIELD_MMFF94PRIMARYTOPARAMETERATOMTYPEMAP_HPP
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::SharedPointer
std::shared_ptr< MMFF94PrimaryToParameterAtomTypeMap > SharedPointer
Definition: MMFF94PrimaryToParameterAtomTypeMap.hpp:59
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::removeEntry
EntryIterator removeEntry(const EntryIterator &it)
APIPrefix.hpp
Definition of the preprocessor macro CDPL_FORCEFIELD_API.
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::clear
void clear()
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::Entry::Entry
Entry(unsigned int atom_type, unsigned int param_types[])
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::MMFF94PrimaryToParameterAtomTypeMap
MMFF94PrimaryToParameterAtomTypeMap()
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::Entry
Definition: MMFF94PrimaryToParameterAtomTypeMap.hpp:62
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::begin
EntryIterator begin()
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::set
static void set(const SharedPointer &table)
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap
Definition: MMFF94PrimaryToParameterAtomTypeMap.hpp:50
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::Entry::getParameterTypes
const unsigned int * getParameterTypes() const
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::getEntriesBegin
EntryIterator getEntriesBegin()
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::Entry::getAtomType
unsigned int getAtomType() const
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::getEntriesEnd
EntryIterator getEntriesEnd()
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::getEntriesBegin
ConstEntryIterator getEntriesBegin() const
bool
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::end
EntryIterator end()
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::begin
ConstEntryIterator begin() const
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::end
ConstEntryIterator end() const
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::getEntriesEnd
ConstEntryIterator getEntriesEnd() const
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::Entry::Entry
Entry()
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::getNumEntries
std::size_t getNumEntries() const
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::ConstEntryIterator
boost::transform_iterator< std::function< const Entry &(const DataStorage::value_type &)>, DataStorage::const_iterator > ConstEntryIterator
Definition: MMFF94PrimaryToParameterAtomTypeMap.hpp:85
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::get
static const SharedPointer & get()
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::removeEntry
bool removeEntry(unsigned int atom_type)
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::load
void load(std::istream &is)
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::EntryIterator
boost::transform_iterator< std::function< Entry &(DataStorage::value_type &)>, DataStorage::iterator > EntryIterator
Definition: MMFF94PrimaryToParameterAtomTypeMap.hpp:89
CDPL_FORCEFIELD_API
#define CDPL_FORCEFIELD_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::loadDefaults
void loadDefaults()
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::getEntry
const Entry & getEntry(unsigned int atom_type) const
CDPL::ForceField::MMFF94PrimaryToParameterAtomTypeMap::addEntry
void addEntry(unsigned int atom_type, unsigned int param_types[])