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