IMP  2.1.1
The Integrative Modeling Platform
AllPairContainer.h
Go to the documentation of this file.
1 /**
2  * \file IMP/container/AllPairContainer.h
3  * \brief Return all pairs from a SingletonContainer
4  *
5  * This file is generated by a script (core/tools/make-container).
6  * Do not edit directly.
7  *
8  * Copyright 2007-2013 IMP Inventors. All rights reserved.
9  */
10 
11 #ifndef IMPCONTAINER_ALL_PAIR_CONTAINER_H
12 #define IMPCONTAINER_ALL_PAIR_CONTAINER_H
13 
14 #include <IMP/container/container_config.h>
15 #include <IMP/generic.h>
16 #include <IMP/PairContainer.h>
17 #include <IMP/SingletonContainer.h>
19 #include <IMP/base/Pointer.h>
20 #include <IMP/pair_macros.h>
21 IMPCONTAINER_BEGIN_NAMESPACE
22 
23 //! Return all unordered pairs of particles taken from the SingletonContainer
24 /* See also AllBipartitePairContainer, ClosePairContainer,
25  CloseBipartitePairContainer for variants on the functionality provided.
26  */
27 class IMPCONTAINEREXPORT AllPairContainer : public PairContainer {
29  int c_version_;
30 
31  public:
32  template <class F>
33  void apply_generic(F* f) const {
34  validate_readable();
35  kernel::ParticleIndexes pis = c_->get_indexes();
36  for (unsigned int i = 0; i < pis.size(); ++i) {
37  for (unsigned int j = 0; j < i; ++j) {
38  f->apply_index(get_model(), kernel::ParticleIndexPair(pis[i], pis[j]));
39  }
40  }
41  }
42  //! Get the individual particles from the passed SingletonContainer
43  AllPairContainer(SingletonContainerAdaptor c,
44  std::string name = "AllPairContainer%1%");
45  virtual kernel::ParticleIndexPairs get_indexes() const IMP_OVERRIDE;
46  virtual kernel::ParticleIndexPairs get_range_indexes() const IMP_OVERRIDE;
47  virtual kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
48  virtual kernel::ParticleIndexes get_all_possible_indexes() const IMP_OVERRIDE;
49  virtual void do_before_evaluate() IMP_OVERRIDE;
52 };
53 
55 
56 IMPCONTAINER_END_NAMESPACE
57 
58 #endif /* IMPCONTAINER_ALL_PAIR_CONTAINER_H */
virtual ParticleIndexes get_all_possible_indexes() const =0
Get contained particles.
Import IMP/kernel/pair_macros.h in the namespace.
Import IMP/kernel/SingletonContainer.h in the namespace.
A nullptr-initialized pointer to an IMP Object.
A smart pointer to a ref-counted Object that is a class memeber.
Definition: base/Pointer.h:147
#define IMP_PAIR_CONTAINER_METHODS(Name)
A shared container for Pairs.
Return all unordered pairs of particles taken from the SingletonContainer.
virtual ParticleIndexPairs get_indexes() const =0
A class to store an fixed array of same-typed values.
Definition: base/Array.h:33
Import IMP/kernel/PairContainer.h in the namespace.
virtual ParticleIndexPairs get_range_indexes() const =0
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Store a list of ParticlePairsTemp.
#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.
virtual ModelObjectsTemp do_get_inputs() const =0
Import IMP/kernel/generic.h in the namespace.