/** * \file DifferenceSingletonContainer.h * \brief Return all singletons from a SingletonContainer * * This file is generated by a script (core/tools/make-container). * Do not edit directly. * * Copyright 2007-2010 IMP Inventors. All rights reserved. */ #ifndef IMPCORE_DIFFERENCE_SINGLETON_CONTAINER_H #define IMPCORE_DIFFERENCE_SINGLETON_CONTAINER_H #include "../core_config.h" #include #include #include IMPCORE_BEGIN_INTERNAL_NAMESPACE /** \brief Return all unordered singletons of particles taken from the SingletonContainer It does not do any change tracking. All particles in b must be in a. Returns the set b-a. */ class IMPCOREEXPORT DifferenceSingletonContainer : public SingletonContainer { IMP::internal::OwnerPointer a_, b_; IMP_CONTAINER_DEPENDENCIES(DifferenceSingletonContainer, { ret.resize(2); ret[0]=back_->a_; ret[1]=back_->b_; }); template void apply_to_contents(F f) const { unsigned int szc=get_number_of_particles(); for (unsigned int i=0; i< szc; ++i) { Particle *a= get_particle(i); f(a); } } template double accumulate_over_contents(F f) const { double ret=0; unsigned int szc=get_number_of_particles(); for (unsigned int i=0; i< szc; ++i) { Particle *a= get_particle(i); ret+=f(a); } return ret; } public: DifferenceSingletonContainer(SingletonContainer *a, SingletonContainer *b); #ifndef IMP_DOXYGEN bool get_is_up_to_date() const { return a_->get_is_up_to_date() && b_->get_is_up_to_date(); } #endif IMP_SINGLETON_CONTAINER(DifferenceSingletonContainer); }; IMPCORE_END_INTERNAL_NAMESPACE #endif /* IMPCORE_DIFFERENCE_SINGLETON_CONTAINER_H */