decompiler  1.0.0
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
ghidra::AttributeId Class Reference

An annotation for a data element to being transferred to/from a stream. More...

#include <marshal.hh>

Public Member Functions

 AttributeId (const string &nm, uint4 i)
 Construct given a name and id. More...
 
const string & getName (void) const
 Get the attribute's name.
 
uint4 getId (void) const
 Get the attribute's id.
 
bool operator== (const AttributeId &op2) const
 Test equality with another AttributeId.
 

Static Public Member Functions

static uint4 find (const string &nm)
 Find the id associated with a specific attribute name. More...
 
static void initialize (void)
 Populate a hashtable with all AttributeId objects. More...
 

Static Private Member Functions

static vector< AttributeId * > & getList (void)
 Retrieve the list of static AttributeId. More...
 

Private Attributes

string name
 The name of the attribute.
 
uint4 id
 The (internal) id of the attribute.
 

Static Private Attributes

static unordered_map< string, uint4 > lookupAttributeId
 A map of AttributeId names to their associated id.
 

Friends

bool operator== (uint4 id, const AttributeId &op2)
 Test equality of a raw integer id with an AttributeId.
 
bool operator== (const AttributeId &op1, uint4 id)
 Test equality of an AttributeId with a raw integer id.
 

Detailed Description

An annotation for a data element to being transferred to/from a stream.

This class parallels the XML concept of an attribute on an element. An AttributeId describes a particular piece of data associated with an ElementId. The defining characteristic of the AttributeId is its name. Internally this name is associated with an integer id. The name (and id) uniquely determine the data being labeled, within the context of a specific ElementId. Within this context, an AttributeId labels either

The same AttributeId can be used to label a different type of data when associated with a different ElementId.

Constructor & Destructor Documentation

◆ AttributeId()

ghidra::AttributeId::AttributeId ( const string &  nm,
uint4  i 
)

Construct given a name and id.

This constructor should only be invoked for static objects. It registers the attribute for inclusion in the global hashtable.

Parameters
nmis the name of the attribute
iis an id to associate with the attribute

References getList().

Member Function Documentation

◆ find()

uint4 ghidra::AttributeId::find ( const string &  nm)
inlinestatic

Find the id associated with a specific attribute name.

The name is looked up in the global list of all attributes. If the attribute is not in the list, a special placeholder attribute, ATTRIB_UNKNOWN, is returned as a placeholder for attributes with unrecognized names.

Parameters
nmis the name of the attribute
Returns
the associated id

References id, and lookupAttributeId.

Referenced by ghidra::XmlDecode::getNextAttributeId(), operator==(), and ghidra::ElementId::operator==().

◆ getList()

vector< AttributeId * > & ghidra::AttributeId::getList ( void  )
staticprivate

Retrieve the list of static AttributeId.

Access static vector of AttributeId objects that are registered during static initialization The list itself is created once on the first call to this method.

Returns
a reference to the vector

Referenced by AttributeId(), and initialize().

◆ initialize()

void ghidra::AttributeId::initialize ( void  )
static

Populate a hashtable with all AttributeId objects.

Fill the hashtable mapping attribute names to their id, from registered attribute objects.

References getList(), id, lookupAttributeId, ghidra::ElementId::lookupElementId, and name.

Referenced by ghidra::GhidraDecompCapability::initialize(), operator==(), and ghidra::ElementId::operator==().


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