IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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-2026 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#include <cereal/access.hpp>
15#include <cereal/types/base_class.hpp>
16
17#if defined(SWIG) || defined(IMP_DOXYGEN)
18/** Use this macro to define PairScores based on the
19 IMP::score_functor::DistancePairScore as it works around various
20 complications caused by SWIG.
21
22 To use it do something like
23 IMP_FUNCTOR_DISTANCE_PAIR_SCORE(DistancePairScore,
24 score_functor::UnaryFunctionEvaluate,
25 (UnaryFunction *uf, std::string name
26 = "DistancePairScore%1%"), (uf), );
27 */
28#define IMP_FUNCTOR_DISTANCE_PAIR_SCORE(Name, Functor, Args, PassArgs, Accessors) \
29 class Name : public IMP::PairScore { \
30 typedef IMP::score_functor::DistancePairScore<Functor> P; \
31 \
32 public: \
33 Name Args; \
34 Name() {} \
35 double evaluate_index(Model *m, \
36 const ParticleIndexPair &pip, \
37 DerivativeAccumulator *da) const; \
38 ModelObjectsTemp do_get_inputs( \
39 Model *m, const ParticleIndexes &pis) const; \
40 Functor& get_score_functor(); \
41 const Functor& get_score_functor() const; \
42 Accessors \
43 IMP_OBJECT_METHODS(Name); \
44 }
45
46#else
47#define IMP_FUNCTOR_DISTANCE_PAIR_SCORE(Name, Functor, Args, PassArgs, Accessors) \
48 class Name : public IMP::score_functor::DistancePairScore<Functor> { \
49 typedef IMP::score_functor::DistancePairScore<Functor> P; \
50 friend class cereal::access; \
51 template<class Archive> void serialize(Archive &ar) { \
52 ar(cereal::base_class< \
53 IMP::score_functor::DistancePairScore<Functor>>(this)); \
54 } \
55 IMP_OBJECT_SERIALIZE_DECL(Name); \
56 \
57 public: \
58 Name Args : P(Functor PassArgs, name) {} \
59 Name() {} \
60 Accessors \
61 IMP_OBJECT_METHODS(Name); \
62 }
63#endif
64
65#endif /* IMPSCORE_FUNCTOR_DISTANCE_PAIR_SCORE_MACROS_H */
A Score on the distance between a pair of particles.