Lunchbox  1.14.0
Multi-threaded C++ toolbox library for all application developers creating high-performance multi-threaded programs.
lunchbox::IntervalSet< T > Class Template Reference

A container to store intervals of elements efficently. More...

#include <intervalSet.h>

+ Collaboration diagram for lunchbox::IntervalSet< T >:

Public Member Functions

 IntervalSet ()
 Construct a new interval set. More...
 
void insert (const T &element)
 Insert a new element. More...
 
void insert (const T &startElement, const T &endElement)
 Insert a new closed interval of elements. More...
 
void insert (const IntervalSet &rhs)
 Insert another interval set into this. More...
 
void erase (const T &element)
 Remove the given element. More...
 
void erase (const T &startElement, const T &endElement)
 Remove all element inside the given closed interval. More...
 
void clear ()
 Remove all stored elements. More...
 
void swap (IntervalSet &rhs)
 Swap this container with another one. More...
 
bool exists (const T &element) const
 
const_iterator find (const T &element) const
 
const_iterator begin () const
 
const_iterator end () const
 
size_t size () const
 
bool empty () const
 

Detailed Description

template<typename T>
class lunchbox::IntervalSet< T >

A container to store intervals of elements efficently.

The type can be any class or typename which has the semantics of natural numbers for addition and comparison operations. Not thread-safe.

Example:

Definition at line 36 of file intervalSet.h.

Constructor & Destructor Documentation

template<typename T >
lunchbox::IntervalSet< T >::IntervalSet ( )

Construct a new interval set.

Version
1.7.1

Member Function Documentation

template<typename T >
const_iterator lunchbox::IntervalSet< T >::begin ( ) const
Returns
an iterator to the first element.
Version
1.7.1
template<typename T >
void lunchbox::IntervalSet< T >::clear ( )

Remove all stored elements.

Version
1.7.1
template<typename T >
bool lunchbox::IntervalSet< T >::empty ( ) const
Returns
true if container is empty.
Version
1.7.1
template<typename T >
const_iterator lunchbox::IntervalSet< T >::end ( ) const
Returns
an iterator to the end of the interval set.
Version
1.7.1
template<typename T >
void lunchbox::IntervalSet< T >::erase ( const T &  element)

Remove the given element.

Version
1.7.1
template<typename T >
void lunchbox::IntervalSet< T >::erase ( const T &  startElement,
const T &  endElement 
)

Remove all element inside the given closed interval.

Version
1.7.1
template<typename T >
bool lunchbox::IntervalSet< T >::exists ( const T &  element) const
Returns
true if element exists.
Version
1.7.1
template<typename T >
const_iterator lunchbox::IntervalSet< T >::find ( const T &  element) const
Returns
an iterator to element if stored, end() otherwise.
Version
1.7.1
template<typename T >
void lunchbox::IntervalSet< T >::insert ( const T &  element)

Insert a new element.

Version
1.7.1
template<typename T >
void lunchbox::IntervalSet< T >::insert ( const T &  startElement,
const T &  endElement 
)

Insert a new closed interval of elements.

Version
1.7.1
template<typename T >
void lunchbox::IntervalSet< T >::insert ( const IntervalSet< T > &  rhs)

Insert another interval set into this.

Version
1.7.1
template<typename T >
size_t lunchbox::IntervalSet< T >::size ( ) const
Returns
the number of elements in the stored intervals.
Version
1.7.1
template<typename T >
void lunchbox::IntervalSet< T >::swap ( IntervalSet< T > &  rhs)

Swap this container with another one.

Version
1.7.1

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