bool MemoriaInterna::remove(const Ponto& p) { bool* removeme = this->get(p); if (removeme == nullptr) { m.erase(pontoToKey(p)); } return removeme; }
void MemoriaInterna::del(const Ponto& p) { bool* delme = this->get(p); if (delme != nullptr) { delete [] delme; m.erase(pontoToKey(p)); } }
void Pontos::del(const Ponto& p) { int chave = pontoToKey(p); if (mapa[chave] == true) { mapa[chave] = false; sizeMapa--; } }
void MemoriaInterna::del(const Ponto& p) { int chave = pontoToKey(p); bool* delme = mapa[chave]; if (delme != nullptr) { delete [] delme; mapa[chave] = nullptr; sizeMapa--; } }
bool Pontos::add(const Ponto& p) { int key = pontoToKey(p); if (mapa[key] == false) { mapa[key] = true; sizeMapa++; return true; } return false; }
bool* MemoriaInterna::remove(const Ponto& p) { int chave = pontoToKey(p); bool* remover = nullptr; if (mapa[chave] != nullptr) { remover = mapa[chave]; mapa[chave] = nullptr; sizeMapa--; } return remover; }
bool MemoriaInterna::add(const Ponto& p, bool* mem) { bool* atual = this->get(p); int key = pontoToKey(p); if (atual == nullptr) m[key] = mem; else { bool* swap = atual; m[key] = mem; delete [] swap; } }
bool Pontos::remove(const Ponto& p) { cerr << "remove" << p << endl; int chave = pontoToKey(p); cerr << chave << "!\n"; if (mapa[chave] == true) { mapa[chave] = false; sizeMapa--; cerr << "retorno! t"; return true; } cerr << "retorno! f"; return false; }
bool MemoriaInterna::add(const Ponto& p, bool* mem) { cerr << "memória add\n"; int key = pontoToKey(p); bool* atual = this->get(key); if (atual == nullptr) { cerr << "memória new!\n"; mapa[key] = mem; sizeMapa++; cerr << "memória new ok!\n"; } else { cerr << "memória swap!\n"; bool* swap = atual; mapa[key] = mem; delete [] swap; cerr << "memória swap ok!\n"; } cerr << "memória add ok!\n"; }
bool MemoriaInterna::inKeys(const Ponto& p) { int key = pontoToKey(p); map<int,bool*>::iterator it = m.find(key); // bool* vector = m[pontoToKey(p)]; return it != m.end(); }
bool* MemoriaInterna::get(const Ponto& p) { int key = pontoToKey(p); return m[key]; }
bool* MemoriaInterna::get(const Ponto& p) { int key = pontoToKey(p); cerr << "memória em get: " << key << endl; return mapa[key]; }
bool MemoriaInterna::inKeys(const Ponto& p) { int key = pontoToKey(p); if (mapa[key] != nullptr) return true; return false; }
bool Pontos::in(const Ponto& p) { int key = pontoToKey(p); return mapa[key]; }