8 #ifndef IMPCORE_PREDICATES_H
9 #define IMPCORE_PREDICATES_H
11 #include <IMP/core/core_config.h>
16 IMPCORE_BEGIN_NAMESPACE
23 =
"InBoundingBox3DSingletonPredicate%1%"):
26 return bb_.get_contains(
XYZ(m,pi)
27 .get_coordinates())?1:0;
41 =
"AttributeSingletonPredicate%1%"):
44 return m->get_attribute(bb_, pi) ,{
53 template <
class Predicate,
class Score=SingletonScore>
55 OwnerPointer<Predicate> pred_;
58 Score *get_score(
int val)
const {
59 if (val < offset_ || val > scores_.size()+offset_) {
62 return scores_[val+offset_];
67 std::string name=
"PredicateScore%1%"):
69 void set_singleton_score(
int val, Score *score) {
71 "Negative predicate values not supported yet");
72 scores_.resize(std::max<int>(val+1, scores_.size()));
78 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
79 template <
class Predicate,
class Score>
83 int val= pred_->get_value(m,p);
84 Score *s= get_score(val);
86 return s->Score::evaluate_index(m, p, da);
91 template <
class Predicate,
class Score>
92 inline void PredicateSingletonScore<Predicate, Score>
93 ::do_show(std::ostream &)
const {
98 template <
class Predicate,
class Score>
99 inline PredicateSingletonScore<Predicate, Score>*
101 int val, Score *score) {
102 Pointer<PredicateSingletonScore<Predicate, Score> > ret
104 ret->set_score(val, score);
108 IMPCORE_END_NAMESPACE