FEI Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
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

◆ key_type

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

◆ ctg_set() [1/2]

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.

◆ ctg_set() [2/2]

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

◆ ~ctg_set()

template<typename T >
virtual fei::ctg_set< T >::~ctg_set ( )
inlinevirtual

destructor

Definition at line 58 of file fei_ctg_set.hpp.

References fei::ctg_set< T >::clear().

Member Function Documentation

◆ begin()

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.

References fei::ctg_set< T >::dataptr_, fei::ctg_set< T >::len_, and fei::Set_end_val.

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

◆ end()

template<typename T >
static const_iterator fei::ctg_set< T >::end ( )
inlinestatic

◆ operator=()

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.

References fei::ctg_set< T >::expand_dataptr(), fei::ctg_set< T >::highwatermark_, and fei::ctg_set< T >::len_.

◆ operator!=()

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.

References fei::ctg_set< T >::dataptr_, and fei::ctg_set< T >::len_.

◆ clear()

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.

References fei::ctg_set< T >::dataptr_, fei::ctg_set< T >::highwatermark_, and fei::ctg_set< T >::len_.

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

◆ insert()

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.

References fei::ctg_set< T >::alloc_incr_, fei::ctg_set< T >::dataptr_, fei::ctg_set< T >::expand_dataptr(), FEI_COUT, FEI_ENDL, fei::ctg_set< T >::highwatermark_, fei::ctg_set< T >::len_, and fei::lowerBound().

Referenced by test_Set::test2().

◆ insert2()

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

◆ insert2_dense_group()

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.

References fei::ctg_set< T >::insert2().

◆ find()

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.

References fei::binarySearch(), fei::ctg_set< T >::dataptr_, fei::ctg_set< T >::end(), fei::ctg_set< T >::len_, and fei::Set_end_val.

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

◆ copy_to_array()

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.

References fei::ctg_set< T >::begin(), and fei::ctg_set< T >::end().

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

◆ 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.

References fei::ctg_set< T >::copy_to_array(), and fei::ctg_set< T >::size().

◆ size()

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

◆ expand_dataptr()

template<typename T >
void fei::ctg_set< T >::expand_dataptr ( int  newlen)
inlineprivate

Friends And Related Function Documentation

◆ const_iterator

template<typename T >
friend class const_iterator
friend

Definition at line 516 of file fei_ctg_set.hpp.

Member Data Documentation

◆ dataptr_

template<typename T >
T* fei::ctg_set< T >::dataptr_
private

◆ len_

template<typename T >
int fei::ctg_set< T >::len_
private

◆ highwatermark_

template<typename T >
int fei::ctg_set< T >::highwatermark_
private

◆ alloc_incr_

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< T >::insert(), and fei::ctg_set< T >::insert2().


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