retdec
|
#include <object.h>
Public Member Functions | |
GlobalVarContainer () | |
GlobalVarContainer (const GlobalVarContainer &o) | |
GlobalVarContainer & | operator= (const GlobalVarContainer &o) |
const Object * | getObjectByAddress (const retdec::common::Address &address) const |
Reimplemented base container methods. | |
They need to be reimplemented to modify both underlying container and | |
std::pair< iterator, bool > | insert (const Object &e) |
std::pair< iterator, bool > | insert (iterator, const Object &e) |
void | clear () |
size_t | erase (const Object &val) |
![]() | |
const Object * | getObjectByName (const std::string &name) const |
Public Attributes | |
std::map< retdec::common::Address, const Object * > | _addr2global |
Map allows fast global variables search by address. More... | |
Set container which makes sure no two objects have the same address or name. See insert()
method for details.
retdec::common::GlobalVarContainer::GlobalVarContainer | ( | ) |
retdec::common::GlobalVarContainer::GlobalVarContainer | ( | const GlobalVarContainer & | o | ) |
void retdec::common::GlobalVarContainer::clear | ( | ) |
Clear both underlying container and addr2global
map.
size_t retdec::common::GlobalVarContainer::erase | ( | const Object & | val | ) |
Erase from both underlying container and addr2global
map.
const Object * retdec::common::GlobalVarContainer::getObjectByAddress | ( | const retdec::common::Address & | address | ) | const |
nullptr
if not found. std::pair< GlobalVarContainer::iterator, bool > retdec::common::GlobalVarContainer::insert | ( | const Object & | e | ) |
Besides calling the underlying container's insert which checks (and replaces) for existing elements with the same unique ID (name), this method also check for elements with the same global address. Such elements are also removed before adding the new element, since container is not allowed to hold two ebjects with the same global address. Moreover, _addr2global
is also updated.
std::pair< GlobalVarContainer::iterator, bool > retdec::common::GlobalVarContainer::insert | ( | GlobalVarContainer::iterator | , |
const Object & | e | ||
) |
GlobalVarContainer & retdec::common::GlobalVarContainer::operator= | ( | const GlobalVarContainer & | o | ) |
We need to make sure pointers in _addr2global
are valid – point to the new _data
container, not the old one.
std::map<retdec::common::Address, const Object*> retdec::common::GlobalVarContainer::_addr2global |
Map allows fast global variables search by address.