/** * \file IMP/functor.h \brief Various important functionality * for implementing decorators. * * Copyright 2007-2013 IMP Inventors. All rights reserved. * */ #ifndef IMPKERNEL_INTERNAL_FUNCTORS_H #define IMPKERNEL_INTERNAL_FUNCTORS_H #include #include #include "../Model.h" IMPKERNEL_BEGIN_INTERNAL_NAMESPACE template class PredicateEquals { base::OwnerPointer p_; base::Pointer m_; int v_; public: typedef typename Pred::IndexArgument argument_type; typedef bool result_type; PredicateEquals(const Pred *p, Model *m, int v): p_(p), m_(m), v_(v){} bool operator()(const argument_type &t) const { if (Sense) { return p_->get_value_index(m_, t)==v_; } else { return p_->get_value_index(m_, t)!=v_; } } }; IMPKERNEL_END_INTERNAL_NAMESPACE #endif /* IMPKERNEL_INTERNAL_FUNCTORS_H */