IMP  2.0.0
The Integrative Modeling Platform
Molecule.h
Go to the documentation of this file.
1 /**
2  * \file IMP/atom/Molecule.h \brief A decorator for Molecules.
3  *
4  * Copyright 2007-2013 IMP Inventors. All rights reserved.
5  *
6  */
7 
8 #ifndef IMPATOM_MOLECULE_H
9 #define IMPATOM_MOLECULE_H
10 
11 #include <IMP/atom/atom_config.h>
12 #include "atom_macros.h"
13 #include "Hierarchy.h"
14 
15 #include <IMP/base_types.h>
16 #include <IMP/Particle.h>
17 #include <IMP/Model.h>
18 #include <IMP/Decorator.h>
19 
20 IMPATOM_BEGIN_NAMESPACE
21 
22 
23 //! A decorator for a molecule.
24 /** */
25 class IMPATOMEXPORT Molecule: public Hierarchy
26 {
27  static IntKey key();
28 public:
30  //! Add the required attributes to the particle and create a Molecule
32  if (!Hierarchy::particle_is_instance(p)) {
33  Hierarchy::setup_particle(p);
34  }
35  p->add_attribute(key(),1);
36  return Molecule(p);
37  }
38 
39  //! Copy data from the other Molecule to the particle p
41  return setup_particle(p);
42  }
43 
44  static bool particle_is_instance(Particle *p) {
45  return p->has_attribute(key());
46  }
47 };
48 
49 IMP_DECORATORS(Molecule,Molecules, Hierarchies);
50 
51 IMPATOM_END_NAMESPACE
52 
53 #endif /* IMPATOM_MOLECULE_H */