decompiler  1.0.0
Public Member Functions | Public Attributes | List of all members
ghidra::ConstantPoolInternal::CheapSorter Class Reference

A cheap (efficient) placeholder for a reference to a constant pool record. More...

Public Member Functions

 CheapSorter (void)
 Construct a zero reference.
 
 CheapSorter (const CheapSorter &op2)
 Copy constructor.
 
 CheapSorter (const vector< uintb > &refs)
 Construct from an array of integers.
 
bool operator< (const CheapSorter &op2) const
 Lexicographic comparison. More...
 
void apply (vector< uintb > &refs) const
 Convert the reference back to a formal array of integers. More...
 
void encode (Encoder &encoder) const
 Encode the reference to a stream. More...
 
void decode (Decoder &decoder)
 Decode the reference from a stream. More...
 

Public Attributes

uintb a
 The first integer in a reference.
 
uintb b
 The second integer in a reference (or zero)
 

Detailed Description

A cheap (efficient) placeholder for a reference to a constant pool record.

A reference can be an open-ended number of (1 or more) integers. In practice, the most integers we see in a reference is two. So this is a slightly more efficient container than an open-ended vector. The field a is the first integer, the field b is the second integer, or zero if there is no second integer. The references are ordered lexicographically. The class also serves to serialize/deserialize references from XML

Member Function Documentation

◆ apply()

void ghidra::ConstantPoolInternal::CheapSorter::apply ( vector< uintb > &  refs) const
inline

Convert the reference back to a formal array of integers.

Parameters
refsis the provided container of integers

References ghidra::CPoolRecord::decode(), and ghidra::CPoolRecord::encode().

Referenced by ghidra::ConstantPoolInternal::decode().

◆ decode()

void ghidra::ConstantPoolInternal::CheapSorter::decode ( Decoder decoder)

Decode the reference from a stream.

Restore this reference from a <ref> element

Parameters
decoderis the stream decoder

References ghidra::Decoder::closeElement(), ghidra::Decoder::openElement(), and ghidra::Decoder::readUnsignedInteger().

Referenced by ghidra::ConstantPoolInternal::decode().

◆ encode()

void ghidra::ConstantPoolInternal::CheapSorter::encode ( Encoder encoder) const

Encode the reference to a stream.

The reference is encoded as a <ref> element.

Parameters
encoderis the stream encoder

References ghidra::Encoder::closeElement(), ghidra::Encoder::openElement(), and ghidra::Encoder::writeUnsignedInteger().

◆ operator<()

bool ghidra::ConstantPoolInternal::CheapSorter::operator< ( const CheapSorter op2) const
inline

Lexicographic comparison.

Parameters
op2is the reference to compare with this
Returns
true if this should be ordered before the other reference

References a, and b.


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