Base template class for IP maps. More...
Public Types | |
typedef IpMapBase | self |
Self reference type. | |
typedef N::ArgType | ArgType |
Import type. | |
typedef N::Metric | Metric |
Import type.g482. | |
typedef IntrusiveDList< RBNode,&RBNode::_next,&RBNode::_prev > | NodeList |
In order list of nodes. | |
Public Member Functions | |
IpMapBase () | |
~IpMapBase () | |
self & | mark (ArgType min, ArgType max, void *data=0) |
Mark a range. | |
self & | unmark (ArgType min, ArgType max) |
Unmark addresses. | |
self & | fill (ArgType min, ArgType max, void *data=0) |
Fill addresses. | |
bool | contains (ArgType target, void **ptr=0) const |
Test for membership. | |
self & | clear () |
Remove all addresses in the map. | |
N * | lowerBound (ArgType target) |
Lower bound for target. | |
void | insertAfter (N *spot, N *n) |
Insert n after spot. | |
void | insertBefore (N *spot, N *n) |
Insert n before spot. | |
void | prepend (N *n) |
Add node n as the first node. | |
void | append (N *n) |
Add node n as the last node. | |
void | remove (N *n) |
Remove a node. | |
void | validate () |
Validate internal data structures. | |
size_t | getCount () const |
self & | print () |
Print all spans. | |
N * | prev (RBNode *n) const |
N * | next (RBNode *n) const |
N * | parent (RBNode *n) const |
N * | left (RBNode *n) const |
N * | right (RBNode *n) const |
N * | getHead () |
N * | getTail () |
Data Fields | |
N * | _root |
Root node. | |
NodeList | _list |
This keeps track of all allocated nodes in order. | |
Friends | |
class | ::IpMap |
Base template class for IP maps.
This class is templated by the N type which must be a subclass of RBNode
. This class carries information about the addresses stored in the map. This includes the type, the common argument type, and some utility methods to operate on the address.
Definition at line 434 of file IpMap.cc.
typedef N::ArgType ts::detail::IpMapBase< N >::ArgType |
typedef N::Metric ts::detail::IpMapBase< N >::Metric |
typedef IntrusiveDList<RBNode, &RBNode::_next, &RBNode::_prev> ts::detail::IpMapBase< N >::NodeList |
typedef IpMapBase ts::detail::IpMapBase< N >::self |
ts::detail::IpMapBase< N >::IpMapBase | ( | ) | [inline] |
ts::detail::IpMapBase< N >::~IpMapBase | ( | ) | [inline] |
void ts::detail::IpMapBase< N >::append | ( | N * | n | ) |
Add node n as the last node.
Definition at line 902 of file IpMap.cc.
References ts::detail::IpMapBase< N >::_list, ts::detail::IpMapBase< N >::_root, IntrusiveDList< T, N, P >::append(), IntrusiveDList< T, N, P >::getTail(), and ts::detail::RBNode::setChild().
Referenced by ts::detail::IpMapBase< N >::fill(), and ts::detail::IpMapBase< N >::mark().
IpMapBase< N > & ts::detail::IpMapBase< N >::clear | ( | void | ) |
Remove all addresses in the map.
unmark
with a range of all addresses.Definition at line 583 of file IpMap.cc.
References ts::detail::IpMapBase< N >::_list, ts::detail::IpMapBase< N >::_root, IntrusiveDList< T, N, P >::clear(), IntrusiveDList< T, N, P >::getHead(), and ts::detail::IpMapBase< N >::next().
Referenced by IpMap::clear(), and ts::detail::IpMapBase< Ip6Node >::~IpMapBase().
bool ts::detail::IpMapBase< N >::contains | ( | ArgType | target, | |
void ** | ptr = 0 | |||
) | const |
Test for membership.
true
if the address is in the map, false
if not. If the address is in the map and ptr is not NULL
, *ptr
is set to the client data for the address. target | Search target value. | |
ptr | Client data return. |
Definition at line 916 of file IpMap.cc.
References ts::detail::IpMapBase< N >::_root, ts::detail::IpMapBase< N >::left(), and ts::detail::IpMapBase< N >::right().
Referenced by IpMap::contains().
IpMapBase< N > & ts::detail::IpMapBase< N >::fill | ( | ArgType | min, | |
ArgType | max, | |||
void * | data = 0 | |||
) |
Fill addresses.
This background fills using the range. All addresses in the range that are not present in the map are added. No previously present address is changed.
Definition at line 597 of file IpMap.cc.
References ts::detail::IpMapBase< N >::append(), ts::detail::IpMapBase< N >::getHead(), ts::detail::IpMapBase< N >::insertBefore(), ts::detail::IpMapBase< N >::lowerBound(), max(), min(), and ts::detail::IpMapBase< N >::next().
Referenced by IpMap::fill().
size_t ts::detail::IpMapBase< N >::getCount | ( | ) | const |
Definition at line 931 of file IpMap.cc.
References ts::detail::IpMapBase< N >::_list, and IntrusiveDList< T, N, P >::getCount().
Referenced by IpMap::getCount().
N* ts::detail::IpMapBase< N >::getHead | ( | ) | [inline] |
Definition at line 554 of file IpMap.cc.
Referenced by IpMap::begin(), ts::detail::IpMapBase< N >::fill(), ts::detail::IpMapBase< N >::mark(), IpMap::iterator::operator++(), and IpMap::iterator::operator--().
N* ts::detail::IpMapBase< N >::getTail | ( | ) | [inline] |
Definition at line 555 of file IpMap.cc.
Referenced by IpMap::iterator::operator++(), and IpMap::iterator::operator--().
void ts::detail::IpMapBase< N >::insertAfter | ( | N * | spot, | |
N * | n | |||
) |
Insert n after spot.
Caller is responsible for ensuring that spot is in this container and the proper location for n.
spot | Node in list. | |
n | Node to insert. |
Definition at line 875 of file IpMap.cc.
References ts::detail::IpMapBase< N >::_list, ts::detail::IpMapBase< N >::_root, IntrusiveDList< T, N, P >::insertAfter(), and ts::detail::IpMapBase< N >::right().
Referenced by ts::detail::IpMapBase< N >::mark(), and ts::detail::IpMapBase< N >::unmark().
void ts::detail::IpMapBase< N >::insertBefore | ( | N * | spot, | |
N * | n | |||
) |
Insert n before spot.
Caller is responsible for ensuring that spot is in this container and the proper location for n.
spot | Node in list. | |
n | Node to insert. |
Definition at line 885 of file IpMap.cc.
References ts::detail::IpMapBase< N >::_list, ts::detail::IpMapBase< N >::_root, IntrusiveDList< T, N, P >::insertBefore(), and ts::detail::IpMapBase< N >::left().
Referenced by ts::detail::IpMapBase< N >::fill(), and ts::detail::IpMapBase< N >::mark().
N* ts::detail::IpMapBase< N >::left | ( | RBNode * | n | ) | const [inline] |
Definition at line 552 of file IpMap.cc.
Referenced by ts::detail::IpMapBase< N >::contains(), ts::detail::IpMapBase< N >::insertBefore(), and ts::detail::IpMapBase< N >::lowerBound().
N * ts::detail::IpMapBase< N >::lowerBound | ( | ArgType | target | ) |
Lower bound for target.
NULL
if all minimum values are larger than target. Definition at line 568 of file IpMap.cc.
References ts::detail::IpMapBase< N >::_root, ts::detail::IpMapBase< N >::left(), and ts::detail::IpMapBase< N >::right().
Referenced by ts::detail::IpMapBase< N >::fill(), ts::detail::IpMapBase< N >::mark(), and ts::detail::IpMapBase< N >::unmark().
IpMapBase< N > & ts::detail::IpMapBase< N >::mark | ( | ArgType | min, | |
ArgType | max, | |||
void * | data = 0 | |||
) |
Mark a range.
All addresses in the range [ min , max ] are marked with data.
min | Minimum value in range. | |
max | Maximum value in range. | |
data | Client data payload. |
Definition at line 715 of file IpMap.cc.
References ts::detail::IpMapBase< N >::append(), ts::detail::IpMapBase< N >::getHead(), ts::detail::IpMapBase< N >::insertAfter(), ts::detail::IpMapBase< N >::insertBefore(), ts::detail::IpMapBase< N >::lowerBound(), ts::detail::IpMapBase< N >::next(), ts::detail::IpMapBase< N >::prepend(), and ts::detail::IpMapBase< N >::prev().
Referenced by IpMap::mark().
N* ts::detail::IpMapBase< N >::next | ( | RBNode * | n | ) | const [inline] |
Definition at line 550 of file IpMap.cc.
Referenced by ts::detail::IpMapBase< N >::clear(), ts::detail::IpMapBase< N >::fill(), ts::detail::IpMapBase< N >::mark(), and ts::detail::IpMapBase< N >::unmark().
N* ts::detail::IpMapBase< N >::parent | ( | RBNode * | n | ) | const [inline] |
void ts::detail::IpMapBase< N >::prepend | ( | N * | n | ) |
Add node n as the first node.
Definition at line 895 of file IpMap.cc.
References ts::detail::IpMapBase< N >::_list, ts::detail::IpMapBase< N >::_root, IntrusiveDList< T, N, P >::getHead(), IntrusiveDList< T, N, P >::prepend(), and ts::detail::RBNode::setChild().
Referenced by ts::detail::IpMapBase< N >::mark().
N* ts::detail::IpMapBase< N >::prev | ( | RBNode * | n | ) | const [inline] |
Definition at line 549 of file IpMap.cc.
Referenced by ts::detail::IpMapBase< N >::mark().
IpMapBase< N > & ts::detail::IpMapBase< N >::print | ( | ) |
Print all spans.
Definition at line 952 of file IpMap.cc.
References ts::detail::IpMapBase< N >::_list, ts::detail::RBNode::_next, and IntrusiveDList< T, N, P >::getHead().
void ts::detail::IpMapBase< N >::remove | ( | N * | n | ) |
Remove a node.
n | Node to remove. |
Definition at line 909 of file IpMap.cc.
References ts::detail::IpMapBase< N >::_list, ts::detail::IpMapBase< N >::_root, and IntrusiveDList< T, N, P >::take().
N* ts::detail::IpMapBase< N >::right | ( | RBNode * | n | ) | const [inline] |
Definition at line 553 of file IpMap.cc.
Referenced by ts::detail::IpMapBase< N >::contains(), ts::detail::IpMapBase< N >::insertAfter(), and ts::detail::IpMapBase< N >::lowerBound().
IpMapBase< N > & ts::detail::IpMapBase< N >::unmark | ( | ArgType | min, | |
ArgType | max | |||
) |
Unmark addresses.
All addresses in the range [ min , max ] are cleared (removed from the map), no longer marked.
Definition at line 838 of file IpMap.cc.
References ts::detail::IpMapBase< N >::insertAfter(), ts::detail::IpMapBase< N >::lowerBound(), and ts::detail::IpMapBase< N >::next().
Referenced by IpMap::unmark().
void ts::detail::IpMapBase< N >::validate | ( | ) |
Validate internal data structures.
Definition at line 934 of file IpMap.cc.
References ts::detail::IpMapBase< N >::_list, ts::detail::RBNode::_next, ts::detail::IpMapBase< N >::_root, and IntrusiveDList< T, N, P >::getHead().
friend class ::IpMap [friend] |
Reimplemented in ts::detail::Ip4Map, and ts::detail::Ip6Map.
NodeList ts::detail::IpMapBase< N >::_list |
This keeps track of all allocated nodes in order.
Iteration depends on this list being maintained.
Definition at line 564 of file IpMap.cc.
Referenced by ts::detail::IpMapBase< N >::append(), ts::detail::IpMapBase< N >::clear(), ts::detail::IpMapBase< N >::getCount(), ts::detail::IpMapBase< Ip6Node >::getHead(), ts::detail::IpMapBase< Ip6Node >::getTail(), ts::detail::IpMapBase< N >::insertAfter(), ts::detail::IpMapBase< N >::insertBefore(), ts::detail::IpMapBase< N >::prepend(), ts::detail::IpMapBase< N >::print(), ts::detail::IpMapBase< N >::remove(), and ts::detail::IpMapBase< N >::validate().
N* ts::detail::IpMapBase< N >::_root |
Root node.
Definition at line 557 of file IpMap.cc.
Referenced by ts::detail::IpMapBase< N >::append(), ts::detail::IpMapBase< N >::clear(), ts::detail::IpMapBase< N >::contains(), ts::detail::IpMapBase< N >::insertAfter(), ts::detail::IpMapBase< N >::insertBefore(), ts::detail::IpMapBase< N >::lowerBound(), ts::detail::IpMapBase< N >::prepend(), ts::detail::IpMapBase< N >::remove(), and ts::detail::IpMapBase< N >::validate().