CSEngine
Loading...
Searching...
No Matches
CSE::MemoryContainer Class Reference
Inheritance diagram for CSE::MemoryContainer:
CSE::SContainerList< SObject * > CSE::SIContainer< S, T, M > CSE::MemoryMgr

Public Member Functions

void Register (SObject *object) override
 
void Remove (SObject *object) override
 
bool HasHash (const std::string &hash) const
 
void ChangeHash (const std::string &srcHash, const std::string &dstHash)
 
- Public Member Functions inherited from CSE::SContainerList< SObject * >
void Register (SObject * object) override
 
void Remove (SObject * object) override
 
SObjectGet (int index) const override
 
std::list< SObject * > GetAll () const override
 
int GetID (SObject * object) const override
 
int GetSize () const override
 
- Public Member Functions inherited from CSE::SIContainer< S, T, M >
virtual void Register (T object)=0
 
virtual void Remove (T object)=0
 
virtual T Get (M index) const =0
 
virtual M GetID (T object) const =0
 

Protected Attributes

std::set< std::string > m_hashContainer
 
- Protected Attributes inherited from CSE::SContainerList< SObject * >
std::list< SObject * > m_objects
 
int m_size
 

Detailed Description

Definition at line 11 of file MemoryContainer.h.

Member Function Documentation

◆ ChangeHash()

void MemoryContainer::ChangeHash ( const std::string &  srcHash,
const std::string &  dstHash 
)

Definition at line 26 of file MemoryContainer.cpp.

26 {
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}

◆ HasHash()

bool MemoryContainer::HasHash ( const std::string &  hash) const

Definition at line 22 of file MemoryContainer.cpp.

22 {
23 return m_hashContainer.count(hash) > 0;
24}

◆ Register()

void MemoryContainer::Register ( SObject object)
override

Definition at line 10 of file MemoryContainer.cpp.

10 {
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}

◆ Remove()

void MemoryContainer::Remove ( SObject object)
override

Definition at line 17 of file MemoryContainer.cpp.

17 {
18 m_hashContainer.erase(object->GetHash());
19 SContainerList::Remove(object);
20}

Member Data Documentation

◆ m_hashContainer

std::set<std::string> CSE::MemoryContainer::m_hashContainer
protected

Definition at line 27 of file MemoryContainer.h.


The documentation for this class was generated from the following files: