RT-STL

Classes

class  ApparatusFramework::list< T, maxSize >
class  ApparatusFramework::overWriteQueue< T, maxSize >
class  ApparatusFramework::PriorityList< Item, maxSize >
class  ApparatusFramework::queue< T, maxSize >
class  ApparatusFramework::vector< T, maxSize >

Functions

template<class InIt , class Op >
Op ApparatusFramework::for_each (InIt first, InIt last, Op f)
template<class T >
void ApparatusFramework::swap (T &a, T &b)
template<class T1 , class T2 >
void ApparatusFramework::iter_swap (T1 pa, T2 pb)
template<class T >
const T &() ApparatusFramework::min (const T &a, const T &b)
template<class T >
const T &() ApparatusFramework::max (const T &a, const T &b)
template<class OutIt , class T >
void ApparatusFramework::fill (OutIt first, OutIt last, const T &value)
template<class FwdIt , class Size , class T >
FwdIt ApparatusFramework::fill_n (FwdIt first, Size n, const T &value)
template<class OutIt , class Gen >
void ApparatusFramework::generate (OutIt first, OutIt last, Gen gen)
template<class FwdIt , class Size , class Gen >
FwdIt ApparatusFramework::generate_n (FwdIt first, Size n, Gen gen)
template<class FwdIt , class T >
FwdIt ApparatusFramework::find (FwdIt first, FwdIt last, const T &value)
template<class FwdIt , class Pred >
FwdIt ApparatusFramework::find_if (FwdIt first, FwdIt last, Pred pred)
template<class FwdIt >
FwdIt ApparatusFramework::min_element (FwdIt first, FwdIt last)
template<class FwdIt , class Cmp >
FwdIt ApparatusFramework::min_element (FwdIt first, FwdIt last, Cmp comp)
template<class FwdIt >
FwdIt ApparatusFramework::max_element (FwdIt first, FwdIt last)
template<class FwdIt , class Cmp >
FwdIt ApparatusFramework::max_element (FwdIt first, FwdIt last, Cmp comp)
template<class BidIt >
void ApparatusFramework::sort (BidIt first, BidIt last)
template<class BidIt , class Cmp >
void ApparatusFramework::sort (BidIt first, BidIt last, Cmp comp)

Detailed Description

The real-time STL package provides a lightweight static replacement for the standard template library. It does not use any dynamic memory allocation. The size of containers can be specified statically during compile time. This makes our package safe to use in devices with very limited resources.

We only provide a subset of the STL functionality. We limited ourselves to the most often used containers and algorithms. But we took great care to provide the same interface as the STL equivalents. This simplifies the switch to a different implementation. Our RT STL also adheres to the performance requirements of the library functions, unless otherwise specified.

Algorithms

These global template functions implement the equivalent of some of the algorithms defined in the standard template library. But they do not use any dynamic memory allocation scheme.

We support the same interface as the STL functions. This feature allows an easy switch between the dynamic and the static bound classes.

Caution: the sorting implemented in this file needs O(N^2) time, since we only use bidirectional iterators. There is no specialization for random-access operators, as are provided by vector classes.


Function Documentation

template<class OutIt , class T >
void ApparatusFramework::fill ( OutIt  first,
OutIt  last,
const T &  value 
) [inline]

Fills a sequence of elements with a specific value.

Parameters:
first first element of the sequence.
last last element of the sequence.
value value to be filled into sequence.

Definition at line 144 of file algorithm.h.

template<class FwdIt , class Size , class T >
FwdIt ApparatusFramework::fill_n ( FwdIt  first,
Size  n,
const T &  value 
) [inline]

Fills a number of elements with a specific value.

Parameters:
first first element of the sequence.
n number of elements to be filled.
value value to be filled into sequence.
Returns:
FwdIt iterator at end of sequence.

Definition at line 158 of file algorithm.h.

template<class FwdIt , class T >
FwdIt ApparatusFramework::find ( FwdIt  first,
FwdIt  last,
const T &  value 
) [inline]

Tries to find a specific element in a sequence.

Parameters:
first first element of the sequence.
last last element of the sequence.
value value to be found in sequence.
Returns:
FwdIt iterator pointing to element if found, otherwise pointing to last.

Definition at line 202 of file algorithm.h.

template<class FwdIt , class Pred >
FwdIt ApparatusFramework::find_if ( FwdIt  first,
FwdIt  last,
Pred  pred 
) [inline]

Tries to find a element satisfying a predicate in a sequence.

Parameters:
first first element of the sequence.
last last element of the sequence.
pred predicate.
Returns:
FwdIt iterator pointing to element if found, otherwise pointing to last.

