Class PropertyMapDB
- java.lang.Object
-
- ghidra.program.database.properties.PropertyMapDB
-
- All Implemented Interfaces:
PropertyMap
- Direct Known Subclasses:
IntPropertyMapDB,LongPropertyMapDB,ObjectPropertyMapDB,StringPropertyMapDB,UnsupportedMapDB,VoidPropertyMapDB
public abstract class PropertyMapDB extends java.lang.Object implements PropertyMap
Abstract class which defines a map containing properties over a set of addresses. The map is stored within a database table.
-
-
Field Summary
Fields Modifier and Type Field Description protected AddressMapaddrMapprotected ObjectCachecacheprotected ChangeManagerchangeMgrprotected DBHandledbHandleprotected static intDEFAULT_CACHE_SIZEprotected ErrorHandlererrHandlerprotected Locklockprotected java.lang.Stringnameprotected static java.lang.Class<?>[]NO_SCHEMA_FIELD_CLASSESprotected static java.lang.String[]NO_SCHEMA_FIELD_NAMESprotected static intPROPERTY_VALUE_COLprotected TablepropertyTableprotected Schemaschemaprotected static java.lang.String[]SCHEMA_FIELD_NAMES
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcreateTable(java.lang.Class<?> valueFieldClass)Create the default propertyTable.voiddelete()Delete this property map and all underlying tables.AddressKeyIteratorgetAddressKeyIterator(Address start, boolean before)Get an iterator over the long address keys which contain a property value.AddressKeyIteratorgetAddressKeyIterator(Address start, Address end, boolean atStart)Get an iterator over the long address keys which contain a property value.AddressKeyIteratorgetAddressKeyIterator(AddressSetView set, boolean atStart)Get an iterator over the long address keys which contain a property value.AddressgetFirstPropertyAddress()Get the first Address where a property value exists.AddressgetLastPropertyAddress()Get the last Address where a property value exists.java.lang.StringgetName()Get the name for this property map.AddressgetNextPropertyAddress(Address addr)Get the next address where the property value exists.AddressgetPreviousPropertyAddress(Address addr)Get the previous Address where a property value exists.AddressIteratorgetPropertyIterator()Returns an iterator over the addresses that a property value.AddressIteratorgetPropertyIterator(Address start, boolean forward)Returns an iterator over the address having a property value.AddressIteratorgetPropertyIterator(Address start, Address end)Returns an iterator over the indices having a property value.AddressIteratorgetPropertyIterator(Address start, Address end, boolean forward)Returns an iterator over addresses that have a property value.AddressIteratorgetPropertyIterator(AddressSetView asv)Returns an iterator over the addresses that have a property value and are in the given address set.AddressIteratorgetPropertyIterator(AddressSetView asv, boolean forward)Returns an iterator over the addresses that have a property value and are in the given address set.intgetSize()Get the number of properties in the map.protected java.lang.StringgetTableName()Get the default property table name for this property map.static java.lang.StringgetTableName(java.lang.String propertyName)booleanhasProperty(Address addr)returns whether there is a property value at addr.booleanintersects(Address startAddr, Address endAddr)Given two addresses, indicate whether there is an address in that range (inclusive) having the property.booleanintersects(AddressSetView set)Indicate whether there is an address within the set which exists within this map.voidinvalidateCache()Invalidates the cache.voidmoveRange(Address start, Address end, Address newStart)Moves the properties defined in the range from the start address thru the end address to now be located beginning at the newStart address.booleanremove(Address addr)Remove the property value at the given address.booleanremoveRange(Address startAddr, Address endAddr)Removes all property values within a given range.voidsetCacheSize(int size)Adjust the size of the underlying read cache.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ghidra.program.model.util.PropertyMap
applyValue, getObject
-
-
-
-
Field Detail
-
SCHEMA_FIELD_NAMES
protected static final java.lang.String[] SCHEMA_FIELD_NAMES
-
NO_SCHEMA_FIELD_NAMES
protected static final java.lang.String[] NO_SCHEMA_FIELD_NAMES
-
NO_SCHEMA_FIELD_CLASSES
protected static final java.lang.Class<?>[] NO_SCHEMA_FIELD_CLASSES
-
PROPERTY_VALUE_COL
protected static final int PROPERTY_VALUE_COL
- See Also:
- Constant Field Values
-
DEFAULT_CACHE_SIZE
protected static final int DEFAULT_CACHE_SIZE
- See Also:
- Constant Field Values
-
dbHandle
protected DBHandle dbHandle
-
errHandler
protected ErrorHandler errHandler
-
changeMgr
protected ChangeManager changeMgr
-
schema
protected Schema schema
-
propertyTable
protected Table propertyTable
-
addrMap
protected AddressMap addrMap
-
name
protected java.lang.String name
-
cache
protected ObjectCache cache
-
lock
protected Lock lock
-
-
Method Detail
-
getTableName
public static java.lang.String getTableName(java.lang.String propertyName)
-
getTableName
protected java.lang.String getTableName()
Get the default property table name for this property map.- Returns:
- default property map table name.
-
createTable
protected void createTable(java.lang.Class<?> valueFieldClass) throws java.io.IOExceptionCreate the default propertyTable. This method may be called by add property methods if propertyTable is null.- Throws:
java.io.IOException
-
getName
public java.lang.String getName()
Description copied from interface:PropertyMapGet the name for this property map.- Specified by:
getNamein interfacePropertyMap- See Also:
PropertyMap.getName()
-
setCacheSize
public void setCacheSize(int size)
Adjust the size of the underlying read cache.- Parameters:
size- the size of the cache.
-
delete
public void delete() throws java.io.IOExceptionDelete this property map and all underlying tables. This method should be overidden if any table other than the default propertyTable is used.- Throws:
java.io.IOException
-
intersects
public boolean intersects(Address startAddr, Address endAddr)
Description copied from interface:PropertyMapGiven two addresses, indicate whether there is an address in that range (inclusive) having the property.- Specified by:
intersectsin interfacePropertyMap- Parameters:
startAddr- the start of the range.endAddr- the end of the range.- Returns:
- boolean true if at least one address in the range has the property, false otherwise.
- See Also:
PropertyMap.intersects(ghidra.program.model.address.Address, ghidra.program.model.address.Address)
-
intersects
public boolean intersects(AddressSetView set)
Description copied from interface:PropertyMapIndicate whether there is an address within the set which exists within this map.- Specified by:
intersectsin interfacePropertyMap- Parameters:
set- set of addresses- Returns:
- boolean true if at least one address in the set has the property, false otherwise.
- See Also:
PropertyMap.intersects(ghidra.program.model.address.AddressSetView)
-
removeRange
public boolean removeRange(Address startAddr, Address endAddr)
Description copied from interface:PropertyMapRemoves all property values within a given range.- Specified by:
removeRangein interfacePropertyMap- Parameters:
startAddr- begin rangeendAddr- end range, inclusive- Returns:
- true if any property value was removed; return false otherwise.
- See Also:
PropertyMap.removeRange(ghidra.program.model.address.Address, ghidra.program.model.address.Address)
-
remove
public boolean remove(Address addr)
Description copied from interface:PropertyMapRemove the property value at the given address.- Specified by:
removein interfacePropertyMap- Parameters:
addr- the address where the property should be removed- Returns:
- true if the property value was removed, false otherwise.
- See Also:
PropertyMap.remove(ghidra.program.model.address.Address)
-
hasProperty
public boolean hasProperty(Address addr)
Description copied from interface:PropertyMapreturns whether there is a property value at addr.- Specified by:
hasPropertyin interfacePropertyMap- Parameters:
addr- the address in question- See Also:
PropertyMap.hasProperty(ghidra.program.model.address.Address)
-
getNextPropertyAddress
public Address getNextPropertyAddress(Address addr)
Description copied from interface:PropertyMapGet the next address where the property value exists.- Specified by:
getNextPropertyAddressin interfacePropertyMap- Parameters:
addr- the address from which to begin the search (exclusive).- See Also:
PropertyMap.getNextPropertyAddress(ghidra.program.model.address.Address)
-
getPreviousPropertyAddress
public Address getPreviousPropertyAddress(Address addr)
Description copied from interface:PropertyMapGet the previous Address where a property value exists.- Specified by:
getPreviousPropertyAddressin interfacePropertyMap- Parameters:
addr- the address from which to begin the search (exclusive).- See Also:
PropertyMap.getPreviousPropertyAddress(ghidra.program.model.address.Address)
-
getFirstPropertyAddress
public Address getFirstPropertyAddress()
Description copied from interface:PropertyMapGet the first Address where a property value exists.- Specified by:
getFirstPropertyAddressin interfacePropertyMap- See Also:
PropertyMap.getFirstPropertyAddress()
-
getLastPropertyAddress
public Address getLastPropertyAddress()
Description copied from interface:PropertyMapGet the last Address where a property value exists.- Specified by:
getLastPropertyAddressin interfacePropertyMap- See Also:
PropertyMap.getLastPropertyAddress()
-
getSize
public int getSize()
Description copied from interface:PropertyMapGet the number of properties in the map.- Specified by:
getSizein interfacePropertyMap- See Also:
PropertyMap.getSize()
-
getAddressKeyIterator
public AddressKeyIterator getAddressKeyIterator(AddressSetView set, boolean atStart) throws java.io.IOException
Get an iterator over the long address keys which contain a property value.- Parameters:
set-atStart- true if the iterator should be positioned at the start of the range- Returns:
- long address iterator.
- Throws:
java.io.IOException
-
getAddressKeyIterator
public AddressKeyIterator getAddressKeyIterator(Address start, boolean before) throws java.io.IOException
Get an iterator over the long address keys which contain a property value.- Parameters:
start-before- true if the iterator should be positioned before the start address- Returns:
- long address iterator.
- Throws:
java.io.IOException
-
getAddressKeyIterator
public AddressKeyIterator getAddressKeyIterator(Address start, Address end, boolean atStart) throws java.io.IOException
Get an iterator over the long address keys which contain a property value.- Parameters:
start-end-atStart- true if the iterator should be positioned at the start of the range- Returns:
- long address iterator.
- Throws:
java.io.IOException
-
getPropertyIterator
public AddressIterator getPropertyIterator(Address start, Address end)
Description copied from interface:PropertyMapReturns an iterator over the indices having a property value.- Specified by:
getPropertyIteratorin interfacePropertyMap- See Also:
PropertyMap.getPropertyIterator(ghidra.program.model.address.Address, ghidra.program.model.address.Address)
-
getPropertyIterator
public AddressIterator getPropertyIterator(Address start, Address end, boolean forward)
Description copied from interface:PropertyMapReturns an iterator over addresses that have a property value.- Specified by:
getPropertyIteratorin interfacePropertyMapforward- if true will iterate in increasing address order, otherwise it will start at the end and iterate in decreasing address order- See Also:
PropertyMap.getPropertyIterator(ghidra.program.model.address.Address, ghidra.program.model.address.Address, boolean)
-
getPropertyIterator
public AddressIterator getPropertyIterator()
Description copied from interface:PropertyMapReturns an iterator over the addresses that a property value.- Specified by:
getPropertyIteratorin interfacePropertyMap- See Also:
PropertyMap.getPropertyIterator()
-
getPropertyIterator
public AddressIterator getPropertyIterator(AddressSetView asv)
Description copied from interface:PropertyMapReturns an iterator over the addresses that have a property value and are in the given address set.- Specified by:
getPropertyIteratorin interfacePropertyMap- Parameters:
asv- the set of addresses to iterate over.- See Also:
PropertyMap.getPropertyIterator(ghidra.program.model.address.AddressSetView)
-
getPropertyIterator
public AddressIterator getPropertyIterator(AddressSetView asv, boolean forward)
Description copied from interface:PropertyMapReturns an iterator over the addresses that have a property value and are in the given address set.- Specified by:
getPropertyIteratorin interfacePropertyMapforward- if true will iterate in increasing address order, otherwise it will start at the end and iterate in decreasing address order- See Also:
PropertyMap.getPropertyIterator(ghidra.program.model.address.AddressSetView, boolean)
-
getPropertyIterator
public AddressIterator getPropertyIterator(Address start, boolean forward)
Description copied from interface:PropertyMapReturns an iterator over the address having a property value.- Specified by:
getPropertyIteratorin interfacePropertyMap- Parameters:
start- the starting addressforward- if true will iterate in increasing address order, otherwise it will start at the end and iterate in decreasing address order- See Also:
PropertyMap.getPropertyIterator(ghidra.program.model.address.Address, boolean)
-
invalidateCache
public void invalidateCache()
Invalidates the cache.
-
moveRange
public void moveRange(Address start, Address end, Address newStart)
Description copied from interface:PropertyMapMoves the properties defined in the range from the start address thru the end address to now be located beginning at the newStart address. The moved properties will be located at the same relative location to the newStart address as they were previously to the start address.- Specified by:
moveRangein interfacePropertyMap- Parameters:
start- the start of the range to move.end- the end of the range to move.newStart- the new start location of the range of properties after the move.- See Also:
PropertyMap.moveRange(ghidra.program.model.address.Address, ghidra.program.model.address.Address, ghidra.program.model.address.Address)
-
-