fei::ctg_set< T > Class Template Reference

#include <fei_ctg_set.hpp>

Inheritance diagram for fei::ctg_set< T >:

Inheritance graph
[legend]
List of all members.

Public Types

typedef T key_type

Public Member Functions

 ctg_set (int alloc_incr=32)
 ctg_set (const ctg_set< T > &src)
virtual ~ctg_set ()
const_iterator begin () const
ctg_set< T > & operator= (const ctg_set< T > &src)
bool operator!= (const ctg_set< T > &rhs)
int clear ()
std::pair< const_iterator,
bool > 
insert (const T &item)
void insert2 (const T &item)
int insert2_dense_group (const T &starting_index, int group_size)
const_iterator find (const T &item)
int copy_to_array (int len, T *items) const
int copy_to_vector (std::vector< T > &items) const
int size () const

Static Public Member Functions

static const_iterator end ()

Friends

class const_iterator

Classes

class  const_iterator

Detailed Description

template<typename T>
class fei::ctg_set< T >

A specialized container that mimics std::set in many ways. This set can only be used for integer types (such as short, int, long).

This container is optimized for inserting/storing indices that have significant contiguous sections or ranges.

Data is stored in an array in pairs, where each pair represents a contiguous range. The first item in a pair is the beginning of the range, and the second item in a pair is one greater than the end of the range. Example: Assume the data to be stored is 0, 1, 2, 3, 6, 7, 8, which forms two contiguous ranges 0 - 3 and 6 - 8. This container will store this data in an array like this: 0, 4, 6, 9.

Definition at line 39 of file fei_ctg_set.hpp.


Member Typedef Documentation

template<typename T>
typedef T fei::ctg_set< T >::key_type

alias for template parameter

Definition at line 61 of file fei_ctg_set.hpp.


Constructor & Destructor Documentation

template<typename T>
fei::ctg_set< T >::ctg_set ( int  alloc_incr = 32  )  [inline]

constructor

Definition at line 42 of file fei_ctg_set.hpp.

template<typename T>
fei::ctg_set< T >::ctg_set ( const ctg_set< T > &  src  )  [inline]

constructor

Definition at line 46 of file fei_ctg_set.hpp.

template<typename T>
virtual fei::ctg_set< T >::~ctg_set (  )  [inline, virtual]

destructor

Definition at line 58 of file fei_ctg_set.hpp.


Member Function Documentation

template<typename T>
const_iterator fei::ctg_set< T >::begin (  )  const [inline]

iterator pointing to the beginning of ctg_set's contents

Definition at line 145 of file fei_ctg_set.hpp.

template<typename T>
static const_iterator fei::ctg_set< T >::end (  )  [inline, static]

iterator pointing one past the end of ctg_set's contents

Definition at line 155 of file fei_ctg_set.hpp.

template<typename T>
ctg_set<T>& fei::ctg_set< T >::operator= ( const ctg_set< T > &  src  )  [inline]

assignment operator=

Definition at line 158 of file fei_ctg_set.hpp.

template<typename T>
bool fei::ctg_set< T >::operator!= ( const ctg_set< T > &  rhs  )  [inline]

operator!=

Definition at line 168 of file fei_ctg_set.hpp.

template<typename T>
int fei::ctg_set< T >::clear (  )  [inline]

Clear the contents of this set. (Get rid of the contents.)

Definition at line 185 of file fei_ctg_set.hpp.

template<typename T>
std::pair<const_iterator,bool> fei::ctg_set< T >::insert ( const T &  item  )  [inline]

Insert item in this set, if not already present. Return value is a pair with an iterator, and a bool indicating whether the insertion was made.

Definition at line 198 of file fei_ctg_set.hpp.

template<typename T>
void fei::ctg_set< T >::insert2 ( const T &  item  )  [inline]

insert2 -- power-users only

Definition at line 326 of file fei_ctg_set.hpp.

template<typename T>
int fei::ctg_set< T >::insert2_dense_group ( const T &  starting_index,
int  group_size 
) [inline]

insert2_dense_group -- not really implemented correctly

Definition at line 427 of file fei_ctg_set.hpp.

template<typename T>
const_iterator fei::ctg_set< T >::find ( const T &  item  )  [inline]

find specified item in ctg_set. If not found, return iterator==end().

Definition at line 437 of file fei_ctg_set.hpp.

template<typename T>
int fei::ctg_set< T >::copy_to_array ( int  len,
T *  items 
) const [inline]

Copy contents of ctg_set into array of length len. The number of items copied into array is min(len, size()).

Definition at line 465 of file fei_ctg_set.hpp.

template<typename T>
int fei::ctg_set< T >::copy_to_vector ( std::vector< T > &  items  )  const [inline]

Copy contents of ctg_set into std::vector.

Definition at line 481 of file fei_ctg_set.hpp.

template<typename T>
int fei::ctg_set< T >::size (  )  const [inline]

return size of ctg_set.

Definition at line 490 of file fei_ctg_set.hpp.


The documentation for this class was generated from the following file:
Generated on Wed May 12 01:33:50 2010 for FEI by  doxygen 1.4.7