Definition at line 218 of file algorithm.h.

template<class InIt , class Op >
Op ApparatusFramework::for_each ( InIt  first,
InIt  last,
Op  f 
) [inline]

Executes a function on each element of a sequence. Make sure that both first and last point to the same collection!

Parameters:
first first element of the sequence.
last last element of the sequence.
f function to be performed.
Returns:
Op function that was performed.

Definition at line 85 of file algorithm.h.

template<class OutIt , class Gen >
void ApparatusFramework::generate ( OutIt  first,
OutIt  last,
Gen  gen 
) [inline]

Fills a sequence of elements with the result of a generating function.

Parameters:
first first element of the sequence.
last last element of the sequence.
gen generates an element to be filled into sequence.

Definition at line 172 of file algorithm.h.

template<class FwdIt , class Size , class Gen >
FwdIt ApparatusFramework::generate_n ( FwdIt  first,
Size  n,
Gen  gen 
) [inline]

Fills a number of elements with the result of a generating function.

Parameters:
first first element of the sequence.
n number of elements to be filled.
gen generates an element to filled into sequence.
Returns:
FwdIt iterator at end of sequence.

Definition at line 186 of file algorithm.h.

template<class T1 , class T2 >
void ApparatusFramework::iter_swap ( T1  pa,
T2  pb 
) [inline]

Swaps two elements pointed to by iterators.

Parameters:
pa iterator pointing to the first element.
pb iterator pointing to the second element.

Definition at line 111 of file algorithm.h.

References ApparatusFramework::swap().

template<class T >
const T&() ApparatusFramework::max ( const T &  a,
const T &  b 
) [inline]

Returns the bigger of two elements.

Parameters:
a first element.
b second element.
Returns:
T& the bigger of the two elements.

Definition at line 133 of file algorithm.h.

template<class FwdIt , class Cmp >
FwdIt ApparatusFramework::max_element ( FwdIt  first,
FwdIt  last,
Cmp  comp 
) [inline]

Returns the biggest element of a sequence, according to a compare function.

Parameters:
first first element of the sequence.
last last element of the sequence.
comp compare function .
Returns:
FwdIt iterator pointing to the biggest element of the sequence.

Definition at line 288 of file algorithm.h.

template<class FwdIt >
FwdIt ApparatusFramework::max_element ( FwdIt  first,
FwdIt  last 
) [inline]

Returns the biggest element of a sequence.

Parameters:
first first element of the sequence.
last last element of the sequence.
Returns:
FwdIt iterator pointing to the biggest element of the sequence.

Definition at line 269 of file algorithm.h.

template<class T >
const T&() ApparatusFramework::min ( const T &  a,
const T &  b 
) [inline]

Returns the smaller of two elements.

Parameters:
a first element.
b second element.
Returns:
T& the smaller of the two elements.

Definition at line 122 of file algorithm.h.

template<class FwdIt , class Cmp >
FwdIt ApparatusFramework::min_element ( FwdIt  first,
FwdIt  last,
Cmp  comp 
) [inline]

Returns the smallest element of a sequence, according to a compare function.

Parameters:
first first element of the sequence.
last last element of the sequence.
comp compare function.
Returns:
FwdIt iterator pointing to the smallest element of the sequence.

Definition at line 252 of file algorithm.h.

template<class FwdIt >
FwdIt ApparatusFramework::min_element ( FwdIt  first,
FwdIt  last 
) [inline]

Returns the smallest element of a sequence.

Parameters:
first first element of the sequence.
last last element of the sequence.
Returns:
FwdIt iterator pointing to the smallest element of the sequence.

Definition at line 232 of file algorithm.h.

template<class BidIt , class Cmp >
void ApparatusFramework::sort ( BidIt  first,
BidIt  last,
Cmp  comp 
) [inline]

Sorts the elements of a sequence, according to a compare function.

Parameters:
first first element of the sequence.
last last element of the sequence.
comp compare function.

Definition at line 329 of file algorithm.h.

References ApparatusFramework::swap().

template<class BidIt >
void ApparatusFramework::sort ( BidIt  first,
BidIt  last 
) [inline]

Sorts the elements of a sequence in ascending order.

Parameters:
first first element of the sequence.
last last element of the sequence.

Definition at line 305 of file algorithm.h.

References ApparatusFramework::swap().

template<class T >
void ApparatusFramework::swap ( T &  a,
T &  b 
) [inline]

Swaps two elements a and b.

Parameters:
a first element.
b second element.

Definition at line 99 of file algorithm.h.

Referenced by ApparatusFramework::iter_swap(), and ApparatusFramework::sort().

© 2004-2010 bbv Software Services AG / Apparatus Services