/* * AtomSet.hpp * * Created on: Jul 30, 2010 * Author: crueger */ #ifndef ATOMSET_HPP_ #define ATOMSET_HPP_ #include #include #include #include /** * A simple mixin to give any STL conforming structure fast Vector abilities * * TODO: make this work for maps */ #include "atom.hpp" #include // this tests, whether we actually have a Vector template struct is_atom{}; template <> struct is_atom{ typedef void wrong_type; }; template class AtomSetMixin : public Set { // when our set carries something besides a atom* this will produce an error typedef typename is_atom::wrong_type check_for_atom; public: // typedefs for STL conforming structure typedef typename Set::iterator iterator; typedef typename Set::const_iterator const_iterator; AtomSetMixin() : Set() {} AtomSetMixin(const Set& src) : Set(src) {} virtual ~AtomSetMixin(){} /** * translate all Atoms within this set by a specified amount */ void translate(const Vector &translater){ BOOST_FOREACH(atom *atom,*this){ if(atom->node){ *(atom->node) += translater; } } } }; // allows simpler definition of AtomSets #define ATOMSET(container_type) AtomSetMixin > #endif /* ATOMSET_HPP_ */