/* * FragmentationResultContainer.hpp * * Created on: Mar 8, 2013 * Author: heber */ #ifndef FRAGMENTATIONRESULTCONTAINER_HPP_ #define FRAGMENTATIONRESULTCONTAINER_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/Singleton.hpp" #include #ifdef HAVE_JOBMARKET #include "JobMarket/types.hpp" #else typedef size_t JobId_t; #endif #include "Fragmentation/KeySetsContainer.hpp" #include "Fragmentation/Summation/Containers/MPQCData.hpp" #ifdef HAVE_VMG #include "Fragmentation/Summation/Containers/VMGData.hpp" #endif /** This class stores results from lengthy fragmentation calculations, e.g. * coming out of FragmentationAutomationAction. * * The idea is that we can play around with results without having to recalculate * results in between. Hence, we serialize the FragmentResult into this * container which can also be filled from file. */ class FragmentationResultContainer: public Singleton { //!> Singleton patterns needs access to private cstor/dtor. friend class Singleton; private: FragmentationResultContainer() : ResultsType(BothRanges) {} ~FragmentationResultContainer() {} public: //!> typedef for short range data container typedef std::map shortrangedata_t; #ifdef HAVE_VMG //!> typedef for long range data container typedef std::map longrangedata_t; #endif #ifdef HAVE_VMG /** Adds a a set of both short and long range results. * * Adds all the containers to the ones present in this instance. * * \param _keysets * \param _forcekeysets * \param _shortrangedata * \param _longrangedata */ void addFullResults( const KeySetsContainer &_keysets, const KeySetsContainer &_forcekeysets, const shortrangedata_t &_shortrangedata, const longrangedata_t &_longrangedata ); #endif /** Adds a a set of short range results only. * * Adds all the containers to the ones present in this instance. * * \param _keysets * \param _forcekeysets * \param _shortrangedata */ void addShortRangeResults( const KeySetsContainer &_keysets, const KeySetsContainer &_forcekeysets, const shortrangedata_t &_shortrangedata ); /** Clears all internal containers. * * \note Also resets ResultsType. */ void clear() { keysets.clear(); forcekeysets.clear(); shortrangedata.clear(); #ifdef HAVE_VMG longrangedata.clear(); #endif ResultsType = BothRanges; } const KeySetsContainer &getKeySets() const { return keysets; } const KeySetsContainer &getForceKeySets() const { return forcekeysets; } const shortrangedata_t& getShortRangeResults() const { return shortrangedata; } #ifdef HAVE_VMG const longrangedata_t& getLongRangeResults() const; #endif bool areFullRangeResultsPresent() const { return (ResultsType == BothRanges); } private: //!> indicates whether we contain short range only or both results enum ResultsType_t { ShortRangeOnly, BothRanges, } ResultsType; //!> container for all KeySet's without hydrogens to the jobs KeySetsContainer keysets; //!> container for all KeySet's with all except saturation hydrogen to the jobs KeySetsContainer forcekeysets; //!> container for all short-range results std::map shortrangedata; #ifdef HAVE_VMG //!> container for all long-range results std::map longrangedata; #endif }; #endif /* FRAGMENTATIONRESULTCONTAINER_HPP_ */