Public Types | Public Member Functions | Private Attributes

chomp::homology::setunion< set1type, set2type > Class Template Reference

A union of two hashed sets. More...

#include <chomp/struct/setunion.h>

List of all members.

Public Types

typedef set1type::value_type value_type
 The type of the element of each of the sets.

Public Member Functions

 setunion (const set1type &_set1, const set2type &_set2)
 The only allowed constructor.
 setunion (const setunion< set1type, set2type > &s)
 The copy constructor.
setunionoperator= (const setunion< set1type, set2type > &s)
 The assignment operator.
 ~setunion ()
 The destructor.
const set1type & get1 () const
 Returns a const reference to the first set in the union.
const set2type & get2 () const
 Returns a const reference to the second set in the union.
int_t getnumber (const typename set1type::value_type &e) const
 Finds the given element and returns its number.
bool checknum (int_t n) const
 Checks if the given number is an index of some element in the set union.
bool check (const typename set1type::value_type &e) const
 Checks if the given element is in the set union.
const setunion< set1type,
set2type >::value_type
operator[] (int_t n) const
 Returns the element with the given number from the set union.
const setunion< set1type,
set2type >::value_type
get (int_t n) const
 Returns the element with the given number from the set union.
int_t size () const
 Returns the number of elements in the set union.
bool empty () const
 Returns true if both sets are empty. Otherwise returns false.

Private Attributes

const set1type * set1
 Reference to the first set.
const set2type * set2
 Reference to the second set.

Detailed Description

template<class set1type, class set2type>
class chomp::homology::setunion< set1type, set2type >

A union of two hashed sets.

Thanks to the template style definition, it can be used to define a union of unions of sets etc., although the efficiency of this solution decreases with the increasing recursion level.

Definition at line 61 of file setunion.h.


Member Typedef Documentation

template<class set1type, class set2type>
typedef set1type::value_type chomp::homology::setunion< set1type, set2type >::value_type

The type of the element of each of the sets.

Definition at line 65 of file setunion.h.


Constructor & Destructor Documentation

template<class set1type , class set2type >
chomp::homology::setunion< set1type, set2type >::setunion ( const set1type &  _set1,
const set2type &  _set2 
) [inline]

The only allowed constructor.

Definition at line 125 of file setunion.h.

template<class set1type , class set2type >
chomp::homology::setunion< set1type, set2type >::setunion ( const setunion< set1type, set2type > &  s ) [inline]

The copy constructor.

Definition at line 139 of file setunion.h.

template<class set1type , class set2type >
chomp::homology::setunion< set1type, set2type >::~setunion (  ) [inline]

The destructor.

Definition at line 132 of file setunion.h.


Member Function Documentation

template<class set1type , class set2type >
bool chomp::homology::setunion< set1type, set2type >::check ( const typename set1type::value_type &  e ) const [inline]

Checks if the given element is in the set union.

Returns true if yes, false if no.

Definition at line 187 of file setunion.h.

template<class set1type , class set2type >
bool chomp::homology::setunion< set1type, set2type >::checknum ( int_t  n ) const [inline]

Checks if the given number is an index of some element in the set union.

That is, checks if the number is non-negative and strictly smaller than the number of elements in the set union. Returns true if yes, false if no.

Definition at line 180 of file setunion.h.

template<class set1type , class set2type >
bool chomp::homology::setunion< set1type, set2type >::empty (  ) const [inline]

Returns true if both sets are empty. Otherwise returns false.

Definition at line 217 of file setunion.h.

template<class set1type , class set2type >
const setunion< set1type, set2type >::value_type & chomp::homology::setunion< set1type, set2type >::get ( int_t  n ) const [inline]

Returns the element with the given number from the set union.

Definition at line 194 of file setunion.h.

template<class set1type , class set2type >
const set1type & chomp::homology::setunion< set1type, set2type >::get1 (  ) const [inline]

Returns a const reference to the first set in the union.

Definition at line 154 of file setunion.h.

template<class set1type , class set2type >
const set2type & chomp::homology::setunion< set1type, set2type >::get2 (  ) const [inline]

Returns a const reference to the second set in the union.

Definition at line 160 of file setunion.h.

template<class set1type , class set2type >
int_t chomp::homology::setunion< set1type, set2type >::getnumber ( const typename set1type::value_type &  e ) const [inline]

Finds the given element and returns its number.

Returns -1 if the element is not in the union of the sets.

Definition at line 167 of file setunion.h.

template<class set1type , class set2type >
setunion< set1type, set2type > & chomp::homology::setunion< set1type, set2type >::operator= ( const setunion< set1type, set2type > &  s ) [inline]

The assignment operator.

Definition at line 147 of file setunion.h.

template<class set1type , class set2type >
const setunion< set1type, set2type >::value_type & chomp::homology::setunion< set1type, set2type >::operator[] ( int_t  n ) const [inline]

Returns the element with the given number from the set union.

Definition at line 205 of file setunion.h.

template<class set1type , class set2type >
int_t chomp::homology::setunion< set1type, set2type >::size (  ) const [inline]

Returns the number of elements in the set union.

Definition at line 211 of file setunion.h.


Member Data Documentation

template<class set1type, class set2type>
const set1type* chomp::homology::setunion< set1type, set2type >::set1 [private]

Reference to the first set.

Definition at line 115 of file setunion.h.

template<class set1type, class set2type>
const set2type* chomp::homology::setunion< set1type, set2type >::set2 [private]

Reference to the second set.

Definition at line 118 of file setunion.h.


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