---
title: llarp::net::IPRangeMap
summary: a container that maps an ip range to a value that allows you to lookup key by range hit 

---

# llarp::net::IPRangeMap



a container that maps an ip range to a value that allows you to lookup key by range hit  [More...](#detailed-description)


`#include <ip_range_map.hpp>`

## Public Classes

|                | Name           |
| -------------- | -------------- |
| struct | **[CompareEntry](Classes/structllarp_1_1net_1_1IPRangeMap_1_1CompareEntry.md)**  |

## Public Types

|                | Name           |
| -------------- | -------------- |
| using [IPRange](Classes/structllarp_1_1IPRange.md) | **[Range_t](Classes/structllarp_1_1net_1_1IPRangeMap.md#using-range-t)**  |
| using [Range_t::Addr_t](Classes/structllarp_1_1huint__t.md) | **[IP_t](Classes/structllarp_1_1net_1_1IPRangeMap.md#using-ip-t)**  |
| using std::pair< [Range_t](Classes/structllarp_1_1IPRange.md), Value_t > | **[Entry_t](Classes/structllarp_1_1net_1_1IPRangeMap.md#using-entry-t)**  |
| using std::vector< Entry_t > | **[Container_t](Classes/structllarp_1_1net_1_1IPRangeMap.md#using-container-t)**  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| std::set< Value_t > | **[Values](Classes/structllarp_1_1net_1_1IPRangeMap.md#function-values)**() const<br>get a set of all values  |
| bool | **[Empty](Classes/structllarp_1_1net_1_1IPRangeMap.md#function-empty)**() const |
| bool | **[ContainsValue](Classes/structllarp_1_1net_1_1IPRangeMap.md#function-containsvalue)**(const Value_t & val) const |
| void | **[ForEachValue](Classes/structllarp_1_1net_1_1IPRangeMap.md#function-foreachvalue)**(std::function< void(const Value_t &)> functor) const |
| template <typename Visit_t \> <br>void | **[ForEachEntry](Classes/structllarp_1_1net_1_1IPRangeMap.md#function-foreachentry)**(Visit_t visit) const |
| template <typename T ,typename Transformer \> <br>std::set< T > | **[TransformValues](Classes/structllarp_1_1net_1_1IPRangeMap.md#function-transformvalues)**(Transformer transform) const<br>convert all values into type T using a transformer  |
| std::optional< Value_t > | **[GetExact](Classes/structllarp_1_1net_1_1IPRangeMap.md#function-getexact)**([Range_t](Classes/structllarp_1_1IPRange.md) range) const |
| std::set< Entry_t > | **[FindAllEntries](Classes/structllarp_1_1net_1_1IPRangeMap.md#function-findallentries)**(const [IP_t](Classes/structllarp_1_1huint__t.md) & addr) const<br>return a set of all entries who's range contains this IP  |
| void | **[Insert](Classes/structllarp_1_1net_1_1IPRangeMap.md#function-insert)**(const [Range_t](Classes/structllarp_1_1IPRange.md) & addr, const Value_t & val) |
| template <typename Visit_t \> <br>void | **[RemoveIf](Classes/structllarp_1_1net_1_1IPRangeMap.md#function-removeif)**(Visit_t visit) |
| util::StatusObject | **[ExtractStatus](Classes/structllarp_1_1net_1_1IPRangeMap.md#function-extractstatus)**() const |

## Detailed Description

```cpp
template <typename Value_t >
struct llarp::net::IPRangeMap;
```

a container that maps an ip range to a value that allows you to lookup key by range hit 

in the future we should do some kind of magic shit to ensure near constant time for lookups 

## Public Types Documentation

### using Range_t

```cpp
using llarp::net::IPRangeMap< Value_t >::Range_t =  IPRange;
```


### using IP_t

```cpp
using llarp::net::IPRangeMap< Value_t >::IP_t =  Range_t::Addr_t;
```


### using Entry_t

```cpp
using llarp::net::IPRangeMap< Value_t >::Entry_t =  std::pair<Range_t, Value_t>;
```


### using Container_t

```cpp
using llarp::net::IPRangeMap< Value_t >::Container_t =  std::vector<Entry_t>;
```


## Public Functions Documentation

### function Values

```cpp
inline std::set< Value_t > Values() const
```

get a set of all values 

### function Empty

```cpp
inline bool Empty() const
```


### function ContainsValue

```cpp
inline bool ContainsValue(
    const Value_t & val
) const
```


### function ForEachValue

```cpp
inline void ForEachValue(
    std::function< void(const Value_t &)> functor
) const
```


### function ForEachEntry

```cpp
template <typename Visit_t >
inline void ForEachEntry(
    Visit_t visit
) const
```


### function TransformValues

```cpp
template <typename T ,
typename Transformer >
inline std::set< T > TransformValues(
    Transformer transform
) const
```

convert all values into type T using a transformer 

### function GetExact

```cpp
inline std::optional< Value_t > GetExact(
    Range_t range
) const
```


### function FindAllEntries

```cpp
inline std::set< Entry_t > FindAllEntries(
    const IP_t & addr
) const
```

return a set of all entries who's range contains this IP 

### function Insert

```cpp
inline void Insert(
    const Range_t & addr,
    const Value_t & val
)
```


### function RemoveIf

```cpp
template <typename Visit_t >
inline void RemoveIf(
    Visit_t visit
)
```


### function ExtractStatus

```cpp
inline util::StatusObject ExtractStatus() const
```


-------------------------------

Updated on 2024-11-10 at 05:10:02 +0000