Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Generic Namespace Reference

Namespace for generic algorithms not assuming any particular datatype. More...


Compounds

struct  Generic::name_match
struct  Generic::unary_virtual_function

Functions

template<classkey_type, classdata_type> void delete_contents (std::map<key_type, data_type*>& m)
 Specialization of general delete_contents algorithm for a map of pointers. More...

template<classT1, classT2> pair<const T1, T2> make_pair_leftconst (const T1& x, const T2& y)
 Variant of make_pair which keeps the left item const; useful for maps. More...

template<classT, classC, classN> void insert_named (C& container, const N& name, T* objptr)
 Insert a named object into any pointer container supporting push_back, overwriting and deleting any existing object with that name (using the objects name() function). More...

template<classT, classC, classN> const T* find_named (const C& container, const N& name)
 Returns a pointer to the first object found with the given name() in the given container. More...

template<classT> T sum (const vector<T>& A)
 Sum of the elements of a vector. More...

template<classT> const T crop (const T lower, const T upper, const T x)
 Crops to the given (inclusive) range, truncating at each end of the range. More...

template<classT> const T wrap (const T lower, const T upper, const T x)
 Circularly aliases (wraps) to the given (inclusive) range, as angles do. More...

template<classContainer> void delete_contents (Container& c)
 Deletes all pointed-to items and removes them from the given container; any standard container of pointers should work. More...

template<classForwardIterator, classT> void lower_threshold (ForwardIterator first, ForwardIterator last, const T& threshold, const T& new_value)
 Apply a lower threshold to any container, with a cropping value that can be different from the threshold. More...

template<classForwardIterator, classT> void upper_threshold (ForwardIterator first, ForwardIterator last, const T& threshold, const T& new_value)
 Apply an upper threshold to any container, with a cropping value that can be different from the threshold. More...


Detailed Description

Namespace for generic algorithms not assuming any particular datatype.


Function Documentation

template<classT>
const T Generic::crop ( const T lower,
const T upper,
const T x ) [inline]
 

Crops to the given (inclusive) range, truncating at each end of the range.

Definition at line 40 of file genericalgs.h.

Referenced by Plot::ColorLookupTable::operator()().

template<classContainer>
void Generic::delete_contents ( Container & c )
 

Deletes all pointed-to items and removes them from the given container; any standard container of pointers should work.

Definition at line 64 of file genericalgs.h.

template<classkey_type, classdata_type>
void Generic::delete_contents ( std::map< key_type,data_type *>& m )
 

Specialization of general delete_contents algorithm for a map of pointers.

Definition at line 24 of file generic_stdlib.h.

Referenced by PointerMap::erase(), Retinal_Composite::remove_all(), and WorldViews::uninit().

template<classT, classC, classN>
const T * Generic::find_named ( const C & container,
const N & name )
 

Returns a pointer to the first object found with the given name() in the given container.

Definition at line 95 of file generic_stdlib.h.

template<classT, classC, classN>
void Generic::insert_named ( C & container,
const N & name,
T * objptr )
 

Insert a named object into any pointer container supporting push_back, overwriting and deleting any existing object with that name (using the objects name() function).

Since the existing object may be deleted, the container must own the objects to which it points.

Definition at line 77 of file generic_stdlib.h.

Referenced by FixedWtRegion::add_input().

template<classForwardIterator, classT>
void Generic::lower_threshold ( ForwardIterator first,
ForwardIterator last,
const T & threshold,
const T & new_value )
 

Apply a lower threshold to any container, with a cropping value that can be different from the threshold.

Definition at line 79 of file genericalgs.h.

Referenced by Retina::activate(), and FixedWtRegion::activate().

template<classT1, classT2>
pair< const T1,T2 > Generic::make_pair_leftconst ( const T1 & x,
const T2 & y ) [inline]
 

Variant of make_pair which keeps the left item const; useful for maps.

Definition at line 36 of file generic_stdlib.h.

template<classT>
T Generic::sum ( const vector< T >& A ) [inline]
 

Sum of the elements of a vector.

Definition at line 105 of file generic_stdlib.h.

template<classForwardIterator, classT>
void Generic::upper_threshold ( ForwardIterator first,
ForwardIterator last,
const T & threshold,
const T & new_value )
 

Apply an upper threshold to any container, with a cropping value that can be different from the threshold.

Definition at line 90 of file genericalgs.h.

template<classT>
const T Generic::wrap ( const T lower,
const T upper,
const T x ) [inline]
 

Circularly aliases (wraps) to the given (inclusive) range, as angles do.

I have no idea how I came up with this algorithm; it can probably be simplified. Files using this routine will need to include <cmath>

Definition at line 51 of file genericalgs.h.


Generated at Mon Aug 21 00:31:29 2000 for RF-LISSOM by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000