IMP  2.4.0
The Integrative Modeling Platform
kernel/SingletonPredicate.h
Go to the documentation of this file.
1 /**
2  * \file IMP/kernel/SingletonPredicate.h
3  * \brief Define SingletonPredicate.
4  *
5  * WARNING This file was generated from SingletonPredicate.h
6  * in /tmp/nightly-build-65532/imp-2.4.0/tools/build/container_templates/kernel
7  * by tools/build/make_containers.py.
8  *
9  * Copyright 2007-2015 IMP Inventors. All rights reserved.
10  */
11 
12 #ifndef IMPKERNEL_SINGLETON_PREDICATE_H
13 #define IMPKERNEL_SINGLETON_PREDICATE_H
14 
15 #include <IMP/kernel/kernel_config.h>
16 #include "base_types.h"
17 #include "ParticleTuple.h"
18 #include "DerivativeAccumulator.h"
19 #include "internal/container_helpers.h"
20 #include "model_object_helpers.h"
21 
22 IMPKERNEL_BEGIN_NAMESPACE
23 
24 //! Abstract predicate function
25 /** A predicate is a function which returns one of a discrete set of
26  values (eg -1, 0, 1 depending on whether a value is negative, zero
27  or positive). SingletonPredicates will evaluate the predicate for the passed
28  particles.
29 
30  Implementers should check out IMP_SINGLETON_PREDICATE().
31 */
32 class IMPKERNELEXPORT SingletonPredicate : public ParticleInputs,
33  public base::Object {
34  public:
35  typedef kernel::Particle* Argument;
37  SingletonPredicate(std::string name = "SingletonPredicate %1%");
38  /** \deprecated_at{2.1} Use the index based version.*/
39  IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
40  virtual int get_value(kernel::Particle* vt) const;
41 
42  /** \deprecated_at{2.1} Use the index based version.*/
43  IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
44  virtual Ints get_value(const kernel::ParticlesTemp &o) const;
45 
46 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
47  virtual void remove_if_equal(kernel::Model *m, kernel::ParticleIndexes &ps,
48  int v) const;
49  virtual void remove_if_not_equal(kernel::Model *m, kernel::ParticleIndexes &ps,
50  int v) const;
51 #endif
52 
53  //! Compute the predicate and the derivative if needed.
54  virtual int get_value_index(kernel::Model *m, kernel::ParticleIndex vt) const;
55 
56  //! Enable them to be use as functors
57  /** But beware of slicing.
58  */
60  return get_value_index(m, vt);
61  }
62 
63  virtual Ints get_value_index(kernel::Model *m,
64  const kernel::ParticleIndexes &o) const {
65  Ints ret(o.size());
66  for (unsigned int i = 0; i < o.size(); ++i) {
67  ret[i] += get_value_index(m, o[i]);
68  }
69  return ret;
70  }
71 
73 };
74 
75 IMPKERNEL_END_NAMESPACE
76 
77 #endif /* IMPKERNEL_SINGLETON_PREDICATE_H */
Class for adding derivatives from restraints to the model.
Basic types used by IMP.
IMP::kernel::SingletonPredicate SingletonPredicate
#define IMP_REF_COUNTED_DESTRUCTOR(Name)
Ref counted objects should have private destructors.
Single variable function.
Class to handle individual model particles.
Common base class for heavy weight IMP objects.
Definition: Object.h:106
Abstract predicate function.
Classes to handle individual model particles.
int operator()(kernel::Model *m, kernel::ParticleIndex vt) const
Enable them to be use as functors.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73