/** * \file ListPairContainer.cpp \brief A list of ParticlePairsTemp. * * This file is generated by a script (core/tools/make-container). * Do not edit directly. * * Copyright 2007-2010 IMP Inventors. All rights reserved. * */ #include "IMP/core/internal/CoreListPairContainer.h" #include "IMP/PairModifier.h" #include "IMP/PairScore.h" #include IMPCORE_BEGIN_INTERNAL_NAMESPACE namespace { CoreListPairContainer* get_list(PairContainer *g) { return dynamic_cast(g); } } IMP_ACTIVE_CONTAINER_DEF(CoreListPairContainer); CoreListPairContainer ::CoreListPairContainer(): internal::ListLikePairContainer(){} CoreListPairContainer ::CoreListPairContainer(Model *m, std::string name): internal::ListLikePairContainer(m, name){ initialize_active_container(m); } CoreListPairContainer ::CoreListPairContainer(Model *m, const char *name): internal::ListLikePairContainer(m, name){ initialize_active_container(m); } void CoreListPairContainer::do_show(std::ostream &out) const { IMP_CHECK_OBJECT(this); out << get_number_of_particle_pairs() << " Pairs." << std::endl; } void CoreListPairContainer::set_particle_pairs(ParticlePairsTemp sc) { update_list(sc); } void CoreListPairContainer::clear_particle_pairs() { ParticlePairsTemp t; update_list(t); } void CoreListPairContainer::add_particle_pair(const ParticlePair& vt) { IMP_USAGE_CHECK(IMP::internal::is_valid(vt), "Passed Pair cannot be NULL (or None)"); add_to_list(vt); IMP_USAGE_CHECK(!get_has_added_and_removed_containers() || !get_removed_container() ->get_contains(vt), "You cannot remove and add the same item in one time step."); } void CoreListPairContainer::add_particle_pairs(const ParticlePairsTemp &c) { if (c.empty()) return; ParticlePairsTemp cp= c; add_to_list(cp); IMP_IF_CHECK(USAGE) { for (unsigned int i=0; i< c.size(); ++i) { IMP_USAGE_CHECK(IMP::internal::is_valid(c[i]), "Passed Pair cannot be NULL (or None)"); IMP_USAGE_CHECK(!get_has_added_and_removed_containers() || !get_removed_container() ->get_contains(c[i]), "You cannot remove and add the same item in one time step."); } } } void CoreListPairContainer ::remove_particle_pairs(const ParticlePairsTemp &c) { if (c.empty()) return; ParticlePairsTemp cp= c; remove_from_list(cp); IMP_IF_CHECK(USAGE) { for (unsigned int i=0; i< c.size(); ++i) { IMP_USAGE_CHECK(IMP::internal::is_valid(c[i]), "Passed Pair cannot be NULL (or None)"); } } } void CoreListPairContainer::do_before_evaluate() { internal::ListLikePairContainer::do_before_evaluate(); } void CoreListPairContainer::do_after_evaluate() { internal::ListLikePairContainer::do_after_evaluate(); } ParticlesTemp CoreListPairContainer::get_state_input_particles() const { return ParticlesTemp(); } ContainersTemp CoreListPairContainer::get_state_input_containers() const { return ContainersTemp(); } bool CoreListPairContainer::get_contained_particles_changed() const { return !get_added()->get_access().empty() || !get_removed()->get_access().empty(); } ParticlesTemp CoreListPairContainer::get_contained_particles() const { return IMP::internal::flatten(get_access()); } IMPCORE_END_INTERNAL_NAMESPACE