cgma
|
#include <OrderedSet.hpp>
Public Member Functions | |
OrderedSet (void) | |
OrderedSet (const DLIList< X > list) | |
OrderedSet (const std::vector< X > list) | |
CubitBoolean | is_in_list (X item) const |
int | where_is_item (X item) const |
bool | replace_item (X old_item, X new_item) |
CubitBoolean | insert (X new_item) |
CubitBoolean | append (X new_item) |
CubitBoolean | prepend (X new_item) |
void | force_insert (X new_item) |
void | reverse (void) |
void | reset (void) |
void | reserve (int min_size) |
X | get_and_step (int n=1) |
void | step (int n=1) |
X | get () const |
const X & | operator[] (int index) const |
OrderedSet< X > & | operator= (const OrderedSet< X > &from) |
OrderedSet< X > & | operator= (const DLIList< X > &from) |
OrderedSet< X > & | operator= (const std::vector< X > &from) |
OrderedSet< X > & | operator+= (const DLIList< X > &from) |
OrderedSet< X > & | operator+= (const OrderedSet< X > &from) |
OrderedSet< X > & | operator+= (const std::vector< X > &from) |
OrderedSet< X > & | operator+= (X from) |
OrderedSet< X > & | operator-= (const DLIList< X > &from) |
OrderedSet< X > & | operator-= (const OrderedSet< X > &from) |
OrderedSet< X > & | operator-= (const OrderedSet< X > *from) |
OrderedSet< X > & | operator-= (X from) |
OrderedSet< X > | operator& (const OrderedSet< X > other_set) const |
OrderedSet< X > | operator| (const OrderedSet< X > other_set) const |
CubitBoolean | empty (void) const |
int | size (void) const |
X | pop (void) |
void | remove (X item) |
void | clean_out (void) |
void | list (DLIList< X > &list) const |
const DLIList< X > * | list (void) const |
const X & | last (void) const |
const X & | first (void) const |
const std::vector< X > & | as_vector (void) const |
Private Attributes | |
DLIList< X > | mList |
std::set< X > | mSet |
Definition at line 21 of file OrderedSet.hpp.
OrderedSet< X >::OrderedSet | ( | void | ) | [inline] |
Definition at line 29 of file OrderedSet.hpp.
{};
OrderedSet< X >::OrderedSet | ( | const DLIList< X > | list | ) | [inline] |
Definition at line 30 of file OrderedSet.hpp.
OrderedSet< X >::OrderedSet | ( | const std::vector< X > | list | ) | [inline] |
Definition at line 39 of file OrderedSet.hpp.
CubitBoolean OrderedSet< X >::append | ( | X | new_item | ) | [inline] |
Definition at line 97 of file OrderedSet.hpp.
{ return insert( new_item ); }
const std::vector<X>& OrderedSet< X >::as_vector | ( | void | ) | const [inline] |
Definition at line 200 of file OrderedSet.hpp.
{ return mList.as_vector(); };
void OrderedSet< X >::clean_out | ( | void | ) | [inline] |
Definition at line 183 of file OrderedSet.hpp.
CubitBoolean OrderedSet< X >::empty | ( | void | ) | const [inline] |
Definition at line 167 of file OrderedSet.hpp.
{ return ( mList.size() == 0 ? CUBIT_TRUE : CUBIT_FALSE ); };
const X & OrderedSet< X >::first | ( | void | ) | const [inline] |
Definition at line 212 of file OrderedSet.hpp.
void OrderedSet< X >::force_insert | ( | X | new_item | ) | [inline] |
Definition at line 114 of file OrderedSet.hpp.
X OrderedSet< X >::get | ( | ) | const [inline] |
Definition at line 147 of file OrderedSet.hpp.
{ return mList.get(); };
X OrderedSet< X >::get_and_step | ( | int | n = 1 | ) | [inline] |
Definition at line 135 of file OrderedSet.hpp.
CubitBoolean OrderedSet< X >::insert | ( | X | new_item | ) | [inline] |
Definition at line 86 of file OrderedSet.hpp.
{ if ( !is_in_list( new_item ) ) { force_insert( new_item ); return CUBIT_TRUE; } return CUBIT_FALSE; }
CubitBoolean OrderedSet< X >::is_in_list | ( | X | item | ) | const [inline] |
Definition at line 48 of file OrderedSet.hpp.
{ if ( mSet.find( item ) == mSet.end() ) { return CUBIT_FALSE; } return CUBIT_TRUE; };
const X & OrderedSet< X >::last | ( | void | ) | const [inline] |
Definition at line 204 of file OrderedSet.hpp.
void OrderedSet< X >::list | ( | DLIList< X > & | list | ) | const [inline] |
Definition at line 189 of file OrderedSet.hpp.
{ list = mList; }
const DLIList<X>* OrderedSet< X >::list | ( | void | ) | const [inline] |
Definition at line 193 of file OrderedSet.hpp.
{ return &mList; }
OrderedSet< X > OrderedSet< X >::operator& | ( | const OrderedSet< X > | other_set | ) | const [inline] |
Definition at line 347 of file OrderedSet.hpp.
{ OrderedSet<X> tmp; for ( int i = 0; i < other_set.size(); i++ ) { if ( this->is_in_list( other_set[i] ) ) { tmp.append( other_set[i] ); } } return tmp; }
OrderedSet< X > & OrderedSet< X >::operator+= | ( | const DLIList< X > & | from | ) | [inline] |
Definition at line 281 of file OrderedSet.hpp.
OrderedSet< X > & OrderedSet< X >::operator+= | ( | const OrderedSet< X > & | from | ) | [inline] |
Definition at line 303 of file OrderedSet.hpp.
OrderedSet< X > & OrderedSet< X >::operator+= | ( | const std::vector< X > & | from | ) | [inline] |
Definition at line 292 of file OrderedSet.hpp.
OrderedSet< X > & OrderedSet< X >::operator+= | ( | X | from | ) | [inline] |
Definition at line 267 of file OrderedSet.hpp.
{ this->insert( from ); return *this; }
OrderedSet< X > & OrderedSet< X >::operator-= | ( | const DLIList< X > & | from | ) | [inline] |
Definition at line 314 of file OrderedSet.hpp.
OrderedSet< X > & OrderedSet< X >::operator-= | ( | const OrderedSet< X > & | from | ) | [inline] |
Definition at line 325 of file OrderedSet.hpp.
OrderedSet< X > & OrderedSet< X >::operator-= | ( | const OrderedSet< X > * | from | ) | [inline] |
Definition at line 336 of file OrderedSet.hpp.
{ int i; for ( i = 0; i < list->size(); i++ ) { this->remove( (*list)[i] ); } return *this; }
OrderedSet< X > & OrderedSet< X >::operator-= | ( | X | from | ) | [inline] |
Definition at line 274 of file OrderedSet.hpp.
{ this->remove( from ); return *this; }
OrderedSet< X > & OrderedSet< X >::operator= | ( | const OrderedSet< X > & | from | ) | [inline] |
Definition at line 225 of file OrderedSet.hpp.
{ mList.clean_out(); mSet.clear(); int i; int from_size = from.mList.size(); for ( i = 0; i < from_size; i++ ) { force_insert( from.mList[i] ); } return *this; }
OrderedSet< X > & OrderedSet< X >::operator= | ( | const DLIList< X > & | from | ) | [inline] |
OrderedSet< X > & OrderedSet< X >::operator= | ( | const std::vector< X > & | from | ) | [inline] |
const X & OrderedSet< X >::operator[] | ( | int | index | ) | const [inline] |
Definition at line 219 of file OrderedSet.hpp.
{ return mList[index]; }
OrderedSet< X > OrderedSet< X >::operator| | ( | const OrderedSet< X > | other_set | ) | const [inline] |
Definition at line 361 of file OrderedSet.hpp.
{ OrderedSet<X> tmp = *this; tmp += other_set; return tmp; }
X OrderedSet< X >::pop | ( | void | ) | [inline] |
Definition at line 169 of file OrderedSet.hpp.
CubitBoolean OrderedSet< X >::prepend | ( | X | new_item | ) | [inline] |
Definition at line 103 of file OrderedSet.hpp.
{ if ( !is_in_list( new_item ) ) { mList.insert_first( new_item ); mSet.insert( new_item ); return CUBIT_TRUE; } return CUBIT_FALSE; }
void OrderedSet< X >::remove | ( | X | item | ) | [inline] |
Definition at line 175 of file OrderedSet.hpp.
{ if ( !is_in_list( item ) ) return; mList.remove_all_with_value( item ); mSet.erase( item ); };
bool OrderedSet< X >::replace_item | ( | X | old_item, |
X | new_item | ||
) | [inline] |
Definition at line 68 of file OrderedSet.hpp.
void OrderedSet< X >::reserve | ( | int | min_size | ) | [inline] |
Definition at line 130 of file OrderedSet.hpp.
{ mList.reserve(min_size); };
void OrderedSet< X >::reset | ( | void | ) | [inline] |
Definition at line 125 of file OrderedSet.hpp.
{ mList.reset(); };
void OrderedSet< X >::reverse | ( | void | ) | [inline] |
Definition at line 120 of file OrderedSet.hpp.
{ mList.reverse(); };
int OrderedSet< X >::size | ( | void | ) | const [inline] |
Definition at line 168 of file OrderedSet.hpp.
{ return mList.size(); };
void OrderedSet< X >::step | ( | int | n = 1 | ) | [inline] |
Definition at line 142 of file OrderedSet.hpp.
{ mList.step( n ); };
int OrderedSet< X >::where_is_item | ( | X | item | ) | const [inline] |
Definition at line 57 of file OrderedSet.hpp.
{ CubitBoolean stat = is_in_list( item ); if ( stat == CUBIT_TRUE ) { return mList.where_is_item( item ); } return -1; };
DLIList<X> OrderedSet< X >::mList [private] |
Definition at line 24 of file OrderedSet.hpp.
std::set<X> OrderedSet< X >::mSet [private] |
Definition at line 25 of file OrderedSet.hpp.