IMP  2.3.1
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-2014 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/kernel/Particle.h>
17 #include <IMP/kernel/Model.h>
18 #include <IMP/Decorator.h>
19 
20 IMPATOM_BEGIN_NAMESPACE
21 
22 //! A decorator for a molecule.
23 /** */
24 class IMPATOMEXPORT Molecule : public Hierarchy {
25  static IntKey key();
26  static void do_setup_particle(kernel::Model *m, kernel::ParticleIndex pi,
27  Molecule = Molecule()) {
28  if (!Hierarchy::get_is_setup(m, pi)) {
30  }
31  m->add_attribute(key(), pi, 1);
32  }
33 
34  public:
36  /** Mark the particle as denoting a molecule. */
39 
41  return m->get_has_attribute(key(), pi);
42  }
43 };
44 
45 IMP_DECORATORS(Molecule, Molecules, Hierarchies);
46 
47 /** Walk up the hierarchy to determine the molecule name. */
48 IMPATOMEXPORT std::string get_molecule_name(Hierarchy h);
49 
50 IMPATOM_END_NAMESPACE
51 
52 #endif /* IMPATOM_MOLECULE_H */
Import IMP/kernel/Decorator.h in the namespace.
A base class for Keys.
Definition: kernel/Key.h:46
Import IMP/kernel/base_types.h in the namespace.
#define IMP_DECORATOR_METHODS(Name, Parent)
static bool get_is_setup(kernel::Model *m, kernel::ParticleIndex p)
Decorator for helping deal with a hierarchy of molecules.
The standard decorator for manipulating molecular structures.
static Hierarchy setup_particle(kernel::Model *m, kernel::ParticleIndex pi, kernel::ParticleIndexesAdaptor children=kernel::ParticleIndexesAdaptor())
#define IMP_DECORATOR_SETUP_0(Name)
Storage of a model, its restraints, constraints and particles.
Classes to handle individual model particles. (Note that implementation of inline functions in in int...
std::string get_molecule_name(Hierarchy h)
Various important macros for implementing decorators.
void add_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
A decorator for a molecule.
Definition: Molecule.h:24
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73