/* * ZeroInstanceInitializer.hpp * * Created on: Jun 12, 2016 * Author: heber */ #ifndef ZEROINSTANCEINITIALIZER_HPP_ #define ZEROINSTANCEINITIALIZER_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Fragmentation/Summation/ZeroInstance.hpp" /** This struct initializes zero instances for Summation and OrthogonalSummation * to use as default set of base values. * * Template MapType gives us a boost::fusion::map of types that we iterate over to * fill. */ template struct ZeroInstanceInitializer { /** Constructor of class ZeroInstanceInitializer. * */ ZeroInstanceInitializer( MapType &_ZeroInstances) : ZeroInstances(_ZeroInstances) {} /** Operator that fills the specific type \a MapValue to \a MapKey in its given * maps and vectors with false and the default ZeroInstance. * */ template void operator()(MapKey &) { // We retrieve the type of the member variable from the boost::fusion::map. typedef typename boost::fusion::result_of::value_at_key::type MapValue; // fill vector with default value const MapValue value = ZeroInstance(); boost::fusion::at_key(ZeroInstances) = value; } //!> vector of all zero instance, to be filled by operator() MapType &ZeroInstances; }; #endif /* ZEROINSTANCEINITIALIZER_HPP_ */