Chemical Data Processing Library C++ API - Version 1.4.0
BasicPharmacophore.hpp
Go to the documentation of this file.
1 /*
2  * BasicPharmacophore.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_PHARM_BASICPHARMACOPHORE_HPP
30 #define CDPL_PHARM_BASICPHARMACOPHORE_HPP
31 
32 #include <vector>
33 
34 #include <boost/iterator/indirect_iterator.hpp>
35 
36 #include "CDPL/Pharm/APIPrefix.hpp"
39 #include "CDPL/Util/ObjectPool.hpp"
40 
41 
42 namespace CDPL
43 {
44 
45  namespace Pharm
46  {
47 
56  {
57 
59  typedef FeatureCache::SharedObjectPointer FeaturePointer;
60  typedef std::vector<FeaturePointer> FeatureList;
61 
62  public:
66  typedef std::shared_ptr<BasicPharmacophore> SharedPointer;
67 
71  typedef boost::indirect_iterator<FeatureList::iterator, BasicFeature> FeatureIterator;
72 
76  typedef boost::indirect_iterator<FeatureList::const_iterator, const BasicFeature> ConstFeatureIterator;
77 
82 
88 
94 
100  explicit BasicPharmacophore(const FeatureContainer& cntnr);
101 
108 
109  void clear();
110 
111  std::size_t getNumFeatures() const;
112 
118 
124 
130 
136 
137  const BasicFeature& getFeature(std::size_t idx) const;
138 
139  BasicFeature& getFeature(std::size_t idx);
140 
142 
143  void removeFeature(std::size_t idx);
144 
152 
153  bool containsFeature(const Feature& feature) const;
154 
155  std::size_t getFeatureIndex(const Feature& feature) const;
156 
167 
168  using Pharmacophore::operator=;
169 
180 
181  using Pharmacophore::operator+=;
182 
184 
190  void copy(const BasicPharmacophore& pharm);
191 
192  void copy(const Pharmacophore& pharm);
193 
194  void copy(const FeatureContainer& cntnr);
195 
202  void append(const BasicPharmacophore& pharm);
203 
204  void append(const Pharmacophore& pharm);
205 
206  void append(const FeatureContainer& cntnr);
207 
208  void remove(const FeatureContainer& cntnr);
209 
211 
212  private:
213  template <typename T>
214  void doCopy(const T& pharm);
215 
216  template <typename T>
217  void doAppend(const T& pharm);
218 
219  void clearFeatures();
220 
221  void renumberFeatures(std::size_t idx);
222 
223  BasicFeature* createFeature();
224 
225  static void destroyFeature(BasicFeature* feature);
226  static void clearFeature(BasicFeature& feature);
227 
228  FeatureCache featureCache;
229  FeatureList features;
230  };
231  } // namespace Pharm
232 } // namespace CDPL
233 
234 #endif // CDPL_PHARM_BASICPHARMACOPHORE_HPP
Definition of class CDPL::Pharm::BasicFeature.
Definition of class CDPL::Util::ObjectPool.
Definition of the preprocessor macro CDPL_PHARM_API.
#define CDPL_PHARM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of class CDPL::Pharm::Pharmacophore.
Default implementation of the Pharm::Feature interface.
Definition: BasicFeature.hpp:50
Default implementation of the Pharm::Pharmacophore interface.
Definition: BasicPharmacophore.hpp:56
void clear()
Removes all features and clears all properties of the pharmacophore.
ConstFeatureIterator getFeaturesBegin() const
Returns a constant iterator pointing to the beginning of the stored const Pharm::BasicFeature objects...
void copy(const FeatureContainer &cntnr)
Replaces the current set of pharmacophore features and properties by a copy of the features and prope...
ConstFeatureIterator getFeaturesEnd() const
Returns a constant iterator pointing to the end of the stored const Pharm::BasicFeature objects.
void remove(const FeatureContainer &cntnr)
Removes the pharmacophore features referenced by the feature container cntnr from this instance.
void removeFeature(std::size_t idx)
Removes the pharmacophore feature at the specified index.
boost::indirect_iterator< FeatureList::iterator, BasicFeature > FeatureIterator
A mutable random access iterator used to iterate over the stored Pharm::BasicFeature objects.
Definition: BasicPharmacophore.hpp:71
BasicPharmacophore(const BasicPharmacophore &pharm)
Constructs a BasicPharmacophore instance that is a copy of the pharmacophore pharm.
BasicPharmacophore(const FeatureContainer &cntnr)
Constructs a BasicPharmacophore instance with copies of the features and properties provided by the f...
bool containsFeature(const Feature &feature) const
Tells whether the specified feature is part of the feature set.
BasicPharmacophore & operator=(const BasicPharmacophore &pharm)
Replaces the current set of features by a copy of the features and properties of the pharmacophore ph...
BasicFeature & getFeature(std::size_t idx)
Returns a non-const reference to the feature at index idx.
BasicFeature & addFeature()
Creates a new pharmacophore feature and adds it to the pharmacophore.
void copy(const BasicPharmacophore &pharm)
Replaces the current set of features and properties by a copy of the features and properties of the p...
Pharmacophore::SharedPointer clone() const
Creates a deep copy of the current pharmacophore state.
boost::indirect_iterator< FeatureList::const_iterator, const BasicFeature > ConstFeatureIterator
A constant random access iterator used to iterate over the stored const Pharm::BasicFeature objects.
Definition: BasicPharmacophore.hpp:76
std::size_t getFeatureIndex(const Feature &feature) const
Returns the index of the specified feature.
std::size_t getNumFeatures() const
Returns the number of features.
std::shared_ptr< BasicPharmacophore > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated BasicPharmacophore instances.
Definition: BasicPharmacophore.hpp:66
void copy(const Pharmacophore &pharm)
Replaces the current set of pharmacophore features and properties by a copy of the features and prope...
void orderFeatures(const FeatureCompareFunction &func)
Orders the features according to criteria implemented by the provided feature comparison function.
void append(const BasicPharmacophore &pharm)
Extends the current set of features by a copy of the features in the pharmacophore pharm.
BasicPharmacophore & operator+=(const BasicPharmacophore &pharm)
Extends the current set of features by a copy of the features in the pharmacophore pharm.
FeatureIterator removeFeature(const FeatureIterator &it)
Removes the pharmacophore feature specified by the iterator it.
BasicPharmacophore()
Constructs an empty BasicPharmacophore instance.
void append(const FeatureContainer &cntnr)
Extends the current set of pharmacophore features by a copy of the features in the feature container ...
FeatureIterator getFeaturesEnd()
Returns a mutable iterator pointing to the end of the stored Pharm::BasicFeature objects.
FeatureIterator getFeaturesBegin()
Returns a mutable iterator pointing to the beginning of the stored Pharm::BasicFeature objects.
BasicPharmacophore(const Pharmacophore &pharm)
Constructs a BasicPharmacophore instance that is a copy of the pharmacophore pharm.
const BasicFeature & getFeature(std::size_t idx) const
Returns a const reference to the feature at index idx.
void append(const Pharmacophore &pharm)
Extends the current set of features by a copy of the features in the pharmacophore pharm.
Common interface for data structures that support a random access to stored Pharm::Feature instances.
Definition: FeatureContainer.hpp:57
Abstract base class representing a single pharmacophore feature.
Definition: Feature.hpp:48
Abstract base class for mutable containers of Pharm::Feature instances representing a pharmacophore m...
Definition: Pharmacophore.hpp:52
std::shared_ptr< Pharmacophore > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated Pharmacophore instances.
Definition: Pharmacophore.hpp:58
std::shared_ptr< ObjectType > SharedObjectPointer
A smart pointer to a borrowed object that returns the object to the pool on destruction.
Definition: ObjectPool.hpp:71
constexpr unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
std::function< bool(const Feature &, const Feature &)> FeatureCompareFunction
Generic wrapper class used to store a user-defined feature compare function.
Definition: FeatureCompareFunction.hpp:41
The namespace of the Chemical Data Processing Library.