IMP  2.1.1
The Integrative Modeling Platform
kernel/refiner_macros.h
Go to the documentation of this file.
1 /**
2  * \file IMP/kernel/refiner_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_REFINER_MACROS_H
10 #define IMPKERNEL_REFINER_MACROS_H
11 #include <IMP/kernel/kernel_config.h>
12 #include "Refiner.h"
13 #include "container_base.h"
14 #include <IMP/base/object_macros.h>
15 
16 /** \deprecated_at{2.1} Declare methods yourself.
17 */
18 #define IMP_REFINER(Name) \
19  IMPKERNEL_DEPRECATED_MACRO(2.1, "Declare methods yourself"); \
20  virtual bool get_can_refine(Particle *) const; \
21  virtual const ParticlesTemp get_refined(Particle *) const; \
22  virtual Particle *get_refined(Particle *, unsigned int) const; \
23  virtual unsigned int get_number_of_refined(Particle *) const; \
24  IMP_BACKWARDS_MACRO_INPUTS; \
25  IMP_OBJECT_NO_WARNING(Name)
26 
27 /** \deprecated_at{2.1} Declare methods yourself.
28 */
29 #define IMP_SIMPLE_REFINER(Name) \
30  IMPKERNEL_DEPRECATED_MACRO(2.1, "Declare methods yourself"); \
31  virtual bool get_can_refine(Particle *) const; \
32  virtual Particle *get_refined(Particle *, unsigned int) const; \
33  virtual const ParticlesTemp get_refined(Particle *a) const { \
34  ParticlesTemp ret(get_number_of_refined(a)); \
35  for (unsigned int i = 0; i < ret.size(); ++i) { \
36  ret[i] = get_refined(a, i); \
37  } \
38  return ret; \
39  } \
40  virtual unsigned int get_number_of_refined(Particle *) const; \
41  IMP_BACKWARDS_MACRO_INPUTS; \
42  IMP_OBJECT_NO_WARNING(Name)
43 
44 /** \deprecated_at{2.1} Just define the methods yourself.
45 */
46 #define IMP_SINGLETON_MODIFIER_FROM_REFINED(Name, refiner) \
47  IMPKERNEL_DEPRECATED_MACRO(2.1, "Define methods yourself"); \
48  ModelObjectsTemp Name::do_get_inputs(kernel::Model *m, \
49  const ParticleIndexes &pis) const { \
50  ModelObjectsTemp ret = refiner->get_inputs(m, pis); \
51  ret += IMP::kernel::get_particles(m, pis); \
52  for (unsigned int i = 0; i < pis.size(); ++i) { \
53  ret += \
54  IMP::kernel::get_particles(refiner->get_refined_indexes(m, pis[i])); \
55  } \
56  return ret; \
57  } \
58  ModelObjectsTemp Name::do_get_outputs(kernel::Model *m, \
59  const ParticleIndexes &pis) const { \
60  ModelObjectsTemp ret = IMP::kernel::get_particles(m, pis); \
61  return ret; \
62  } \
63  IMP_REQUIRE_SEMICOLON_NAMESPACE
64 
65 /** \deprecated_at{2.1} Just define the methods yourself.
66 */
67 #define IMP_SINGLETON_MODIFIER_TO_REFINED(Name, refiner) \
68  IMPKERNEL_DEPRECATED_MACRO(2.1, "Define methods yourself"); \
69  ModelObjectsTemp Name::do_get_inputs(kernel::Model *m, \
70  const ParticleIndexes &pis) const { \
71  ModelObjectsTemp ret = refiner->get_inputs(m, pis); \
72  for (unsigned int i = 0; i < pis.size(); ++i) { \
73  ret += \
74  IMP::kernel::get_particles(refiner->get_refined_indexes(m, pis[i])); \
75  } \
76  ret += IMP::kernel::get_particles(m, pis); \
77  return ret; \
78  } \
79  ModelObjectsTemp Name::do_get_outputs(kernel::Model *m, \
80  const ParticleIndexes &pis) const { \
81  ModelObjectsTemp ret; \
82  for (unsigned int i = 0; i < pis.size(); ++i) { \
83  ret += \
84  IMP::kernel::get_particles(refiner->get_refined_indexes(m, pis[i])); \
85  } \
86  return ret; \
87  } \
88  IMP_REQUIRE_SEMICOLON_NAMESPACE
89 
90 #endif /* IMPKERNEL_REFINER_MACROS_H */
Abstract base class for containers of particles.
Refine a particle into a list of particles.
Various general useful macros for IMP.