#ifndef __JTOOLS__JMAP__ #define __JTOOLS__JMAP__ #include "JTools/JCollection.hh" #include "JTools/JMapCollection.hh" #include "JTools/JElement.hh" #include "JMath/JMath.hh" /** * \author mdejong */ namespace JTOOLS {} namespace JPP { using namespace JTOOLS; } namespace JTOOLS { using JMATH::JMath; /** * Map of pair-wise elements. * * The key_type and mapped_type refer to the pair-wise element of this map, respectively. */ template > class JMap : public JCollection, JDistance_t>, public JMath< JMap > { public: typedef JKey_t key_type; typedef JValue_t mapped_type; typedef JCollection, JDistance_t> container_type; typedef typename container_type::const_iterator const_iterator; typedef typename container_type::const_reverse_iterator const_reverse_iterator; typedef typename container_type::iterator iterator; typedef typename container_type::reverse_iterator reverse_iterator; /** * Default constructor. */ JMap() {} /** * Add map. * * \param map map * \return this map */ JMap& add(const JMap& map) { static_cast(*this).add(static_cast(map)); return *this; } /** * Subtract map. * * \param map map * \return this map */ JMap& sub(const JMap& map) { static_cast(*this).sub(static_cast(map)); return *this; } /** * Scale contents. * * \param value multiplication factor * \return this map */ JMap& mul(const double value) { static_cast(*this).mul(value); return *this; } /** * Scale contents. * * \param value division factor * \return this map */ JMap& div(const double value) { static_cast(*this).div(value); return *this; } }; /** * Specialisation of JMapCollection for JMap. */ template<> struct JMapCollection { /** * Collection of elements. */ template > struct collection_type : public JCollection {}; }; } #endif