Package ghidra.trace.database.listing

# Class AbstractBaseDBTraceDefinedUnitsView<T extends AbstractDBTraceCodeUnit<T>>

java.lang.Object
ghidra.trace.database.listing.AbstractBaseDBTraceCodeUnitsView<T>
ghidra.trace.database.listing.AbstractSingleDBTraceCodeUnitsView<T>
ghidra.trace.database.listing.AbstractBaseDBTraceDefinedUnitsView<T>

Type Parameters:
  `T` -

Direct Known Subclasses:
  `DBTraceDefinedDataView`, `DBTraceInstructionsView`

public abstract class AbstractBaseDBTraceDefinedUnitsView<T extends AbstractDBTraceCodeUnit<T>> extends AbstractSingleDBTraceCodeUnitsView<T>
An abstract implementation of a single-type view for a defined unit type

This is note a base class of `DBTraceDefinedUnitsView`. This class supports the implementation of one or the other: Instruction or Defined data. `DBTraceDefinedUnitsView` is the implementation of the composition of both.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected class`
  `AbstractBaseDBTraceDefinedUnitsView.CacheForGetUnitContainingQueries`
  Cache for optimizing `getAt(long, Address)`
  `protected class`
  `AbstractBaseDBTraceDefinedUnitsView.CacheForGetUnitSequenceQueries`
  Cache for optimizing `getFloor(long, Address)` and similar.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final int`
  `CACHE_ADDRESS_BREADTH`
  `protected static final int`
  `CACHE_MAX_POINTS`
  `protected static final int`
  `CACHE_MAX_REGIONS`
  `protected final AbstractBaseDBTraceDefinedUnitsView<T>.CacheForGetUnitContainingQueries`
  `cacheForContaining`
  `protected final AbstractBaseDBTraceDefinedUnitsView<T>.CacheForGetUnitSequenceQueries`
  `cacheForSequence`
  `protected final DBTraceAddressSnapRangePropertyMapSpace<T,T>`
  `mapSpace`

  ### Fields inherited from class ghidra.trace.database.listing.AbstractBaseDBTraceCodeUnitsView

  `space`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractBaseDBTraceDefinedUnitsView(DBTraceCodeSpace space, DBTraceAddressSnapRangePropertyMapSpace<T,T> mapSpace)`
  Construct the view

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear(Lifespan span, AddressRange range, boolean clearContext, TaskMonitor monitor)`
  `protected void`
  `clearContext(Lifespan span, AddressRange range)`
  Clear the register context in the given box
  `protected long`
  `computeTruncatedMax(Lifespan lifespan, T extending, AddressRange range)`
  `boolean`
  `containsAddress(long snap, Address address)`
  `boolean`
  `coversRange(Lifespan span, AddressRange range)`
  `Iterable<? extends T>`
  `get(long snap, Address min, Address max, boolean forward)`
  `AddressSetView`
  `getAddressSetView(long snap, AddressRange within)`
  `T`
  `getAt(long snap, Address address)`
  `T`
  `getCeiling(long snap, Address min)`
  `T`
  `getContaining(long snap, Address address)`
  `T`
  `getFloor(long snap, Address max)`
  `Iterable<? extends T>`
  `getIntersecting(TraceAddressSnapRange tasr)`
  `boolean`
  `intersectsRange(Lifespan lifespan, AddressRange range)`
  `void`
  `invalidateCache()`
  Invalidate the query-optimizing caches for this view
  `int`
  `size()`
  `protected Set<TraceAddressSnapRange>`
  `subtractFrom(Lifespan span, AddressRange range, Set<TraceAddressSnapRange> cur, Set<TraceAddressSnapRange> set1, Set<TraceAddressSnapRange> set2)`
  Subtract from cur, the boxes covered by the entries intersecting the given query box
  `protected Lifespan`
  `truncateSoonestDefined(Lifespan span, AbstractDBTraceCodeUnit<?> extending, AddressRange range)`
  Select a sub-lifespan from that given so that the box does not overlap an existing unit
  `protected void`
  `unitRemoved(T unit)`
  Notify domain object listeners that a unit was removed
  `protected void`
  `unitSpanChanged(Lifespan oldSpan, T unit)`
  Notify domain object listeners taht a unit's lifespan changed

  ### Methods inherited from class ghidra.trace.database.listing.AbstractBaseDBTraceCodeUnitsView

  `coversRange, get, get, get, get, getAddressSetView, getAddressSpace, getAfter, getBefore, getSpace, getTrace, intersectsRange`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### CACHE_MAX_REGIONS

    protected static final int CACHE_MAX_REGIONS
    See Also:
      - Constant Field Values

  - ### CACHE_ADDRESS_BREADTH

    protected static final int CACHE_ADDRESS_BREADTH
    See Also:
      - Constant Field Values

  - ### CACHE_MAX_POINTS

    protected static final int CACHE_MAX_POINTS
    See Also:
      - Constant Field Values

  - ### mapSpace

    protected final DBTraceAddressSnapRangePropertyMapSpace<T extends AbstractDBTraceCodeUnit<T>,T extends AbstractDBTraceCodeUnit<T>> mapSpace

  - ### cacheForContaining

    protected final AbstractBaseDBTraceDefinedUnitsView<T extends AbstractDBTraceCodeUnit<T>>.CacheForGetUnitContainingQueries cacheForContaining

  - ### cacheForSequence

    protected final AbstractBaseDBTraceDefinedUnitsView<T extends AbstractDBTraceCodeUnit<T>>.CacheForGetUnitSequenceQueries cacheForSequence

