#include "ResultCache.h"
#include <map>
#include <iostream>
using namespace std;

typedef map<unsigned, unsigned> ResultCacheMap;
typedef ResultCacheMap::value_type ResultCacheLine;
ResultCacheMap rescache;

ResultCache cache;

bool ResultCache::find(unsigned s, unsigned *r) {
  ResultCacheMap::const_iterator res = rescache.find(s);
  if (res != rescache.end()) {
    *r = (*res).second;
    return true;
  }
  return false;
}

void ResultCache::insert(unsigned s, unsigned r) {
  rescache.insert(ResultCacheLine(s,r));
}

