decompiler
1.0.0
|
An implementation of the ConstantPool interface storing records internally in RAM. More...
#include <cpool.hh>
Classes | |
class | CheapSorter |
A cheap (efficient) placeholder for a reference to a constant pool record. More... | |
Public Member Functions | |
virtual const CPoolRecord * | getRecord (const vector< uintb > &refs) const |
Retrieve a constant pool record (CPoolRecord) given a reference to it. More... | |
virtual bool | empty (void) const |
Is the container empty of records. | |
virtual void | clear (void) |
Release any (local) resources. | |
virtual void | saveXml (ostream &s) const |
Save all records in this container to an XML stream. More... | |
virtual void | restoreXml (const Element *el, TypeFactory &typegrp) |
Restore constant pool records from an XML stream. More... | |
Public Member Functions inherited from ConstantPool | |
virtual | ~ConstantPool () |
Destructor. | |
void | putRecord (const vector< uintb > &refs, uint4 tag, const string &tok, Datatype *ct) |
A a new constant pool record to this database. More... | |
const CPoolRecord * | restoreXmlRecord (const vector< uintb > &refs, const Element *el, TypeFactory &typegrp) |
Restore a CPoolRecord given a reference and an XML stream. More... | |
Private Member Functions | |
virtual CPoolRecord * | createRecord (const vector< uintb > &refs) |
Allocate a new CPoolRecord object, given a reference to it. More... | |
Private Attributes | |
map< CheapSorter, CPoolRecord > | cpoolMap |
A map from reference to constant pool record. | |
An implementation of the ConstantPool interface storing records internally in RAM.
The CPoolRecord objects are held directly in a map container. This class can be used as a stand-alone ConstantPool that holds all its records in RAM. Or, it can act as a local CPoolRecord cache for some other implementation.
|
privatevirtual |
Allocate a new CPoolRecord object, given a reference to it.
The object will still need to be initialized but is already associated with the reference. Any issue with allocation (like a dupicate reference) causes an exception.
refs | is the reference of 1 or more identifying integers |
Implements ConstantPool.
References cpoolMap.
Referenced by restoreXml().
|
virtual |
Retrieve a constant pool record (CPoolRecord) given a reference to it.
refs | is the reference (made up of 1 or more identifying integers) |
Implements ConstantPool.
References cpoolMap.
Referenced by ConstantPoolGhidra::getRecord().
|
virtual |
Restore constant pool records from an XML stream.
(If supported) The container is populated with CPooLRecords initialized from a <constantpool> XML tag.
el | is the XML element |
typegrp | is the TypeFactory used to resolve data-type references in the XML |
Implements ConstantPool.
References ConstantPoolInternal::CheapSorter::apply(), createRecord(), CPoolRecord::restoreXml(), and ConstantPoolInternal::CheapSorter::restoreXml().
|
virtual |
Save all records in this container to an XML stream.
(If supported) An <constantpool> element is written containing <cpoolrec> child elements for each CPoolRecord in the container.
s | is the output stream |
Implements ConstantPool.
References cpoolMap.