Chemical Data Processing Library C++ API - Version 1.2.0
InteractionAnalyzer.hpp
Go to the documentation of this file.
1 /*
2  * InteractionAnalyzer.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_INTERACTIONANALYZER_HPP
30 #define CDPL_PHARM_INTERACTIONANALYZER_HPP
31 
32 #include <utility>
33 #include <map>
34 #include <functional>
35 
36 #include "CDPL/Pharm/APIPrefix.hpp"
38 
39 
40 namespace CDPL
41 {
42 
43  namespace Pharm
44  {
45 
46  class FeatureContainer;
47  class Feature;
48 
53  {
54 
55  public:
59  typedef std::function<bool(const Feature&, const Feature&)> ConstraintFunction;
60 
65 
69  virtual ~InteractionAnalyzer() {}
70 
78  void setConstraintFunction(unsigned int type1, unsigned type2, const ConstraintFunction& func);
79 
85  void removeConstraintFunction(unsigned int type1, unsigned type2);
86 
93  const ConstraintFunction& getConstraintFunction(unsigned int type1, unsigned type2) const;
94 
115  void analyze(const FeatureContainer& cntnr1, const FeatureContainer& cntnr2, FeatureMapping& iactions, bool append = false) const;
116 
117  private:
118  typedef std::pair<unsigned int, unsigned int> FeatureTypePair;
119  typedef std::map<FeatureTypePair, ConstraintFunction> ConstraintFunctionMap;
120 
121  ConstraintFunctionMap constraintFuncMap;
122  };
123  } // namespace Pharm
124 } // namespace CDPL
125 
126 #endif // CDPL_PHARM_INTERACTIONANALYZER_HPP
Definition of the type CDPL::Pharm::FeatureMapping.
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.
FeatureContainer.
Definition: FeatureContainer.hpp:53
A data type for the storage and lookup of arbitrary feature to feature mappings.
Definition: FeatureMapping.hpp:54
Feature.
Definition: Feature.hpp:48
InteractionAnalyzer.
Definition: InteractionAnalyzer.hpp:53
void analyze(const FeatureContainer &cntnr1, const FeatureContainer &cntnr2, FeatureMapping &iactions, bool append=false) const
Analyzes possible interactions of the features in feature container cntnr1 and with features of cntnr...
InteractionAnalyzer()
Constructs the InteractionAnalyzer instance.
Definition: InteractionAnalyzer.hpp:64
virtual ~InteractionAnalyzer()
Virtual destructor.
Definition: InteractionAnalyzer.hpp:69
void removeConstraintFunction(unsigned int type1, unsigned type2)
Removes the constraint check function that was registered for the specified pair of feature types.
std::function< bool(const Feature &, const Feature &)> ConstraintFunction
A generic wrapper class used to store feature interaction constraint test functions.
Definition: InteractionAnalyzer.hpp:59
const ConstraintFunction & getConstraintFunction(unsigned int type1, unsigned type2) const
Returns the constraint check function that was registered for the specified pair of feature types.
void setConstraintFunction(unsigned int type1, unsigned type2, const ConstraintFunction &func)
Specifies a function that gets used for checking whether all constraints are actually fulfilled for a...
The namespace of the Chemical Data Processing Library.