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 & 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 |
References partmap< _linetype, _valuetype >::begin(), partmap< _linetype, _valuetype >::database, partmap< _linetype, _valuetype >::defaultvalue, partmap< _linetype, _valuetype >::defaultValue(), partmap< _linetype, _valuetype >::end(), partmap< _linetype, _valuetype >::getValue(), and partmap< _linetype, _valuetype >::split().
Referenced by partmap< _linetype, _valuetype >::clearRange().
_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 |
References partmap< _linetype, _valuetype >::begin(), partmap< _linetype, _valuetype >::bounds(), partmap< _linetype, _valuetype >::database, partmap< _linetype, _valuetype >::end(), and partmap< _linetype, _valuetype >::split().
Referenced by partmap< Address, TrackedSet >::defaultValue(), and partmap< _linetype, _valuetype >::split().
_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 |
References partmap< _linetype, _valuetype >::database, and partmap< _linetype, _valuetype >::defaultvalue.
Referenced by partmap< _linetype, _valuetype >::bounds(), partmap< Address, TrackedSet >::empty(), ContextInternal::getContext(), Database::getProperty(), and ContextInternal::getTrackedSet().
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 |
References partmap< _linetype, _valuetype >::database, and partmap< _linetype, _valuetype >::defaultvalue.
_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 |
References partmap< _linetype, _valuetype >::clearRange(), partmap< _linetype, _valuetype >::database, and partmap< _linetype, _valuetype >::defaultvalue.
Referenced by partmap< _linetype, _valuetype >::bounds(), and partmap< _linetype, _valuetype >::clearRange().