B2R2


ARMap Module

This is a helper class for manipulating an ARMap (AddressRangeMap), a non-overlapping interval map. We provide both F#- and C#-style APIs.

Functions and values

Function or value Description

ARMap.add k v tree

Full Usage: ARMap.add k v tree

Parameters:
    k : AddrRange - AddrRange as a key.
    v : 'V - The value to be added.
    tree : ARMap<'V> - The interval tree.

Returns: ARMap<'V> A new interval tree.

Add a mapping from an interval to the value in the interval tree.

k : AddrRange

AddrRange as a key.

v : 'V

The value to be added.

tree : ARMap<'V>

The interval tree.

Returns: ARMap<'V>

A new interval tree.

RangeOverlapException Thrown when there is an existing (overlapping) interval in the tree.

ARMap.addRange min max v tree

Full Usage: ARMap.addRange min max v tree

Parameters:
    min : Addr - The min value of the interval.
    max : Addr - The max value of the interval.
    v : 'V - The value to be added.
    tree : ARMap<'V> - The interval tree.

Returns: ARMap<'V> A new interval tree.

This function is the same as add except that this one takes in two separate parameters for min and max, instead of taking in an AddrRange as input.

min : Addr

The min value of the interval.

max : Addr

The max value of the interval.

v : 'V

The value to be added.

tree : ARMap<'V>

The interval tree.

Returns: ARMap<'V>

A new interval tree.

RangeOverlapException Thrown when there is an existing (overlapping) interval in the tree.

ARMap.containsAddr addr tree

Full Usage: ARMap.containsAddr addr tree

Parameters:
    addr : Addr - Address.
    tree : ARMap<'V> - The interval tree.

Returns: bool True if the interval tree contains an interval that includes the given address, false otherwise.

Check whether a given Addr exists in any of the ranges in the map.

addr : Addr

Address.

tree : ARMap<'V>

The interval tree.

Returns: bool

True if the interval tree contains an interval that includes the given address, false otherwise.

ARMap.containsRange range tree

Full Usage: ARMap.containsRange range tree

Parameters:
    range : AddrRange - The address range.
    tree : ARMap<'V> - The interval tree.

Returns: bool True if the interval tree contains the interval, false otherwise.

Check whether the exact range exists in the interval map.

range : AddrRange

The address range.

tree : ARMap<'V>

The interval tree.

Returns: bool

True if the interval tree contains the interval, false otherwise.

ARMap.count tree

Full Usage: ARMap.count tree

Parameters:
    tree : ARMap<'V> - The interval tree.

Returns: int The number of bindings.

Return the number of bindings in the interval map.

tree : ARMap<'V>

The interval tree.

Returns: int

The number of bindings.

ARMap.empty

Full Usage: ARMap.empty

Returns: ARMap<'V>

Return an empty map.

Returns: ARMap<'V>

ARMap.find range tree

Full Usage: ARMap.find range tree

Parameters:
    range : AddrRange - The address range.
    tree : ARMap<'V> - The interval tree.

Returns: 'V The value associated with the given interval.

Find the mapping that exactly matches with the given range.

range : AddrRange

The address range.

tree : ARMap<'V>

The interval tree.

Returns: 'V

The value associated with the given interval.

ARMap.findByAddr addr tree

Full Usage: ARMap.findByAddr addr tree

Parameters:
    addr : Addr - The address.
    tree : ARMap<'V> - The interval tree.

Returns: 'V The value associated with the given address.

Find the mapping that matches with the given range. Unlike find, this function can return a range that covers the given address.

addr : Addr

The address.

tree : ARMap<'V>

The interval tree.

Returns: 'V

The value associated with the given address.

ARMap.fold fn acc tree

Full Usage: ARMap.fold fn acc tree

Parameters:
    fn : 'b -> AddrRange -> 'V -> 'b - Folder.
    acc : 'b - Accumulator.
    tree : ARMap<'V> - The interval tree.

Returns: 'b Accumulated value.

Fold over the tree.

fn : 'b -> AddrRange -> 'V -> 'b

Folder.

acc : 'b

