v6502cpp/SegmentCache.h

55 lines
1.0 KiB
C
Raw Normal View History

2013-12-12 22:05:33 +00:00
/*
* File: SegmentCache.h
* Author: Christopher
*
* Created on December 10, 2013, 9:56 PM
*/
#ifndef SEGMENTCACHE_H
#define SEGMENTCACHE_H
#include "setpSeg.h"
2013-12-12 22:05:33 +00:00
#include <memory>
#include <string>
#include <map>
#include <set>
class Segment;
2013-12-15 06:13:44 +00:00
class Common;
2013-12-12 22:05:33 +00:00
class SegmentCache {
public:
SegmentCache() {
2013-12-12 22:05:33 +00:00
}
virtual ~SegmentCache() {
}
2013-12-12 22:05:33 +00:00
Segment* getOrAdd(const std::string& id);
setpSeg all() const;
2013-12-13 14:55:19 +00:00
2013-12-12 22:05:33 +00:00
std::map<const std::string, std::shared_ptr<Segment > >::const_iterator begin() const {
return this->cache.begin();
}
std::map<const std::string, std::shared_ptr<Segment > >::const_iterator end() const {
return this->cache.end();
}
2013-12-12 22:05:33 +00:00
private:
std::map<const std::string, std::shared_ptr<Segment > > cache;
2013-12-14 06:49:50 +00:00
SegmentCache(const SegmentCache&) = delete;
SegmentCache& operator=(const SegmentCache&) = delete;
Segment* get(const std::string& id) const;
bool cached(const std::string& id) const;
friend Common;
2013-12-12 22:05:33 +00:00
};
#endif /* SEGMENTCACHE_H */