IMP  2.0.0
The Integrative Modeling Platform
kernel/restraint_macros.h
Go to the documentation of this file.
1 /**
2  * \file IMP/kernel/restraint_macros.h
3  * \brief Various general useful macros for IMP.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPKERNEL_RESTRAINT_MACROS_H
10 #define IMPKERNEL_RESTRAINT_MACROS_H
11 #include <IMP/kernel/kernel_config.h>
14 #include "internal/scoring_functions.h"
15 #include "container_base.h"
16 #include "input_output_macros.h"
17 #include "constants.h"
18 
19 /** To implement a new restraint, just implement the two methods:
20 - IMP::Restraint::do_add_score_and_derivatives()
21  (or IMP::Restraint::unprotected_evaluate())
22 - IMP::ModelObjectsTemp::do_get_inputs();
23 and use the macro to handle IMP::base::Object
24 - IMP_OBJECT_METHODS()
25 */
26 #define IMP_RESTRAINT(Name) \
27  public: \
28  IMP_IMPLEMENT( double \
29  unprotected_evaluate(IMP::kernel::DerivativeAccumulator *accum) \
30  const); \
31  IMP_MODEL_OBJECT_BACKWARDS_MACRO_INPUTS; \
32  IMP_OBJECT(Name)
33 
34 #if IMP_HAS_DEPRECATED
35 //! For backwards compatibility
36 #define IMP_RESTRAINT_2(Name) \
37  public: \
38  IMP_IMPLEMENT( double \
39  unprotected_evaluate(IMP::kernel::DerivativeAccumulator *accum) \
40  const); \
41  IMP_IMPLEMENT(IMP::kernel::ModelObjectsTemp do_get_inputs() const); \
42  IMP_OBJECT(Name)
43 
44 //! For backwards compatability
45 #define IMP_RESTRAINT_ACCUMULATOR(Name) \
46  public: \
47  void do_add_score_and_derivatives(IMP::kernel::ScoreAccumulator sa) \
48  const; \
49  IMP::kernel::ModelObjectsTemp do_get_inputs() const; \
50  IMP_OBJECT(Name)
51 #endif
52 
53 #endif /* IMPKERNEL_RESTRAINT_MACROS_H */