9 #ifndef GlobeEngine_Cache_h
10 #define GlobeEngine_Cache_h
12 #include "OpenGL_Includes.h"
51 frontbuffer = backbuffer;
60 unsigned int res = cacheIndex;
63 return backbuffer[res];
84 void allocateCache() {
85 for (
int i=0;i<capacity;i++) {
86 std::shared_ptr<T> frontTile = std::make_shared<T>();
87 frontbuffer.push_back(frontTile);
94 void allocateBackbuffer() {
95 for (
int i=0;i<capacity;i++) {
96 std::shared_ptr<T> backTile = std::make_shared<T>();
97 backbuffer.push_back(backTile);
101 void deleteFrontbuffer() {
106 if (this->frontbuffer.size() != 0) {
107 this->frontbuffer.clear();
111 void deleteBackbuffer() {
116 if (this->backbuffer.size() != 0) {
117 this->backbuffer.clear();
121 std::vector< std::shared_ptr<T> > frontbuffer;
122 std::vector< std::shared_ptr<T> > backbuffer;
125 unsigned int cacheIndex;
126 unsigned int capacity;
void clear()
Definition: Cache.h:35
const std::vector< std::shared_ptr< T > > & getFrontBuffer()
Definition: Cache.h:66
Cache()
Definition: Cache.h:22
int getObjectCount()
Definition: Cache.h:79
void setCapacity(unsigned int _capacity)
Definition: Cache.h:72
~Cache()
Definition: Cache.h:28
void create(int _capacity)
Definition: Cache.h:43
std::shared_ptr< T > requestCacheWritePointer()
Definition: Cache.h:57
void swap()
Definition: Cache.h:48