decompiler
1.0.0
|
A map from a linear space to value objects. More...
#include <partmap.hh>
Public Types | |
typedef std::map< _linetype, _valuetype > | maptype |
Defining the map from split points to value objects. | |
typedef maptype::iterator | iterator |
A partmap iterator is an iterator into the map. | |
typedef maptype::const_iterator | const_iterator |
A constant iterator. | |
Public Member Functions | |
_valuetype & | getValue (const _linetype &pnt) |
Get the value object at a point. More... | |
const _valuetype & | getValue (const _linetype &pnt) const |
Get the value object at a point. More... | |
const _valuetype & | bounds (const _linetype &pnt, _linetype &before, _linetype &after, int &valid) const |
Get the value object for a given point and return the range over which the value object applies. More... | |
_valuetype & | split (const _linetype &pnt) |
Introduce a new split point. More... | |
const _valuetype & | defaultValue (void) const |
Get the default value object. | |
_valuetype & | defaultValue (void) |
Get the default value object. | |
_valuetype & | clearRange (const _linetype &pnt1, const _linetype &pnt2) |
Clear a range of split points. More... | |
const_iterator | begin (void) const |
Beginning of split points. | |
const_iterator | end (void) const |
End of split points. | |
iterator | begin (void) |
Beginning of split points. | |
iterator | end (void) |
End of split points. | |
const_iterator | begin (const _linetype &pnt) const |
Get first split point after given point. | |
iterator | begin (const _linetype &pnt) |
Get first split point after given point. | |
void | clear (void) |
Clear all split points. | |
bool | empty (void) const |
Return true if there are no split points. | |
Private Attributes | |
maptype | database |
Map from linear split points to the value objects. | |
_valuetype | defaultvalue |
The value object before the first split point. | |
A map from a linear space to value objects.
The partmap is a template class taking:
Let R be the linear space with an ordering, and let { a_i } be a finite set of points in R. The a_i partition R into a finite number of disjoint sets { x : x < a_0 }, { x : x>=a_0 && x < a_1 }, ... { x : x>=a_i && x < a_i+1 }, ... { x : x>=a_n }
A partmap maps elements of this partition to _valuetype objects A _valuetype is then associated with any element x in R by looking up the value associated with the partition element containing x.
The map is defined by starting with a default value object that applies to the whole linear space. Then split points are introduced, one at a time, in the linear space. At each split point, the associated value object is split into two objects. At any point the value object describing some part of the linear space can be changed.
const _valuetype & ghidra::partmap< _linetype, _valuetype >::bounds | ( | const _linetype & | pnt, |
_linetype & | before, | ||
_linetype & | after, | ||
int & | valid | ||
) | const |
Get the value object for a given point and return the range over which the value object applies.
Pass back a before and after point defining the maximal range over which the value applies. An additional validity code is passed back describing which of the bounding points apply:
pnt | is the given point around which to compute the range |
before | is a reference to the passed back lower bound |
after | is a reference to the passed back upper bound |
valid | is a reference to the passed back validity code |
Referenced by ghidra::partmap< ghidra::Address, ghidra::ContextInternal::FreeArray >::clearRange().
_valuetype & ghidra::partmap< _linetype, _valuetype >::clearRange | ( | const _linetype & | pnt1, |
const _linetype & | pnt2 | ||
) |
Clear a range of split points.
Split points are introduced at the two boundary points of the given range, and all split points in between are removed. The value object that was initially present at the left-most boundary point becomes the value (as a copy) for the whole range.
pnt1 | is the left-most boundary point of the range |
pnt2 | is the right-most boundary point |
Referenced by ghidra::partmap< ghidra::Address, ghidra::ContextInternal::FreeArray >::defaultValue(), and ghidra::partmap< ghidra::Address, ghidra::ContextInternal::FreeArray >::split().
_valuetype & ghidra::partmap< _linetype, _valuetype >::getValue | ( | const _linetype & | pnt | ) |
Get the value object at a point.
Look up the first split point coming before the given point and return the value object it maps to. If there is no earlier split point return the default value.
pnt | is the given point in the linear space |
Referenced by ghidra::partmap< ghidra::Address, ghidra::ContextInternal::FreeArray >::bounds(), ghidra::partmap< ghidra::Address, ghidra::ContextInternal::FreeArray >::empty(), ghidra::ContextInternal::getContext(), ghidra::Database::getProperty(), and ghidra::ContextInternal::getTrackedSet().
const _valuetype & ghidra::partmap< _linetype, _valuetype >::getValue | ( | const _linetype & | pnt | ) | const |
Get the value object at a point.
Look up the first split point coming before the given point and return the value object it maps to. If there is no earlier split point return the default value.
pnt | is the given point in the linear space |
_valuetype & ghidra::partmap< _linetype, _valuetype >::split | ( | const _linetype & | pnt | ) |
Introduce a new split point.
Add (if not already present) a point to the linear partition.
pnt | is the (new) point |
Referenced by ghidra::partmap< ghidra::Address, ghidra::ContextInternal::FreeArray >::bounds(), and ghidra::partmap< ghidra::Address, ghidra::ContextInternal::FreeArray >::clearRange().