5 #ifndef HELIOS_WAVEFRONTOBJCACHE_H
6 #define HELIOS_WAVEFRONTOBJCACHE_H
9 #include "WavefrontObj.h"
11 #include <unordered_map>
13 typedef std::string key_type;
15 typedef std::list<key_type> list_type;
16 typedef typename list_type::iterator list_iterator;
17 typedef std::unordered_map<key_type, std::pair<value_type, list_iterator>>
19 typedef typename map_type::iterator map_iterator;
48 bool contains(
const std::string &key);
Definition: WavefrontObjCache.h:21
bool contains(const std::string &key)
Checks whether a value is already stored in the cache looking for its key.
Definition: WavefrontObjCache.cpp:25
size_t capacity() const
Get the maximum number of elements that can be stored in the cache.
Definition: WavefrontObjCache.cpp:21
WavefrontObjCache()
Default constructor for a default OBJ Cache.
Definition: WavefrontObjCache.cpp:12
static WavefrontObjCache & getInstance()
Get an instance of the cache (Singleton Pattern)
Definition: WavefrontObjCache.cpp:7
size_t size() const
Get the number of elements allocated in the cache.
Definition: WavefrontObjCache.cpp:19
void insert(const std::string &key, WavefrontObj *value)
Inserts an element in the cache.
Definition: WavefrontObjCache.cpp:29
bool empty() const
Checks whether the cache is empty.
Definition: WavefrontObjCache.cpp:23
void deallocate()
Removes the last element in the list to make room to a new one. This function is called only if the c...
Definition: WavefrontObjCache.cpp:75
WavefrontObj * get(const std::string &key)
Returns a cache element by its key, if exists.
Definition: WavefrontObjCache.cpp:42
~WavefrontObjCache()
Destructor with the responsibility of deallocating all the items stored in the Heap.
Definition: WavefrontObjCache.cpp:14
Class representing a .obj loaded file.
Definition: WavefrontObj.h:15