/** * \file SingletonContainerSet.h * \brief Store a set of SingletonContainers * * This file is generated by a script (core/tools/make-container). * Do not edit directly. * * Copyright 2007-2010 IMP Inventors. All rights reserved. */ #ifndef IMPCONTAINER_SINGLETON_CONTAINER_SET_H #define IMPCONTAINER_SINGLETON_CONTAINER_SET_H #include "container_config.h" #include #include #include IMPCONTAINER_BEGIN_NAMESPACE //! Stores a set of SingletonContainers /** The input sets must be disjoint. This can change if there is demand for it. \usesconstraint */ class IMPCONTAINEREXPORT SingletonContainerSet : public SingletonContainer { IMP_CONTAINER_DEPENDENCIES(SingletonContainerSet, { ret.insert(ret.end(), back_->singleton_containers_begin(), back_->singleton_containers_end()); }); // to not have added and removed SingletonContainerSet(); SingletonContainerPair get_added_and_removed_containers() const { SingletonContainerSet *added= create_untracked_container(); SingletonContainerSet *removed=create_untracked_container(); for (unsigned int i=0; i< get_number_of_singleton_containers(); ++i) { added->add_singleton_container(get_singleton_container(i) ->get_added_container()); removed->add_singleton_container(get_singleton_container(i) ->get_removed_container()); } return SingletonContainerPair(added, removed); } public: //! Construct and empty set SingletonContainerSet(Model *m, std::string name="SingletonContainerSet %1%"); SingletonContainerSet(const SingletonContainersTemp &pc, std::string name="SingletonContainerSet %1%"); bool get_contains_particle(Particle*) const; unsigned int get_number_of_particles() const; Particle* get_particle(unsigned int i) const; void apply(const SingletonModifier *sm); void apply(const SingletonModifier *sm, DerivativeAccumulator &da); double evaluate(const SingletonScore *s, DerivativeAccumulator *da) const; double evaluate_change(const SingletonScore *s, DerivativeAccumulator *da) const; double evaluate_prechange(const SingletonScore *s, DerivativeAccumulator *da) const; template void template_apply(const SM *sm, DerivativeAccumulator &da) { for (unsigned int i=0; i< get_number_of_singleton_containers(); ++i) { get_singleton_container(i)->apply(sm, da); } } template void template_apply(const SM *sm) { for (unsigned int i=0; i< get_number_of_singleton_containers(); ++i) { get_singleton_container(i)->apply(sm); } } template double template_evaluate(const SS *s, DerivativeAccumulator *da) const { double ret=0; for (unsigned int i=0; i< get_number_of_singleton_containers(); ++i) { ret+=get_singleton_container(i)->evaluate(s, da); } return ret; } template double template_evaluate_change(const SS *s, DerivativeAccumulator *da) const { double ret=0; for (unsigned int i=0; i< get_number_of_singleton_containers(); ++i) { ret+=get_singleton_container(i)->evaluate_change(s, da); } return ret; } template double template_evaluate_prechange(const SS *s, DerivativeAccumulator *da) const { double ret=0; for (unsigned int i=0; i< get_number_of_singleton_containers(); ++i) { ret+=get_singleton_container(i)->evaluate_prechange(s, da); } return ret; } ParticlesTemp get_contained_particles() const; bool get_contained_particles_changed() const; IMP_OBJECT(SingletonContainerSet); /** @name Methods to control the nested container This container merges a set of nested containers. To add or remove nested containers, use the methods below. */ /**@{*/ IMP_LIST(public, SingletonContainer, singleton_container, SingletonContainer*, SingletonContainers); /**@}*/ static SingletonContainerSet *create_untracked_container() { SingletonContainerSet *lsc = new SingletonContainerSet(); return lsc; } #ifndef IMP_DOXYGEN bool get_is_up_to_date() const { for (unsigned int i=0; i< get_number_of_singleton_containers(); ++i) { if (!get_singleton_container(i)->get_is_up_to_date()) return false; } return true; } #endif }; IMPCONTAINER_END_NAMESPACE #endif /* IMPCONTAINER_SINGLETON_CONTAINER_SET_H */