#pragma once

#include <map>

class SensorCache
{
    public:
        typedef std::map<std::pair<std::string, std::string>,
                int> container_t;

        bool update(const container_t::key_type& k,
                    const container_t::mapped_type& v)
        {
            auto& i = container[k];
            if (v == i)
            {
                return false;
            }
            else
            {
                i = v;
                return true;
            }
        }
    private:
        container_t container;
};

// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
