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:
63  typedef CategoryList::iterator CategoryIterator;
64 
68  typedef CategoryList::const_iterator ConstCategoryIterator;
69 
73  typedef RuleList::iterator RuleIterator;
74 
78  typedef RuleList::const_iterator ConstRuleIterator;
79 
84 
88  virtual ~TorsionCategory() {}
89 
94  const std::string& getName() const;
95 
100  void setName(const std::string& name);
101 
106  const std::string& getMatchPatternString() const;
107 
112  void setMatchPatternString(const std::string& ptn_str);
113 
119 
125 
130  unsigned int getBondAtom1Type() const;
131 
136  void setBondAtom1Type(unsigned int type);
137 
142  unsigned int getBondAtom2Type() const;
143 
148  void setBondAtom2Type(unsigned int type);
149 
155 
162 
168 
175 
181  std::size_t getNumCategories(bool recursive = false) const;
182 
188  std::size_t getNumRules(bool recursive = false) const;
189 
196  TorsionCategory& getCategory(std::size_t idx);
197 
204  const TorsionCategory& getCategory(std::size_t idx) const;
205 
212  TorsionRule& getRule(std::size_t idx);
213 
220  const TorsionRule& getRule(std::size_t idx) const;
221 
227  void removeCategory(std::size_t idx);
228 
234  void removeRule(std::size_t idx);
235 
241 
246  void removeRule(const RuleIterator& it);
247 
253 
259 
265 
271 
277 
283 
289 
295 
300  void swap(TorsionCategory& cat);
301 
305  void clear();
306 
307  private:
308  void checkCategoryIndex(std::size_t idx, bool it) const;
309 
310  void checkRuleIndex(std::size_t idx, bool it) const;
311 
312  std::string name;
313  std::string matchPatternStr;
315  unsigned int bondAtom1Type;
316  unsigned int bondAtom2Type;
317  RuleList rules;
318  CategoryList categories;
319  };
320  } // namespace ConfGen
321 } // namespace CDPL
322 
323 #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 match pattern molecular graph used to perceive the bonds that belong 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 match pattern describing the bonds that belong 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:78
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:88
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 match pattern describing the bonds that belong 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:63
void setMatchPattern(const Chem::MolecularGraph::SharedPointer &ptn)
Sets the match pattern molecular graph used to perceive the bonds that belong 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:73
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:68
Data structure for the representation of single torsion library rules.
Definition: TorsionRule.hpp:53
The namespace of the Chemical Data Processing Library.