IMP  2.4.0
The Integrative Modeling Platform
distance_pair_score_macros.h
Go to the documentation of this file.
1 /**
2  * \file IMP/score_functor/distance_pair_score_macros.h
3  * \brief Various important macros
4  * for implementing decorators.
5  *
6  * Copyright 2007-2015 IMP Inventors. All rights reserved.
7  *
8  */
9 
10 #ifndef IMPSCORE_FUNCTOR_DISTANCE_PAIR_SCORE_MACROS_H
11 #define IMPSCORE_FUNCTOR_DISTANCE_PAIR_SCORE_MACROS_H
12 
13 #include "DistancePairScore.h"
14 
15 #if defined(SWIG) || defined(IMP_DOXYGEN)
16 /** Use this macro to define PairScores based on the
17  IMP::score_functor::DistancePairScore as it works around various
18  complications caused by SWIG.
19 
20  To use it do something like
21  IMP_FUNCTOR_DISTANCE_PAIR_SCORE(DistancePairScore,
22  score_functor::UnaryFunctionEvaluate,
23  (UnaryFunction *uf, std::string name
24  = "DistancePairScore%1%"), (uf));
25  */
26 #define IMP_FUNCTOR_DISTANCE_PAIR_SCORE(Name, Functor, Args, PassArgs) \
27  class Name : public IMP::PairScore { \
28  typedef IMP::score_functor::DistancePairScore<Functor> P; \
29  \
30  public: \
31  Name Args; \
32  double evaluate_index(kernel::Model *m, \
33  const kernel::ParticleIndexPair &pip, \
34  DerivativeAccumulator *da) const; \
35  kernel::ModelObjectsTemp do_get_inputs( \
36  kernel::Model *m, const kernel::ParticleIndexes &pis) const; \
37  IMP_OBJECT_METHODS(Name); \
38  }
39 
40 #else
41 #define IMP_FUNCTOR_DISTANCE_PAIR_SCORE(Name, Functor, Args, PassArgs) \
42  class Name : public IMP::score_functor::DistancePairScore<Functor> { \
43  typedef IMP::score_functor::DistancePairScore<Functor> P; \
44  \
45  public: \
46  Name Args : P(Functor PassArgs, name) {} \
47  }
48 #endif
49 
50 #endif /* IMPSCORE_FUNCTOR_DISTANCE_PAIR_SCORE_MACROS_H */
A Score on the distance between a pair of particles.