Accumulator.

tree : ARMap<'V>

The interval tree.

Returns: 'b

Accumulated value.

ARMap.getOverlaps k tree

Full Usage: ARMap.getOverlaps k tree

Parameters:
    k : AddrRange - The key interval.
    tree : ARMap<'V> - The interval tree.

Returns: (AddrRange * 'V) list A sequence of mappings.

Return a sequence of overlapping mappings of the given interval.

k : AddrRange

The key interval.

tree : ARMap<'V>

The interval tree.

Returns: (AddrRange * 'V) list

A sequence of mappings.

ARMap.isEmpty tree

Full Usage: ARMap.isEmpty tree

Parameters:
    tree : ARMap<'V> - The interval tree.

Returns: bool Returns true if the tree is empty, false otherwise.

Check if the give interval map is empty.

tree : ARMap<'V>

The interval tree.

Returns: bool

Returns true if the tree is empty, false otherwise.

ARMap.iter fn tree

Full Usage: ARMap.iter fn tree

Parameters:
    fn : AddrRange -> 'V -> unit - Iterator.
    tree : ARMap<'V> - The interval tree.

Iterate over the tree.

fn : AddrRange -> 'V -> unit

Iterator.

tree : ARMap<'V>

The interval tree.

ARMap.remove k tree

Full Usage: ARMap.remove k tree

Parameters:
    k : AddrRange - The interval to find.
    tree : ARMap<'V> - The interval tree.

Returns: ARMap<'V> A new interval tree.

Remove a mapping that matches exactly with the given range. To remove a mapping that covers the given address, use removeAddr.

k : AddrRange

The interval to find.

tree : ARMap<'V>

The interval tree.

Returns: ARMap<'V>

A new interval tree.

ARMap.removeAddr addr tree

Full Usage: ARMap.removeAddr addr tree

Parameters:
    addr : Addr - The address.
    tree : ARMap<'V> - The interval tree.

Returns: ARMap<'V> A new interval tree.

Remove a mapping that matches with the given address. Unlike remove, this function will remove an interval that includes the given address.

addr : Addr

The address.

tree : ARMap<'V>

The interval tree.

Returns: ARMap<'V>

A new interval tree.

ARMap.replace k v tree

Full Usage: ARMap.replace k v tree

Parameters:
    k : AddrRange - AddrRange as a key.
    v : 'V - The value to be added.
    tree : ARMap<'V> - The interval tree.

Returns: ARMap<'V> A new interval tree.

This function is the same as add except that it will overwrite the existing range if it exactly matches with the given range. If ranges overlap, this function will still raise RangeOverlapException.

k : AddrRange

AddrRange as a key.

v : 'V

The value to be added.

tree : ARMap<'V>

The interval tree.

Returns: ARMap<'V>

A new interval tree.

ARMap.tryFind range tree

Full Usage: ARMap.tryFind range tree

Parameters:
    range : AddrRange - The address range.
    tree : ARMap<'V> - The interval tree.

Returns: 'V option The value associated with the given interval.

Same as find, except that this returns an option-wrapped type.

range : AddrRange

The address range.

tree : ARMap<'V>

The interval tree.

Returns: 'V option

The value associated with the given interval.

ARMap.tryFindByAddr addr tree

Full Usage: ARMap.tryFindByAddr addr tree

Parameters:
    addr : Addr - The address.
    tree : ARMap<'V> - The interval tree.

Returns: 'V option The value associated with the given address.

Same as findByAddr, except that this returns an option-wrapped type.

addr : Addr

The address.

tree : ARMap<'V>

The interval tree.

Returns: 'V option

The value associated with the given address.

ARMap.tryFindKey addr tree

Full Usage: ARMap.tryFindKey addr tree

Parameters:
    addr : Addr - The address.
    tree : ARMap<'V> - The interval tree.

Returns: AddrRange option The found interval wrapped with option.

Find an interval stored in the interval tree map, which includes the given address.

addr : Addr

The address.

tree : ARMap<'V>

The interval tree.

Returns: AddrRange option

The found interval wrapped with option.