- ## Constructor Details

  - ### AbstractBaseDBTraceDefinedUnitsView

    public AbstractBaseDBTraceDefinedUnitsView(DBTraceCodeSpace space, DBTraceAddressSnapRangePropertyMapSpace<T,T> mapSpace)
    Construct the view
    Parameters:
      `space` - the space, bound to an address space
      `mapSpace` - the map storing the actual code unit entries

- ## Method Details

  - ### size

    public int size()
    Specified by:
      `size` in class `AbstractBaseDBTraceCodeUnitsView<T extends AbstractDBTraceCodeUnit<T>>`
    See Also:
      - `TraceBaseCodeUnitsView.size()`

  - ### containsAddress

    public boolean containsAddress(long snap, Address address)
    Specified by:
      `containsAddress` in class `AbstractBaseDBTraceCodeUnitsView<T extends AbstractDBTraceCodeUnit<T>>`
    See Also:
      - `TraceBaseCodeUnitsView.containsAddress(long, Address)`

  - ### subtractFrom

    protected Set<TraceAddressSnapRange> subtractFrom(Lifespan span, AddressRange range, Set<TraceAddressSnapRange> cur, Set<TraceAddressSnapRange> set1, Set<TraceAddressSnapRange> set2)
    Subtract from cur, the boxes covered by the entries intersecting the given query box

    Compute C = A - B, where A B and C are sets of (possibly overlapping) boxes. A is given by cur, and B is the set of bounding boxes for entries intersecting the query box. Two temporary sets must be provided, and `cur` must be identical to one of them. This routine will mutate them. The returned result will be identical to one of them.

    If repeated subtraction is needed, the temporary sets need only be constructed once. For each subsequent round of subtraction, `cur` should be the returned result of the previous round. The final result is the return value of the final round.

    This is used in the implementation of `AbstractBaseDBTraceCodeUnitsView.coversRange(TraceAddressSnapRange)`.

    Parameters:
      `span` - the lifespan of the query box
      `range` - the address range of the query box
      `cur` - the set of boxes, identical to one of the temporary working sets.
      `set1` - a temporary set for working
      `set2` - a temporary set for working
    Returns:
      the result of subtraction, identical to one of the temporary working sets

  - ### coversRange

    public boolean coversRange(Lifespan span, AddressRange range)
    Specified by:
      `coversRange` in class `AbstractBaseDBTraceCodeUnitsView<T extends AbstractDBTraceCodeUnit<T>>`
    See Also:
      - `TraceBaseCodeUnitsView.coversRange(Lifespan, AddressRange)`

  - ### intersectsRange

    public boolean intersectsRange(Lifespan lifespan, AddressRange range)
    Specified by:
      `intersectsRange` in class `AbstractBaseDBTraceCodeUnitsView<T extends AbstractDBTraceCodeUnit<T>>`
    See Also:
      - `TraceBaseCodeUnitsView.intersectsRange(Lifespan, AddressRange)`

  - ### getFloor

    public T getFloor(long snap, Address max)
    Specified by:
      `getFloor` in class `AbstractBaseDBTraceCodeUnitsView<T extends AbstractDBTraceCodeUnit<T>>`
    See Also:
      - `TraceBaseCodeUnitsView.getFloor(long, Address)`

  - ### getContaining

    public T getContaining(long snap, Address address)
    Specified by:
      `getContaining` in class `AbstractBaseDBTraceCodeUnitsView<T extends AbstractDBTraceCodeUnit<T>>`
    See Also:
      - `TraceBaseCodeUnitsView.getContaining(long, Address)`

  - ### getAt

    public T getAt(long snap, Address address)
    Specified by:
      `getAt` in class `AbstractBaseDBTraceCodeUnitsView<T extends AbstractDBTraceCodeUnit<T>>`
    See Also:
      - `TraceBaseCodeUnitsView.getAt(long, Address)`

  - ### getCeiling

    public T getCeiling(long snap, Address min)
    Specified by:
      `getCeiling` in class `AbstractBaseDBTraceCodeUnitsView<T extends AbstractDBTraceCodeUnit<T>>`
    See Also:
      - `TraceBaseCodeUnitsView.getCeiling(long, Address)`

  - ### get

    public Iterable<? extends T> get(long snap, Address min, Address max, boolean forward)
    Specified by:
      `get` in class `AbstractBaseDBTraceCodeUnitsView<T extends AbstractDBTraceCodeUnit<T>>`
    See Also:
      - `TraceBaseCodeUnitsView.get(long, Address, Address, boolean)`

  - ### getIntersecting

    public Iterable<? extends T> getIntersecting(TraceAddressSnapRange tasr)
    Specified by:
      `getIntersecting` in class `AbstractBaseDBTraceCodeUnitsView<T extends AbstractDBTraceCodeUnit<T>>`
    See Also:
      - `TraceBaseCodeUnitsView.getIntersecting(TraceAddressSnapRange)`

  - ### getAddressSetView

    public AddressSetView getAddressSetView(long snap, AddressRange within)
    Specified by:
      `getAddressSetView` in class `AbstractBaseDBTraceCodeUnitsView<T extends AbstractDBTraceCodeUnit<T>>`
    See Also:
      - `TraceBaseCodeUnitsView.getAddressSetView(long, AddressRange)`

  - ### clearContext

    protected void clearContext(Lifespan span, AddressRange range)
    Clear the register context in the given box
    Parameters:
      `span` - the lifespan of the box
      `range` - the address range of the box

  - ### clear

    public void clear(Lifespan span, AddressRange range, boolean clearContext, TaskMonitor monitor) throws CancelledException
    Throws:
      `CancelledException`
    See Also:
      - `TraceBaseDefinedUnitsView.clear(Lifespan, AddressRange, boolean, TaskMonitor)`

  - ### unitRemoved

    protected void unitRemoved(T unit)
    Notify domain object listeners that a unit was removed
    Parameters:
      `unit` - the removed unit

  - ### unitSpanChanged

    protected void unitSpanChanged(Lifespan oldSpan, T unit)
    Notify domain object listeners taht a unit's lifespan changed
    Parameters:
      `oldSpan` - the old snap
      `unit` - the unit (having the new span)

  - ### truncateSoonestDefined

    protected Lifespan truncateSoonestDefined(Lifespan span, AbstractDBTraceCodeUnit<?> extending, AddressRange range) throws CodeUnitInsertionException
    Select a sub-lifespan from that given so that the box does not overlap an existing unit

    The selected lifespan will have the same start snap as that given. The box is the bounding box of a unit the client is trying to create.

    Parameters:
      `span` - the lifespan of the box
      `extending` - if applicable, the unit whose lifespan is being extended
      `range` - the address range of the box
    Returns:
      the selected sub-lifespan
    Throws:
      `CodeUnitInsertionException` - if the start snap is contained in an existing unit

  - ### computeTruncatedMax

    protected long computeTruncatedMax(Lifespan lifespan, T extending, AddressRange range) throws CodeUnitInsertionException
    Throws:
      `CodeUnitInsertionException`

  - ### invalidateCache

    public void invalidateCache()
    Invalidate the query-optimizing caches for this view