CSEngine
Loading...
Searching...
No Matches
MemoryContainer.cpp
1#include "MemoryContainer.h"
2
3using namespace CSE;
4
5MemoryContainer::MemoryContainer() = default;
6
7
8MemoryContainer::~MemoryContainer() = default;
9
10void MemoryContainer::Register(SObject* object) {
11 const auto& prevSize = m_hashContainer.size();
12 m_hashContainer.insert(object->GetHash());
13 if(prevSize - m_hashContainer.size() == 0) throw -1;
14 SContainerList::Register(object);
15}
16
17void MemoryContainer::Remove(SObject* object) {
18 m_hashContainer.erase(object->GetHash());
19 SContainerList::Remove(object);
20}
21
22bool MemoryContainer::HasHash(const std::string& hash) const {
23 return m_hashContainer.count(hash) > 0;
24}
25
26void MemoryContainer::ChangeHash(const std::string& srcHash, const std::string& dstHash) {
27 m_hashContainer.erase(srcHash);
28 const auto& prevSize = m_hashContainer.size();
29 m_hashContainer.insert(dstHash);
30 //if(prevSize - m_hashContainer.size() == 0) throw -1;
31}