mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
28 lines
475 B
C++
28 lines
475 B
C++
|
|
/*
|
||
|
|
* StringCache.cpp
|
||
|
|
*
|
||
|
|
* Created on: Oct 16, 2012
|
||
|
|
* Author: Mitchell Wills
|
||
|
|
*/
|
||
|
|
|
||
|
|
#include <map>
|
||
|
|
#include "networktables2/util/StringCache.h"
|
||
|
|
|
||
|
|
using namespace std;
|
||
|
|
|
||
|
|
StringCache::StringCache(){
|
||
|
|
}
|
||
|
|
StringCache::~StringCache(){
|
||
|
|
}
|
||
|
|
|
||
|
|
std::string& StringCache::Get(const std::string& input){
|
||
|
|
map<std::string, std::string>::iterator itr = cache.find(input);
|
||
|
|
if(itr != cache.end()){
|
||
|
|
return itr->second;
|
||
|
|
}
|
||
|
|
else{
|
||
|
|
cache[input] = Calc(input);
|
||
|
|
return cache[input];
|
||
|
|
}
|
||
|
|
}
|