decompiler
1.0.0
|
An interface to the pool of constant objects for byte-code languages. More...
#include <cpool.hh>
Public Member Functions | |
virtual | ~ConstantPool () |
Destructor. | |
virtual const CPoolRecord * | getRecord (const vector< uintb > &refs) const =0 |
Retrieve a constant pool record (CPoolRecord) given a reference to it. More... | |
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 * | decodeRecord (const vector< uintb > &refs, Decoder &decoder, TypeFactory &typegrp) |
Restore a CPoolRecord given a reference and a stream decoder. More... | |
virtual bool | empty (void) const =0 |
Is the container empty of records. | |
virtual void | clear (void)=0 |
Release any (local) resources. | |
virtual void | encode (Encoder &encoder) const =0 |
Encode all records in this container to a stream. More... | |
virtual void | decode (Decoder &decoder, TypeFactory &typegrp)=0 |
Restore constant pool records from the given stream decoder. More... | |
Private Member Functions | |
virtual CPoolRecord * | createRecord (const vector< uintb > &refs)=0 |
Allocate a new CPoolRecord object, given a reference to it. More... | |
An interface to the pool of constant objects for byte-code languages.
This is an abstract base class that acts as a container for CPoolRecords. A reference (1 or more integer constants) maps to an individual CPoolRecord. A CPoolRecord object can be queried for using getRecord(), and a new object can be added with putRecord(). Internally, the actual CPoolRecord object is produced by createRecord().
|
privatepure virtual |
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 |
Implemented in ghidra::ConstantPoolInternal, and ghidra::ConstantPoolGhidra.
|
pure virtual |
Restore constant pool records from the given stream decoder.
(If supported) The container is populated with CPoolRecords initialized from a <constantpool> element.
decoder | is the given stream decoder |
typegrp | is the TypeFactory used to resolve data-type references in the XML |
Implemented in ghidra::ConstantPoolInternal, and ghidra::ConstantPoolGhidra.
const CPoolRecord * ghidra::ConstantPool::decodeRecord | ( | const vector< uintb > & | refs, |
Decoder & | decoder, | ||
TypeFactory & | typegrp | ||
) |
Restore a CPoolRecord given a reference and a stream decoder.
A <cpoolrec> element initializes the new record which is immediately associated with the reference.
refs | is the reference (made up of 1 or more identifying integers) |
decoder | is the given stream decoder |
typegrp | is the TypeFactory used to resolve data-type references in XML |
References ghidra::CPoolRecord::decode().
Referenced by ghidra::ConstantPoolGhidra::getRecord().
|
pure virtual |
Encode all records in this container to a stream.
(If supported) A <constantpool> element is written containing <cpoolrec> child elements for each CPoolRecord in the container.
encoder | is the stream encoder |
Implemented in ghidra::ConstantPoolInternal, and ghidra::ConstantPoolGhidra.
|
pure virtual |
Retrieve a constant pool record (CPoolRecord) given a reference to it.
refs | is the reference (made up of 1 or more identifying integers) |
Implemented in ghidra::ConstantPoolInternal, and ghidra::ConstantPoolGhidra.
Referenced by ghidra::RuleTransformCpool::applyOp(), ghidra::TypeOpCpoolref::getOutputLocal(), ghidra::PrintJava::opCpoolRefOp(), ghidra::PrintC::opCpoolRefOp(), and ghidra::TypeOpCpoolref::printRaw().
void ghidra::ConstantPool::putRecord | ( | const vector< uintb > & | refs, |
uint4 | tag, | ||
const string & | tok, | ||
Datatype * | ct | ||
) |
A a new constant pool record to this database.
Given the basic constituents of the record, type, name, and data-type, create a new CPoolRecord object and associate it with the given reference.
refs | is the reference (made up of 1 or more identifying integers) |
tag | is the type of record to create |
tok | is the name associated with the object |
ct | is the data-type associated with the object |
References ghidra::CPoolRecord::tag, ghidra::CPoolRecord::token, and ghidra::CPoolRecord::type.