IMP
2.0.1
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
kernel/input_output_macros.h
Go to the documentation of this file.
1
/**
2
* \file IMP/kernel/input_output_macros.h
3
* \brief macros for inputs and outputs.
4
*
5
* Copyright 2007-2013 IMP Inventors. All rights reserved.
6
*
7
*/
8
9
#ifndef IMPKERNEL_INPUT_OUTPUT_MACROS_H
10
#define IMPKERNEL_INPUT_OUTPUT_MACROS_H
11
#include <IMP/kernel/kernel_config.h>
12
#include <
IMP/base/deprecation_macros.h
>
13
#include "
particle_index.h
"
14
#include "
input_output.h
"
15
16
17
#define IMP_BACKWARDS_MACRO_INPUTS \
18
public: \
19
IMP_IMPLEMENT(ParticlesTemp get_input_particles(Particle*) const); \
20
IMP_IMPLEMENT(ContainersTemp get_input_containers(Particle*) const); \
21
IMP_IMPLEMENT_INLINE(ModelObjectsTemp \
22
do_get_inputs(Model *m, \
23
const ParticleIndexes &pis) const, { \
24
ModelObjectsTemp ret; \
25
for (unsigned int i=0; i< pis.size(); ++i) { \
26
ret+=get_input_particles(m->get_particle(pis[i])); \
27
ret+=get_input_containers(m->get_particle(pis[i])); \
28
} \
29
return ret; \
30
})
31
32
#define IMP_BACKWARDS_MACRO_OUTPUTS \
33
public: \
34
IMP_IMPLEMENT(ParticlesTemp get_output_particles(Particle*) const); \
35
IMP_IMPLEMENT(ContainersTemp get_output_containers(Particle*) const); \
36
IMP_IMPLEMENT_INLINE(ModelObjectsTemp \
37
do_get_outputs(Model *m, \
38
const ParticleIndexes &pis) \
39
const, { \
40
ModelObjectsTemp ret; \
41
for (unsigned int i=0; i< pis.size(); ++i) { \
42
ret+=get_output_particles(m->get_particle(pis[i])); \
43
ret+=get_output_containers(m->get_particle(pis[i]));\
44
} \
45
return ret; \
46
})
47
48
#define IMP_MODEL_OBJECT_BACKWARDS_MACRO_INPUTS \
49
public: \
50
IMP_IMPLEMENT(ParticlesTemp get_input_particles() const); \
51
IMP_IMPLEMENT(ContainersTemp get_input_containers() const); \
52
IMP_IMPLEMENT_INLINE(ModelObjectsTemp \
53
do_get_inputs() const, { \
54
ModelObjectsTemp ret; \
55
ret += get_input_containers(); \
56
ret += get_input_particles(); \
57
return ret; \
58
})
59
60
#define IMP_MODEL_OBJECT_BACKWARDS_MACRO_OUTPUTS \
61
public: \
62
IMP_IMPLEMENT(ParticlesTemp get_output_particles() const); \
63
IMP_IMPLEMENT(ContainersTemp get_output_containers() const); \
64
IMP_IMPLEMENT_INLINE(ModelObjectsTemp \
65
do_get_outputs() const , { \
66
ModelObjectsTemp ret; \
67
ret += get_output_containers(); \
68
ret += get_output_particles(); \
69
return ret; \
70
})
71
72
#if IMP_HAS_DEPRECATED
73
#define IMP_INPUTS_DECL_BACKWARDS(Name) \
74
public: \
75
/** Get the set of particles read when applied to the arguments.
76
\deprecated use get_inputs() instead.*/
\
77
IMP_DEPRECATED_WARN ParticlesTemp \
78
get_input_particles(Particle* p) const; \
79
/** Get the set of input containers when this modifier is applied to
80
the arguments.
81
\deprecated use get_outputs() instead.*/
\
82
IMP_DEPRECATED_WARN ContainersTemp \
83
get_input_containers(Particle *p) const
84
85
#define IMP_INPUTS_DEF_BACKWARDS(Name) \
86
ParticlesTemp \
87
Name::get_input_particles(Particle* p) const { \
88
return \
89
IMP::kernel::get_input_particles(get_inputs(p->get_model(), \
90
ParticleIndexes(1, \
91
p->get_index()))); \
92
} \
93
ContainersTemp \
94
Name::get_input_containers(Particle *p) const { \
95
return \
96
IMP::kernel::get_input_containers(get_inputs(p->get_model(), \
97
ParticleIndexes(1, \
98
p->get_index()))); \
99
}
100
101
102
#define IMP_OUTPUTS_DECL_BACKWARDS(Name) \
103
public: \
104
/** Get the set of particles read when applied to the arguments.
105
\deprecated use get_outputs() instead.*/
\
106
IMP_DEPRECATED_WARN ParticlesTemp \
107
get_output_particles(Particle* p) const; \
108
/** Get the set of output containers when this modifier is applied to
109
the arguments.
110
\deprecated use get_outputs() instead.*/
\
111
IMP_DEPRECATED_WARN ContainersTemp \
112
get_output_containers(Particle *p) const
113
114
#define IMP_OUTPUTS_DEF_BACKWARDS(Name) \
115
ParticlesTemp \
116
Name::get_output_particles(Particle* p) const { \
117
return \
118
IMP::kernel::get_output_particles(get_outputs(p->get_model(), \
119
ParticleIndexes(1, \
120
p->get_index()))); \
121
} \
122
ContainersTemp \
123
Name::get_output_containers(Particle *p) const { \
124
return \
125
IMP::kernel::get_output_containers(get_outputs(p->get_model(), \
126
ParticleIndexes(1, \
127
p->get_index()))); \
128
}
129
130
#else
131
#define IMP_INPUTS_DECL_BACKWARDS(Name)
132
#define IMP_INPUTS_DEF_BACKWARDS(Name)
133
#define IMP_OUTPUTS_DECL_BACKWARDS(Name)
134
#define IMP_OUTPUTS_DEF_BACKWARDS(Name)
135
136
#endif
137
138
/** Declare standard input methods for things that take particles as arguments
139
such as IMP::SingletonModifier and IMP::PairScore.*/
140
#define IMP_INPUTS_DECL(Name) \
141
IMP_INPUTS_DECL_BACKWARDS(Name); \
142
public: \
143
/** Get all the ModelObject objects that are read when the referenced
144
particles are passed in.*/
\
145
ModelObjectsTemp get_inputs(Model *m, \
146
const ParticleIndexes &pis) const; \
147
/** Override if this reads other objects during evaluate.*/
\
148
IMP_PROTECTED_METHOD(virtual ModelObjectsTemp, do_get_inputs, \
149
(Model *m, \
150
const ParticleIndexes &pis), const, =0)
151
152
/** Define standard input methods for things that take particles as arguments
153
such as IMP::SingletonModifier and IMP::PairScore.*/
154
#define IMP_INPUTS_DEF(Name) \
155
IMP_INPUTS_DEF_BACKWARDS(Name) \
156
ModelObjectsTemp Name::get_inputs(Model *m, \
157
const ParticleIndexes &pis) const { \
158
return do_get_inputs(m, pis); \
159
}
160
161
162
163
/** Declare standard output methods for things that take particles as arguments
164
such as IMP::SingletonModifier and IMP::PairScore.*/
165
#define IMP_OUTPUTS_DECL(Name) \
166
IMP_OUTPUTS_DECL_BACKWARDS(Name); \
167
public: \
168
/** Get all the ModelObject objects that are read when the referenced
169
particles are passed in.*/
\
170
ModelObjectsTemp get_outputs(Model *m, \
171
const ParticleIndexes &pis) const; \
172
/** Override if this reads other objects during evaluate.*/
\
173
IMP_PROTECTED_METHOD(virtual ModelObjectsTemp, do_get_outputs, \
174
(Model *m, \
175
const ParticleIndexes &pis), const, =0)
176
177
/** Define standard output methods for things that take particles as arguments
178
such as IMP::SingletonModifier and IMP::PairScore.*/
179
#define IMP_OUTPUTS_DEF(Name) \
180
IMP_OUTPUTS_DEF_BACKWARDS(Name) \
181
ModelObjectsTemp Name::get_outputs(Model *m, \
182
const ParticleIndexes &pis) const { \
183
return do_get_outputs(m, pis); \
184
}
185
186
187
#endif
/* IMPKERNEL_INPUT_OUTPUT_MACROS_H */