IMP logo
IMP Reference Guide  2.5.0
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-2015 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/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 AllBipartitePairContainer, ClosePairContainer,
25  CloseBipartitePairContainer for variants on the functionality provided.
26  */
27 class IMPCONTAINEREXPORT AllPairContainer : public PairContainer {
29 
30  protected:
31  virtual std::size_t do_get_contents_hash() const IMP_OVERRIDE {
32  return c_->get_contents_hash();
33  }
34 
35  public:
36  template <class F>
37  void apply_generic(F* f) const {
38  validate_readable();
39  const ParticleIndexes& pis = c_->get_contents();
40  for (unsigned int i = 0; i < pis.size(); ++i) {
41  for (unsigned int j = 0; j < i; ++j) {
42  f->apply_index(get_model(), ParticleIndexPair(pis[i], pis[j]));
43  }
44  }
45  }
46  //! Get the individual particles from the passed SingletonContainer
48  std::string name = "AllPairContainer%1%");
55 };
56 
58 
59 IMPCONTAINER_END_NAMESPACE
60 
61 #endif /* IMPCONTAINER_ALL_PAIR_CONTAINER_H */
virtual ParticleIndexPairs get_range_indexes() const =0
A shared container for Pairs.
Definition: PairContainer.h:37
Macros for various classes.
A container for Singletons.
void apply_generic(const PairModifier *m) const
Just use apply() in the base class.
A class to store an fixed array of same-typed values.
Definition: Array.h:33
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Return all unordered pairs of particles taken from the SingletonContainer.
#define IMP_PAIR_CONTAINER_METHODS(Name)
Definition: pair_macros.h:117
A container for Pairs.
A smart pointer to a ref-counted Object that is a class member.
Definition: Pointer.h:146
Store a list of ParticleIndexPairs.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Definition: object_macros.h:42
A nullptr-initialized pointer to an IMP Object.
virtual ParticleIndexes get_all_possible_indexes() const =0
Get contained particles.
virtual ParticleIndexPairs get_indexes() const =0
virtual ModelObjectsTemp do_get_inputs() const =0
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Various important functionality for implementing decorators.