Chemical Data Processing Library C++ API - Version 1.4.0
TorsionCategory.hpp
Go to the documentation of this file.
1 /*
2  * TorsionCategory.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_CONFGEN_TORSIONCATEGORY_HPP
30 #define CDPL_CONFGEN_TORSIONCATEGORY_HPP
31 
32 #include <string>
33 #include <cstddef>
34 
35 #include <boost/ptr_container/ptr_vector.hpp>
36 
40 
41 
42 namespace CDPL
43 {
44 
45  namespace ConfGen
46  {
47 
54  {
55 
56  typedef boost::ptr_vector<TorsionCategory> CategoryList;
57  typedef boost::ptr_vector<TorsionRule> RuleList;
58 
59  public:
61  typedef CategoryList::iterator CategoryIterator;
63  typedef CategoryList::const_iterator ConstCategoryIterator;
65  typedef RuleList::iterator RuleIterator;
67  typedef RuleList::const_iterator ConstRuleIterator;
68 
73 
77  virtual ~TorsionCategory() {}
78 
83  const std::string& getName() const;
84 
89  void setName(const std::string& name);
90 
95  const std::string& getMatchPatternString() const;
96 
101  void setMatchPatternString(const std::string& ptn_str);
102 
108 
114 
119  unsigned int getBondAtom1Type() const;
120 
125  void setBondAtom1Type(unsigned int type);
126 
131  unsigned int getBondAtom2Type() const;
132 
137  void setBondAtom2Type(unsigned int type);
138 
144 
151 
157 
164 
170  std::size_t getNumCategories(bool recursive = false) const;
171 
177  std::size_t getNumRules(bool recursive = false) const;
178 
185  TorsionCategory& getCategory(std::size_t idx);
186 
193  const TorsionCategory& getCategory(std::size_t idx) const;
194 
201  TorsionRule& getRule(std::size_t idx);
202 
209  const TorsionRule& getRule(std::size_t idx) const;
210 
216  void removeCategory(std::size_t idx);
217 
223  void removeRule(std::size_t idx);
224 
230 
235  void removeRule(const RuleIterator& it);
236 
242 
248 
254 
260 
266 
272 
278 
284 
289  void swap(TorsionCategory& cat);
290 
294  void clear();
295 
296  private:
297  void checkCategoryIndex(std::size_t idx, bool it) const;
298 
299  void checkRuleIndex(std::size_t idx, bool it) const;
300 
301  std::string name;
302  std::string matchPatternStr;
304  unsigned int bondAtom1Type;
305  unsigned int bondAtom2Type;
306  RuleList rules;
307  CategoryList categories;
308  };
309  } // namespace ConfGen
310 } // namespace CDPL
311 
312 #endif // CDPL_CONFGEN_TORSIONCATEGORY_HPP
Definition of the preprocessor macro CDPL_CONFGEN_API.
#define CDPL_CONFGEN_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of class CDPL::Chem::MolecularGraph.
Definition of class CDPL::ConfGen::TorsionRule.
std::shared_ptr< MolecularGraph > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MolecularGraph instances.
Definition: MolecularGraph.hpp:63
Represents a node of a hierarchical torsion library.
Definition: TorsionCategory.hpp:54
TorsionCategory & addCategory()
Creates and appends a new empty child category.
void removeCategory(const CategoryIterator &it)
Removes the child category referenced by it.
RuleIterator getRulesBegin()
Returns a mutable iterator pointing to the first contained rule.
void setBondAtom1Type(unsigned int type)
Sets the atom type of the first central bond atom required by this category.
void clear()
Removes all child categories and contained rules and resets the pattern/atom-type data.
ConstCategoryIterator getCategoriesBegin() const
Returns a constant iterator pointing to the first child category.
const Chem::MolecularGraph::SharedPointer & getMatchPattern() const
Returns the molecular graph pattern used to perceive bonds belonging to this category.
TorsionCategory()
Constructs an empty TorsionCategory instance.
void removeRule(std::size_t idx)
Removes the torsion rule at index idx.
unsigned int getBondAtom1Type() const
Returns the atom type of the first central bond atom required by this category.
std::size_t getNumCategories(bool recursive=false) const
Returns the number of child categories.
const std::string & getName() const
Returns the category name.
TorsionCategory & addCategory(const TorsionCategory &cat)
Appends a copy of cat as a child category.
const std::string & getMatchPatternString() const
Returns the SMARTS string used to perceive bonds belonging to this category.
void removeCategory(std::size_t idx)
Removes the child category at index idx.
const TorsionRule & getRule(std::size_t idx) const
Returns the torsion rule at index idx.
RuleList::const_iterator ConstRuleIterator
A constant iterator over the contained rules.
Definition: TorsionCategory.hpp:67
unsigned int getBondAtom2Type() const
Returns the atom type of the second central bond atom required by this category.
virtual ~TorsionCategory()
Virtual destructor.
Definition: TorsionCategory.hpp:77
TorsionRule & addRule()
Creates and appends a new empty torsion rule.
ConstRuleIterator getRulesBegin() const
Returns a constant iterator pointing to the first contained rule.
CategoryIterator getCategoriesBegin()
Returns a mutable iterator pointing to the first child category.
ConstRuleIterator getRulesEnd() const
Returns a constant iterator pointing one past the last contained rule.
void setMatchPatternString(const std::string &ptn_str)
Sets the SMARTS string used to perceive bonds belonging to this category.
void removeRule(const RuleIterator &it)
Removes the torsion rule referenced by it.
CategoryList::iterator CategoryIterator
A mutable iterator over the child categories.
Definition: TorsionCategory.hpp:61
void setMatchPattern(const Chem::MolecularGraph::SharedPointer &ptn)
Sets the molecular graph pattern used to perceive bonds belonging to this category.
const TorsionCategory & getCategory(std::size_t idx) const
Returns the child category at index idx.
TorsionRule & addRule(const TorsionRule &rule)
Appends a copy of rule as a contained torsion rule.
void setBondAtom2Type(unsigned int type)
Sets the atom type of the second central bond atom required by this category.
TorsionCategory & getCategory(std::size_t idx)
Returns the child category at index idx.
TorsionRule & getRule(std::size_t idx)
Returns the torsion rule at index idx.
CategoryIterator getCategoriesEnd()
Returns a mutable iterator pointing one past the last child category.
std::size_t getNumRules(bool recursive=false) const
Returns the number of contained torsion rules.
RuleList::iterator RuleIterator
A mutable iterator over the contained rules.
Definition: TorsionCategory.hpp:65
ConstCategoryIterator getCategoriesEnd() const
Returns a constant iterator pointing one past the last child category.
RuleIterator getRulesEnd()
Returns a mutable iterator pointing one past the last contained rule.
void setName(const std::string &name)
Sets the category name.
void swap(TorsionCategory &cat)
Swaps the contents of this category with cat.
CategoryList::const_iterator ConstCategoryIterator
A constant iterator over the child categories.
Definition: TorsionCategory.hpp:63
Data structure for the representation of single torsion library rules.
Definition: TorsionRule.hpp:53
The namespace of the Chemical Data Processing Library.