Ghidra Decompiler Analysis Engine
|
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... | |
_valuetype & | clearRange (const _linetype &pnt1, const _linetype &pnt2) |
Clear a range of split points. More... | |
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 & 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 |
_valuetype & 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 |
_valuetype & 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 |
const _valuetype & 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 & 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 |