|
LibSWOC++ 1.5.14
Solid Wall of C++
|
#include <DiscreteRange.h>

Classes | |
| class | Node |
| A node in the range tree. More... | |
Public Types | |
| using | iterator = typename decltype(_list)::iterator |
| using | const_iterator = typename decltype(_list)::const_iterator |
Public Member Functions | |
| self_type & | mark_bulk (std::vector< std::pair< range_type, PAYLOAD > > &marks, bool is_sorted=false) |
| self_type & | mark_bulk (std::pair< range_type, PAYLOAD > *start, size_t n, bool is_sorted=false) |
| self_type & | mark (range_type const &range, PAYLOAD const &payload, bool update_tree=true) |
| self_type & | erase (range_type const &range) |
| template<typename F, typename U = PAYLOAD> | |
| self_type & | blend (range_type const &range, U const &color, F &&blender) |
| self_type & | fill (range_type const &range, PAYLOAD const &payload) |
| iterator | find (METRIC const &metric) |
| const_iterator | find (METRIC const &metric) const |
| iterator | lower_bound (METRIC const &m) |
| iterator | upper_bound (METRIC const &m) |
| std::pair< iterator, iterator > | intersection (range_type const &range) |
| size_t | count () const |
| bool | empty () const |
| iterator | begin () |
| iterator | end () |
| const_iterator | begin () const |
| const_iterator | end () const |
| void | clear () |
| Remove all ranges. | |
| template<typename F, typename U> | |
| auto | blend (DiscreteSpace::range_type const &range, U const &color, F &&blender) -> self_type & |
Protected Types | |
| using | metric_type = METRIC |
| Export. | |
| using | payload_type = PAYLOAD |
| Export. | |
| using | range_type = DiscreteRange<METRIC> |
| using | Direction = typename Node::Direction |
Protected Member Functions | |
| Node * | prev (Node *n) |
| Node * | next (Node *n) |
| Node * | left (Node *n) |
| Node * | right (Node *n) |
| Node * | lower_node (METRIC const &target) |
| Node * | upper_node (METRIC const &target) |
| Node * | head () |
| Node * | tail () |
| void | insert_before (Node *spot, Node *node, bool update_tree=true) |
| void | insert_after (Node *spot, Node *node, bool update_tree=true) |
| void | prepend (Node *node, bool update_tree=true) |
| void | append (Node *node, bool update_tree=true) |
| void | remove (Node *node, bool update_tree=true) |
Protected Attributes | |
| Node * | _root = nullptr |
| Root node. | |
| IntrusiveDList< typename Node::Linkage > | _list |
| In order list of nodes. | |
| swoc::MemArena | _arena {4000} |
| Memory Storage. | |
| swoc::FixedArena< Node > | _fa {_arena} |
| Node allocator and free list. | |
A space for a discrete METRIC.
| METRIC | Value type for the space. |
| PAYLOAD | Data stored with values in the space. |
This is a range based mapping of all values in METRIC (the "space") to PAYLOAD.
PAYLOAD is presumed to be relatively cheap to construct and copy.
METRIC must be
Definition at line 708 of file DiscreteRange.h.
| using swoc::DiscreteSpace< METRIC, PAYLOAD >::const_iterator = typename decltype(_list)::const_iterator |
Definition at line 833 of file DiscreteRange.h.
|
protected |
Definition at line 803 of file DiscreteRange.h.
| using swoc::DiscreteSpace< METRIC, PAYLOAD >::iterator = typename decltype(_list)::iterator |
Definition at line 832 of file DiscreteRange.h.
|
protected |
Export.
Definition at line 712 of file DiscreteRange.h.
|
protected |
Export.
Definition at line 713 of file DiscreteRange.h.
|
protected |
Definition at line 714 of file DiscreteRange.h.
| swoc::DiscreteSpace< METRIC, PAYLOAD >::~DiscreteSpace | ( | ) |
Definition at line 1081 of file DiscreteRange.h.
|
protected |
Add node to tree as the last node.
| node | Node to append. |
| update_tree | true to update the RBTree structure. |
Invariant - node is last in order.
Definition at line 1259 of file DiscreteRange.h.
|
inline |
Definition at line 952 of file DiscreteRange.h.
|
inline |
Definition at line 962 of file DiscreteRange.h.
| auto swoc::DiscreteSpace< METRIC, PAYLOAD >::blend | ( | DiscreteSpace< METRIC, PAYLOAD >::range_type const & | range, |
| U const & | color, | ||
| F && | blender ) -> self_type & |
Definition at line 1645 of file DiscreteRange.h.
| self_type & swoc::DiscreteSpace< METRIC, PAYLOAD >::blend | ( | range_type const & | range, |
| U const & | color, | ||
| F && | blender ) |
Blend a color to a range.
| F | Functor to blend payloads. |
| U | type to blend in to payloads. |
| range | Range for blending. |
| color | Payload to blend. |
| blender | Functor to compute blended color. |
color is blended to values in range. If an address in range does not have a payload, its payload is set a default constructed PAYLOAD blended with color. If such an address does have a payload, color is blended in to that payload using blender. The existing color is passed as the first argument and color as the second argument. The functor is expected to update the first argument to be the blended color. The function must return a bool to indicate whether the blend resulted in a valid color. If false is returned, the blended region is removed from the space.
| void swoc::DiscreteSpace< METRIC, PAYLOAD >::clear | ( | ) |
Remove all ranges.
Definition at line 1850 of file DiscreteRange.h.
| size_t swoc::DiscreteSpace< METRIC, PAYLOAD >::count | ( | ) | const |
Definition at line 1090 of file DiscreteRange.h.
| bool swoc::DiscreteSpace< METRIC, PAYLOAD >::empty | ( | ) | const |
true if there are no ranges in the container, false otherwise. Definition at line 1096 of file DiscreteRange.h.
|
inline |
Definition at line 957 of file DiscreteRange.h.
|
inline |
Definition at line 967 of file DiscreteRange.h.
| DiscreteSpace< METRIC, PAYLOAD > & swoc::DiscreteSpace< METRIC, PAYLOAD >::erase | ( | DiscreteSpace< METRIC, PAYLOAD >::range_type const & | range | ) |
Erase a range.
| range | Range to erase. |
All values in range are removed from the space.
Definition at line 1330 of file DiscreteRange.h.
| DiscreteSpace< METRIC, PAYLOAD > & swoc::DiscreteSpace< METRIC, PAYLOAD >::fill | ( | DiscreteSpace< METRIC, PAYLOAD >::range_type const & | range, |
| PAYLOAD const & | payload ) |
Fill range with payload.
| range | Range to fill. |
| payload | Payload to use. |
Values in range that do not have a payload are set to payload. Values in the space are not changed.
Definition at line 1526 of file DiscreteRange.h.
| auto swoc::DiscreteSpace< METRIC, PAYLOAD >::find | ( | METRIC const & | metric | ) |
Find the payload at metric.
| metric | The metric for which to search. |
end iterator if not. Definition at line 1114 of file DiscreteRange.h.
| auto swoc::DiscreteSpace< METRIC, PAYLOAD >::find | ( | METRIC const & | metric | ) | const |
Find the payload at metric.
| metric | The metric for which to search. |
end iterator if not. Definition at line 1138 of file DiscreteRange.h.
|
protected |
Definition at line 1102 of file DiscreteRange.h.
|
protected |
Insert node after spot.
| spot | Target node. |
| node | Node to insert. |
| update_tree | true to update the RBTree structure. |
Definition at line 1308 of file DiscreteRange.h.
|
protected |
Insert node before spot.
| spot | Target node. |
| node | Node to insert. |
| update_tree | true to update the RBTree structure. |
Definition at line 1286 of file DiscreteRange.h.
| auto swoc::DiscreteSpace< METRIC, PAYLOAD >::intersection | ( | DiscreteSpace< METRIC, PAYLOAD >::range_type const & | range | ) |
Intersection of range with container.
| range | Search range. |
Definition at line 1216 of file DiscreteRange.h.
|
inlineprotected |
Definition at line 822 of file DiscreteRange.h.
| auto swoc::DiscreteSpace< METRIC, PAYLOAD >::lower_bound | ( | METRIC const & | m | ) |
Lower bound.
| m | Search value. |
Definition at line 1202 of file DiscreteRange.h.
|
protected |
Find the lower bounding node.
| target | Search value. |
nullptr if all ranges start after target. Definition at line 1144 of file DiscreteRange.h.
| DiscreteSpace< METRIC, PAYLOAD > & swoc::DiscreteSpace< METRIC, PAYLOAD >::mark | ( | DiscreteSpace< METRIC, PAYLOAD >::range_type const & | range, |
| PAYLOAD const & | payload, | ||
| bool | update_tree = true ) |
Set the payload for a range
| range | Range to mark. |
| payload | Payload to set. |
| update_tree | true to update the RBTree structure. |
Values in range are set to payload regardless of the current state.
Definition at line 1401 of file DiscreteRange.h.
| DiscreteSpace< METRIC, PAYLOAD > & swoc::DiscreteSpace< METRIC, PAYLOAD >::mark_bulk | ( | std::pair< range_type, PAYLOAD > * | start, |
| size_t | n, | ||
| bool | is_sorted = false ) |
Mark ranges in one operation.
| start | Pointer to the first range/payload pair. |
| n | Number of pairs. |
| is_sorted | true if input is sorted, false if not. Assumes not sorted. |
Definition at line 1367 of file DiscreteRange.h.
| DiscreteSpace< METRIC, PAYLOAD > & swoc::DiscreteSpace< METRIC, PAYLOAD >::mark_bulk | ( | std::vector< std::pair< range_type, PAYLOAD > > & | marks, |
| bool | is_sorted = false ) |
Mark ranges in one operation.
| marks | Vector of ranges and payloads to mark. |
| is_sorted | true if input is sorted, false if not. Assumes not sorted. |
Definition at line 1361 of file DiscreteRange.h.
|
inlineprotected |
Definition at line 817 of file DiscreteRange.h.
|
protected |
Add node to tree as the first element.
| node | Node to prepend. |
| update_tree | true to update the RBTree structure. |
Invariant - node is first in order.
Definition at line 1244 of file DiscreteRange.h.
|
inlineprotected |
Definition at line 812 of file DiscreteRange.h.
|
protected |
Remove node from container and update container.
| node | Node to remove. |
| update_tree | true to update the RBTree structure. |
Definition at line 1275 of file DiscreteRange.h.
|
inlineprotected |
Definition at line 827 of file DiscreteRange.h.
|
protected |
Definition at line 1108 of file DiscreteRange.h.
| auto swoc::DiscreteSpace< METRIC, PAYLOAD >::upper_bound | ( | METRIC const & | m | ) |
Upper bound.
| m | search value |
Definition at line 1209 of file DiscreteRange.h.
|
protected |
Find the upper bound node.
| target | Search value. |
nullptr if all ranges start before target. Definition at line 1170 of file DiscreteRange.h.
|
protected |
Memory Storage.
Definition at line 807 of file DiscreteRange.h.
|
protected |
Node allocator and free list.
Definition at line 808 of file DiscreteRange.h.
|
protected |
In order list of nodes.
Definition at line 806 of file DiscreteRange.h.
|
protected |
Root node.
Definition at line 805 of file DiscreteRange.h.