// Autogenerated by tools\build\make_containers.py
// from tools\build\container_templates\core\ClassnameConstraint.h
// Do not edit - any changes will be lost!

/**
 *  \file IMP/core/SingletonConstraint.h
 *  \brief Use a SingletonModifier applied to a ParticlesTemp to
 *  maintain an invariant
 *
 *  Copyright 2007-2021 IMP Inventors. All rights reserved.
 */

#ifndef IMPCORE_SINGLETON_CONSTRAINT_H
#define IMPCORE_SINGLETON_CONSTRAINT_H

#include <IMP/core/core_config.h>
#include <IMP/internal/TupleConstraint.h>
#include <IMP/SingletonModifier.h>
#include <IMP/SingletonDerivativeModifier.h>

IMPCORE_BEGIN_NAMESPACE
//! Apply a SingletonFunction to a Singleton
/** The score state is passed up to two SingletonModifiers, one to
    apply before evaluation and the other after. The one after
    should take a DerivativeAccumulator as its last argument for
    SingletonModifier::apply() and will only be called if
    the score was computed with derivatives.

    \see container::SingletonsConstraint
 */
class SingletonConstraint :
#if defined(IMP_DOXYGEN) || defined(SWIG)
    public Constraint
#else
    public IMP::internal::TupleConstraint<SingletonModifier,
                                                  SingletonDerivativeModifier>
#endif
    {
 public:
  /** \deprecated_at{2.1} Use the model/index constructor.
   */
  IMPCORE_DEPRECATED_METHOD_DECL(2.1)
  SingletonConstraint(SingletonModifier *before,
                      SingletonDerivativeModifier *after, Particle* vt,
                      std::string name = "SingletonConstraint %1%")
      : IMP::internal::TupleConstraint<
            SingletonModifier, SingletonDerivativeModifier>(before, after, vt,
                                                            name) {
    IMPCORE_DEPRECATED_METHOD_DEF(2.1, "Use the model/index constructor.");
  }

  SingletonConstraint(SingletonModifier *before,
                      SingletonDerivativeModifier *after, Model *m,
                      ParticleIndex vt,
                      std::string name = "SingletonConstraint %1%")
      : IMP::internal::TupleConstraint<
            SingletonModifier, SingletonDerivativeModifier>(before, after, m,
                                                            vt, name) {}

#if defined(IMP_DOXYGEN) || defined(SWIG)
 protected:
  void do_update_attributes();
  void do_update_derivatives(DerivativeAccumulator *da);
  virtual ModelObjectsTemp do_get_inputs() const;
  virtual ModelObjectsTemp do_get_outputs() const;
  IMP_OBJECT_METHODS(SingletonConstraint);
#endif
};

IMPCORE_END_NAMESPACE

#endif /* IMPCORE_SINGLETON_CONSTRAINT_H */
