FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
fei::ctg_set< T > Class Template Reference

#include <fei_ctg_set.hpp>

Inheritance diagram for fei::ctg_set< T >:
Inheritance graph
[legend]

Classes

class  const_iterator
 

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 ()
 

Private Member Functions

void expand_dataptr (int newlen)
 

Private Attributes

T * dataptr_
 
int len_
 
int highwatermark_
 
int alloc_incr_
 

Friends

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 ( )
inlinevirtual

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.

Referenced by fei::ctg_set< int >::copy_to_array(), and test_Set::test2().

template<typename T>
static const_iterator fei::ctg_set< T >::end ( )
inlinestatic
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.

Referenced by fei::ctg_set< int >::~ctg_set().

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.

Referenced by test_Set::test2().

template<typename T>
void fei::ctg_set< T >::insert2 ( const T &  item)
inline
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.

Referenced by test_Set::test2(), and test_Set::test5().

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.

Referenced by fei::ctg_set< int >::copy_to_vector().

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
template<typename T>
void fei::ctg_set< T >::expand_dataptr ( int  newlen)
inlineprivate

Friends And Related Function Documentation

template<typename T>
friend class const_iterator
friend

Member Data Documentation

template<typename T>
T* fei::ctg_set< T >::dataptr_
private
template<typename T>
int fei::ctg_set< T >::len_
private
template<typename T>
int fei::ctg_set< T >::highwatermark_
private
template<typename T>
int fei::ctg_set< T >::alloc_incr_
private

Definition at line 520 of file fei_ctg_set.hpp.

Referenced by fei::ctg_set< int >::insert(), and fei::ctg_set< int >::insert2().


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