IMP  2.3.0
The Integrative Modeling Platform
Resolution.h
Go to the documentation of this file.
1 /**
2  * \file IMP/pmi/Resolution.h
3  * \brief A decorator for particles with resolution
4  *
5  * Copyright 2007-2014 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPPMI_RESOLUTION_H
9 #define IMPPMI_RESOLUTION_H
10 
11 #include <IMP/pmi/pmi_config.h>
12 
13 #include <IMP/PairContainer.h>
14 #include <IMP/SingletonContainer.h>
15 #include <IMP/Decorator.h>
16 #include <IMP/decorator_macros.h>
17 
18 IMPPMI_BEGIN_NAMESPACE
19 
20 //! Add resolution to a particle
21 /** The resolution of the particle is assumed to be in number of residues.
22  */
23 class IMPPMIEXPORT Resolution : public Decorator {
24  static void do_setup_particle(Model *m, ParticleIndex pi, double resolution) {
25  m->add_attribute(get_resolution_key(), pi, resolution);
26  }
27  public:
28 
29  static bool get_is_setup(Model *m, ParticleIndex pi) {
30  return m->get_has_attribute(get_resolution_key(), pi);
31  }
32 
33  Float get_resolution() const {
34  return get_model()->get_attribute(get_resolution_key(),
36  }
37 
38  void set_resolution(Float d) { get_model()->set_attribute(get_resolution_key(),
40  d); }
41 
43  /** Add the specified resolution to the particle. */
45 
46  static FloatKey get_resolution_key();
47 };
48 
49 IMPPMI_END_NAMESPACE
50 
51 #endif /* IMPPMI_RESOLUTION_H */
Import IMP/kernel/Decorator.h in the namespace.
ParticleIndex get_particle_index() const
Returns the particle index decorated by this decorator.
Import IMP/kernel/SingletonContainer.h in the namespace.
#define IMP_DECORATOR_METHODS(Name, Parent)
double get_resolution(kernel::Model *m, kernel::ParticleIndex pi)
Model * get_model() const
Returns the Model containing the particle.
Type get_attribute(TypeKey attribute_key, ParticleIndex particle)
Add resolution to a particle.
Definition: Resolution.h:23
Import IMP/kernel/PairContainer.h in the namespace.
Import IMP/kernel/decorator_macros.h in the namespace.
void set_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:20
void add_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73