retdec
Public Member Functions | Public Attributes | List of all members
retdec::common::GlobalVarContainer Class Reference

#include <object.h>

Inheritance diagram for retdec::common::GlobalVarContainer:
Inheritance graph
[legend]
Collaboration diagram for retdec::common::GlobalVarContainer:
Collaboration graph
[legend]

Public Member Functions

 GlobalVarContainer ()
 
 GlobalVarContainer (const GlobalVarContainer &o)
 
GlobalVarContaineroperator= (const GlobalVarContainer &o)
 
const ObjectgetObjectByAddress (const retdec::common::Address &address) const
 
Reimplemented base container methods.

They need to be reimplemented to modify both underlying container and addr2global map.

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)
 
- Public Member Functions inherited from retdec::common::ObjectSetContainer
const ObjectgetObjectByName (const std::string &name) const
 

Public Attributes

std::map< retdec::common::Address, const Object * > _addr2global
 Map allows fast global variables search by address. More...
 

Detailed Description

Set container which makes sure no two objects have the same address or name. See insert() method for details.

Constructor & Destructor Documentation

◆ GlobalVarContainer() [1/2]

retdec::common::GlobalVarContainer::GlobalVarContainer ( )

◆ GlobalVarContainer() [2/2]

retdec::common::GlobalVarContainer::GlobalVarContainer ( const GlobalVarContainer o)

Member Function Documentation

◆ clear()

void retdec::common::GlobalVarContainer::clear ( )

Clear both underlying container and addr2global map.

◆ erase()

size_t retdec::common::GlobalVarContainer::erase ( const Object val)

Erase from both underlying container and addr2global map.

◆ getObjectByAddress()

const Object * retdec::common::GlobalVarContainer::getObjectByAddress ( const retdec::common::Address address) const
Returns
Pointer to global object or nullptr if not found.

◆ insert() [1/2]

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.

◆ insert() [2/2]

std::pair< GlobalVarContainer::iterator, bool > retdec::common::GlobalVarContainer::insert ( GlobalVarContainer::iterator  ,
const Object e 
)

◆ operator=()

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.

Member Data Documentation

◆ _addr2global

std::map<retdec::common::Address, const Object*> retdec::common::GlobalVarContainer::_addr2global

Map allows fast global variables search by address.


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