mirror of
https://github.com/cmosher01/v6502cpp.git
synced 2026-01-23 05:16:05 +00:00
add SegmentCache class
This commit is contained in:
19
SegmentCache.cpp
Normal file
19
SegmentCache.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* File: SegmentCache.cpp
|
||||
* Author: cmosher
|
||||
*
|
||||
* Created on December 10, 2013, 9:56 PM
|
||||
*/
|
||||
|
||||
#include "SegmentCache.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
Segment* SegmentCache::getOrAdd(std::string& id) {
|
||||
if (this->cache.find(id) == this->cache.end()) {
|
||||
this->cache[id] = std::make_shared<Segment>(id);
|
||||
}
|
||||
return this->cache[id].get();
|
||||
}
|
||||
Reference in New Issue
Block a user