IMP logo
IMP Reference Guide  2.6.1
The Integrative Modeling Platform
AllBipartitePairContainer.h
Go to the documentation of this file.
1 /**
2  * \file IMP/container/AllBipartitePairContainer.h
3  * \brief Return all pairs from a SingletonContainer
4  *
5  * Copyright 2007-2016 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPCONTAINER_ALL_BIPARTITE_PAIR_CONTAINER_H
9 #define IMPCONTAINER_ALL_BIPARTITE_PAIR_CONTAINER_H
10 
11 #include <IMP/container/container_config.h>
12 
13 #include <IMP/PairContainer.h>
14 #include <IMP/SingletonContainer.h>
17 #include <IMP/pair_macros.h>
18 #include <IMP/singleton_macros.h>
19 #include <boost/functional/hash/hash.hpp>
20 
21 IMPCONTAINER_BEGIN_NAMESPACE
22 
23 //! Return all bipartite pairs between two containers
24 /** \see AllPairContainer, ClosePairContainer,
25  CloseBipartitePairContainer for variants on the functionality provided.
26  */
27 class IMPCONTAINEREXPORT AllBipartitePairContainer : public PairContainer {
29 
30  protected:
31  virtual std::size_t do_get_contents_hash() const IMP_OVERRIDE {
32  std::size_t ret = a_->get_contents_hash();
33  boost::hash_combine(ret, b_->get_contents_hash());
34  return ret;
35  }
36 
37  public:
38  template <class F>
39  void apply_generic(F* f) const {
40  validate_readable();
41  IMP_FOREACH(ParticleIndex pa, a_->get_contents()) {
42  IMP_FOREACH(ParticleIndex pb, b_->get_contents()) {
43  f->apply_index(get_model(), ParticleIndexPair(pa, pb));
44  }
45  }
46  }
49  std::string name = "AllBipartitePairContainer%1%");
56 };
57 
59 
60 IMPCONTAINER_END_NAMESPACE
61 
62 #endif /* IMPCONTAINER_ALL_BIPARTITE_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
Store a set of PairContainers.
Macros for various classes.
#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
virtual ParticleIndexes get_all_possible_indexes() const =0
Get contained particles.
virtual ParticleIndexPairs get_indexes() const =0
Return all bipartite pairs between two containers.
virtual ModelObjectsTemp do_get_inputs() const =0
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.