Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::stree::SegmentBuilder< K, T, C > Class Template Reference

#include <elm/stree/SegmentBuilder.h>

+ Inheritance diagram for elm::stree::SegmentBuilder< K, T, C >:

Public Member Functions

 SegmentBuilder (const T &def)
 
void add (const K &low, const K &high, const T &val)
 
void make (stree::Tree< K, T, C > &tree)
 

Additional Inherited Members

- Protected Types inherited from elm::stree::Builder< K, T, C >
typedef Tree< K, T, C >::node_t node_t
 
- Protected Member Functions inherited from elm::stree::Builder< K, T, C >
node_tallocate (t::uint32 n)
 
int make (node_t *nodes, int &s, int start, int end)
 

Detailed Description

template<class K, class T, class C = Comparator<K>>
class elm::stree::SegmentBuilder< K, T, C >

Builder for elm::stree::Tree based on a list of disjointed segments.

Warning
Unexpected results may occur if the segments are not disjointed.
Parameters
KKey type.
TRetrieven item type.
CComparator to compare keys (default to Comparator<K>).

Constructor & Destructor Documentation

template<class K, class T, class C = Comparator<K>>
elm::stree::SegmentBuilder< K, T, C >::SegmentBuilder ( const T &  def)

Member Function Documentation

template<class K, class T, class C = Comparator<K>>
void elm::stree::SegmentBuilder< K, T, C >::add ( const K &  low,
const K &  high,
const T &  val 
)

SegmentBuilder::SegmentBuilder(const T& def); Build a segment builder with a default value: the value returned when a look-up select an area out of segments.

Parameters
defDefault value.

Add a segment for a range of keys between low (inclusive) and high (exclusive).

Parameters
lowLow value of the segment (inclusive).
highHigh value of the segment (exclusive).
valValue associated with the segment.

References elm::pair(), and elm::avl::Map< K, T, C >::put().

Referenced by elm::SimpleGC::beginGC().

template<class K, class T, class C = Comparator<K>>
void elm::stree::SegmentBuilder< K, T, C >::make ( stree::Tree< K, T, C > &  tree)

Build the segmented tree from the segments and values.

Parameters
treeTree to initialize.

References elm::stree::Builder< K, T, C >::allocate(), elm::stree::Tree< K, T, C >::node_t::data, elm::stree::Builder< K, T, C >::make(), and elm::stree::Tree< K, T, C >::set().

Referenced by elm::SimpleGC::beginGC().


The documentation for this class was generated from the following files: