IMP  2.1.1
The Integrative Modeling Platform
kernel/Particle.h
Go to the documentation of this file.
1 /**
2  * \file IMP/kernel/Particle.h
3  * \brief Classes to handle individual model particles.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPKERNEL_PARTICLE_H
10 #define IMPKERNEL_PARTICLE_H
11 
12 #include <IMP/kernel/kernel_config.h>
13 #include "declare_Particle.h"
14 #include "Model.h"
15 #include "Decorator.h"
16 
17 IMPKERNEL_BEGIN_NAMESPACE
18 
19 // for swig
20 class Decorator;
21 class Particle;
22 
23 /** Take Decorator or Particle. */
25  Model *m_;
26  ParticleIndex pi_;
27 
28  public:
29  ParticleAdaptor() : m_(nullptr), pi_() {}
30  ParticleAdaptor(Particle *p) : m_(p->get_model()), pi_(p->get_index()) {}
31  ParticleAdaptor(const Decorator &d)
32  : m_(d.get_model()), pi_(d.get_particle_index()) {}
33 #ifndef SWIG
35  : m_(p->get_model()), pi_(p->get_index()) {}
37  : m_(p->get_model()), pi_(p->get_index()) {}
39  : m_(p->get_model()), pi_(p->get_index()) {}
40 #endif
41  Model *get_model() const { return m_; }
42  ParticleIndex get_particle_index() const { return pi_; }
43 };
44 
45 IMPKERNEL_END_NAMESPACE
46 
47 #endif /* IMPKERNEL_PARTICLE_H */
Classes to handle individual model particles.
A smart pointer to a ref-counted Object that is a class memeber.
Definition: base/Pointer.h:147
The base class for decorators.
Model * get_model() const
Returns the Model containing the particle.
A smart pointer to a reference counted object.
Definition: base/Pointer.h:87
Class to handle individual model particles.
Storage of a model, its restraints, constraints and particles.
IMP::kernel::Particle Particle
IMP::kernel::Decorator Decorator
Class for storing model, its restraints, constraints, and particles.