IMP  2.2.0
The Integrative Modeling Platform
BondPairContainer.h
Go to the documentation of this file.
1 /**
2  * \file IMP/atom/BondPairContainer.h
3  * \brief A fake container for bonds
4  *
5  * Copyright 2007-2014 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPATOM_BOND_PAIR_CONTAINER_H
9 #define IMPATOM_BOND_PAIR_CONTAINER_H
10 
11 #include <IMP/atom/atom_config.h>
12 #include "bond_decorators.h"
13 #include <IMP/generic.h>
14 #include <IMP/PairContainer.h>
15 #include <IMP/PairModifier.h>
16 #include <IMP/PairScore.h>
17 #include <IMP/SingletonContainer.h>
18 #include <IMP/scoped.h>
19 #include <IMP/kernel/internal/container_helpers.h>
20 #include <IMP/core/PairRestraint.h>
21 
22 IMPATOM_BEGIN_NAMESPACE
23 
24 //! A container that returns pairs of the endpoints of the bonds.
25 /** Turn a container of Bond particles into a container of kernel::ParticlePair
26  objects of the endpoints.
27  \ingroup bond
28  \see Bonded
29  */
30 class IMPATOMEXPORT BondPairContainer : public PairContainer {
32 
33  virtual std::size_t do_get_contents_hash() const IMP_OVERRIDE {
34  return sc_->get_contents_hash();
35  }
36 
37  public:
38  template <class F>
39  void apply_generic(F* f) const {
40  IMP_FOREACH(kernel::ParticleIndex pi, sc_->get_contents()) {
41  Bond bp(get_model(), pi);
42  f->apply_index(get_model(), kernel::ParticleIndexPair(
45  }
46  }
47 
48  //! The container containing the bonds
50 
51  virtual kernel::ParticleIndexPairs get_indexes() const IMP_OVERRIDE;
52  virtual kernel::ParticleIndexPairs get_range_indexes() const IMP_OVERRIDE;
53  virtual kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE {
54  return kernel::ModelObjects(1, sc_);
55  }
59 };
60 
62 
63 IMPATOM_END_NAMESPACE
64 
65 #endif /* IMPATOM_BOND_PAIR_CONTAINER_H */
ParticleIndex get_particle_index() const
Import IMP/kernel/scoped.h in the namespace.
virtual ParticleIndexes get_all_possible_indexes() const =0
Get contained particles.
virtual kernel::ModelObjectsTemp do_get_inputs() const
IMP::base::Vector< IMP::base::Pointer< kernel::ModelObject > > ModelObjects
Import IMP/kernel/SingletonContainer.h in the namespace.
A smart pointer to a ref-counted Object that is a class memeber.
Definition: base/Pointer.h:147
#define IMP_PAIR_CONTAINER_METHODS(Name)
virtual kernel::ParticleIndexPairs get_indexes() const =0
A shared container for Pairs.
Contains decorators for a bond.
A class to store an fixed array of same-typed values.
Definition: base/Array.h:33
Import IMP/kernel/PairContainer.h in the namespace.
A decorator for wrapping a particle representing a molecular bond.
Import IMP/kernel/PairScore.h in the namespace.
virtual kernel::ParticleIndexPairs get_range_indexes() const =0
Import IMP/kernel/PairModifier.h in the namespace.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Bonded get_bonded(unsigned int i) const
Get the atom i of the bond.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
void apply_generic(const PairModifier *m) const
Just use apply() in the base class.
A container that returns pairs of the endpoints of the bonds.
A shared container for Singletons.
Apply a PairScore to a Pair.
Import IMP/kernel/generic.h in the namespace.