Loading...
Searching...
No Matches
ClassSet< T > Class Template Reference Set of class objects. More...
Detailed Descriptiontemplate<class T> class soplex::ClassSet< T > Set of class objects. Class ClassSet manages of sets of class objects of a template type T. For constructing a ClassSet the maximum number of entries must be given. The current maximum number may be inquired with method max(). Adding more then max() elements to a ClassSet will core dump. However, method reMax() allows to reset max() without loss of elements currently in the ClassSet. The current number of elements in a ClassSet is returned by method num(). Adding elements to a ClassSet is done via methods add() or create(), while remove() removes elements from a ClassSet. When adding an element to a ClassSet the new element is assigned a DataKey. DataKeys serve to access CLASS elements in a set via a version of the subscript operator[](DataKey). For convenience all elements in a ClassSet are implicitely numbered from 0 through num()-1 and can be accessed with these numbers using a 2nd subscript operator[](int). The reason for providing DataKeys to access elements of a ClassSet is that the Key of an element remains unchanged as long as the element is a member of the ClassSet, while the numbers will change in an undefined way, if other elements are added to or removed from the ClassSet. The elements in a ClassSet and their DataKeys are stored in two arrays:
Both arrays have size themax. In thekey only elements 0 thru thenum-1 contain DataKey::idx's of valid elements, i.e., elements currently in the ClassSet. The current number of elements in the ClassSet is counted in thenum. In theitem only elements 0 thru thesize-1 are used, but only some of them actually contain real class elements of the ClassSet. They are recognized by having info >= 0, which gives the number of that element. Otherwise info < 0 indicates an unused element. Unused elements are linked in a single linked list: starting with element Definition at line 94 of file classset.h. Constructor & Destructor Documentation◆ ClassSet() [1/2]
template<class T >
default constructor. Definition at line 560 of file classset.h. References ClassSet< T >::firstfree, ClassSet< T >::isConsistent(), soplex::spx_alloc(), soplex::spx_free(), ClassSet< T >::theitem, ClassSet< T >::thekey, and ClassSet< T >::themax. ◆ ClassSet() [2/2]copy constructor. Definition at line 590 of file classset.h. References ClassSet< T >::firstfree, ClassSet< T >::isConsistent(), soplex::spx_alloc(), soplex::spx_free(), ClassSet< T >::theitem, ClassSet< T >::thekey, ClassSet< T >::themax, and ClassSet< T >::thenum. ◆ ~ClassSet()
template<class T >
destructor. Definition at line 674 of file classset.h. References soplex::spx_free(), ClassSet< T >::theitem, and ClassSet< T >::thekey. Member Function Documentation◆ add() [1/6]
template<class T >
adds all elements of Definition at line 179 of file classset.h. References ClassSet< T >::add(), ClassSet< T >::max(), and ClassSet< T >::num(). ◆ add() [2/6]
template<class T >
◆ add() [3/6]
template<class T >
adds Definition at line 160 of file classset.h. References ClassSet< T >::add(), ClassSet< T >::max(), and ClassSet< T >::num(). ◆ add() [4/6]
template<class T >
adds an element. Definition at line 131 of file classset.h. References ClassSet< T >::create(). Referenced by ClassSet< T >::add(), ClassSet< T >::add(), ClassSet< T >::add(), and ClassSet< T >::add(). ◆ add() [5/6]adds several new items. Definition at line 170 of file classset.h. References ClassSet< T >::add(), ClassSet< T >::max(), and ClassSet< T >::num(). ◆ add() [6/6]
template<class T >
add several items. Definition at line 150 of file classset.h. References ClassSet< T >::add(), ClassSet< T >::max(), and ClassSet< T >::num(). ◆ clear()
template<class T >
remove all elements. Definition at line 347 of file classset.h. References ClassSet< T >::firstfree, ClassSet< T >::themax, ClassSet< T >::thenum, and ClassSet< T >::thesize. Referenced by ClassSet< T >::operator=(). ◆ create() [1/2]
template<class T >
creates new (uninitialized) class element in ClassSet.
Definition at line 211 of file classset.h. References ClassSet< T >::create(). Referenced by ClassSet< T >::add(), ClassSet< T >::add(), and ClassSet< T >::create(). ◆ create() [2/2]
template<class T >
creates new class element in ClassSet.
Definition at line 190 of file classset.h. References ClassSet< T >::Item::data, ClassSet< T >::firstfree, DataKey::idx, ClassSet< T >::Item::info, ClassSet< T >::max(), ClassSet< T >::num(), ClassSet< T >::theitem, ClassSet< T >::thekey, ClassSet< T >::themax, ClassSet< T >::thenum, and ClassSet< T >::thesize. ◆ has() [1/3]
template<class T >
Is Definition at line 449 of file classset.h. References DataKey::idx, ClassSet< T >::Item::info, and ClassSet< T >::theitem. Referenced by ClassSet< T >::remove(). ◆ has() [2/3]
template<class T >
Does Definition at line 461 of file classset.h. References ClassSet< T >::number(). ◆ has() [3/3]
template<class T >
Is Definition at line 455 of file classset.h. References ClassSet< T >::num(). ◆ isConsistent()
template<class T >
consistency check. Definition at line 529 of file classset.h. References ClassSet< T >::firstfree, SPX_MSG_INCONSISTENT, ClassSet< T >::theitem, ClassSet< T >::thekey, ClassSet< T >::themax, ClassSet< T >::thenum, and ClassSet< T >::thesize. Referenced by ClassSet< T >::ClassSet(), ClassSet< T >::ClassSet(), and ClassSet< T >::operator=(). ◆ key() [1/2]
template<class T >
returns DataKey of element Definition at line 419 of file classset.h. References ClassSet< T >::number(), and ClassSet< T >::thekey. ◆ key() [2/2]
template<class T >
returns DataKey of Definition at line 412 of file classset.h. References ClassSet< T >::num(), and ClassSet< T >::thekey. ◆ max()
template<class T >
returns maximum number of elements that would fit into ClassSet. Definition at line 394 of file classset.h. References ClassSet< T >::themax. Referenced by ClassSet< T >::add(), ClassSet< T >::add(), ClassSet< T >::add(), ClassSet< T >::add(), ClassSet< T >::create(), ClassSet< T >::operator=(), and ClassSet< T >::reMax(). ◆ num()
template<class T >
returns number of elements currently in ClassSet. Definition at line 400 of file classset.h. References ClassSet< T >::thenum. Referenced by ClassSet< T >::add(), ClassSet< T >::add(), ClassSet< T >::add(), ClassSet< T >::add(), ClassSet< T >::create(), ClassSet< T >::has(), ClassSet< T >::key(), ClassSet< T >::operator=(), ClassSet< T >::remove(), ClassSet< T >::remove(), ClassSet< T >::remove(), ClassSet< T >::remove(), and ClassSet< T >::remove(). ◆ number() [1/2]
template<class T >
returns the number of the element with DataKey Definition at line 427 of file classset.h. References DataKey::idx, ClassSet< T >::Item::info, ClassSet< T >::size(), and ClassSet< T >::theitem. Referenced by ClassSet< T >::has(), ClassSet< T >::key(), ClassSet< T >::remove(), and ClassSet< T >::remove(). ◆ number() [2/2]
template<class T >
returns the number of element
Definition at line 438 of file classset.h. References ClassSet< T >::Item::info, ClassSet< T >::size(), and ClassSet< T >::theitem. ◆ operator=()assignment operator. The assignment operator involves reMax()ing the lvalue ClassSet to the size needed for copying all elements of the rvalue. After the assignment all DataKeys from the lvalue are valid for the rvalue as well. They refer to a copy of the corresponding class elements. Definition at line 634 of file classset.h. References ClassSet< T >::clear(), ClassSet< T >::firstfree, ClassSet< T >::Item::info, ClassSet< T >::isConsistent(), ClassSet< T >::max(), ClassSet< T >::num(), ClassSet< T >::reMax(), ClassSet< T >::size(), ClassSet< T >::theitem, ClassSet< T >::thekey, ClassSet< T >::themax, ClassSet< T >::thenum, and ClassSet< T >::thesize. ◆ operator[]() [1/4]
template<class T >
Definition at line 377 of file classset.h. References ClassSet< T >::Item::data, DataKey::idx, ClassSet< T >::theitem, and ClassSet< T >::thesize. ◆ operator[]() [2/4]
template<class T >
returns element with DataKey Definition at line 383 of file classset.h. References ClassSet< T >::Item::data, DataKey::idx, ClassSet< T >::theitem, and ClassSet< T >::thesize. ◆ operator[]() [3/4]
template<class T >
Definition at line 364 of file classset.h. References ClassSet< T >::Item::data, DataKey::idx, ClassSet< T >::theitem, ClassSet< T >::thekey, and ClassSet< T >::thenum. ◆ operator[]() [4/4]
template<class T >
returns element number Definition at line 370 of file classset.h. References ClassSet< T >::Item::data, DataKey::idx, ClassSet< T >::theitem, ClassSet< T >::thekey, and ClassSet< T >::thenum. ◆ reMax()
template<class T >
resets max() to This method will not succeed if Definition at line 489 of file classset.h. References ClassSet< T >::Item::data, ClassSet< T >::firstfree, ClassSet< T >::Item::info, ClassSet< T >::max(), ClassSet< T >::size(), soplex::spx_alloc(), soplex::spx_free(), soplex::spx_realloc(), ClassSet< T >::theitem, ClassSet< T >::thekey, and ClassSet< T >::themax. Referenced by ClassSet< T >::operator=(). ◆ remove() [1/7]
template<class T >
removes element with key Definition at line 261 of file classset.h. References ClassSet< T >::number(), and ClassSet< T >::remove(). ◆ remove() [2/7]
template<class T >
remove Definition at line 321 of file classset.h. References DataArray< T >::get_ptr(), ClassSet< T >::num(), and ClassSet< T >::remove(). ◆ remove() [3/7]
template<class T >
remove Definition at line 308 of file classset.h. References ClassSet< T >::num(), ClassSet< T >::number(), and ClassSet< T >::remove(). ◆ remove() [4/7]
template<class T >
remove Definition at line 340 of file classset.h. References DataArray< T >::get_ptr(), ClassSet< T >::num(), and ClassSet< T >::remove(). ◆ remove() [5/7]
template<class T >
remove Definition at line 327 of file classset.h. References ClassSet< T >::num(), and ClassSet< T >::remove(). ◆ remove() [6/7]
template<class T >
remove multiple elements. This method removes all elements for the ClassSet with an index i such that Definition at line 271 of file classset.h. References ClassSet< T >::firstfree, DataKey::idx, ClassSet< T >::Item::info, ClassSet< T >::num(), ClassSet< T >::theitem, ClassSet< T >::thekey, and ClassSet< T >::thenum. ◆ remove() [7/7]
template<class T >
removes the Definition at line 235 of file classset.h. References ClassSet< T >::firstfree, ClassSet< T >::has(), DataKey::idx, ClassSet< T >::Item::info, ClassSet< T >::theitem, ClassSet< T >::thekey, ClassSet< T >::thenum, and ClassSet< T >::thesize. Referenced by ClassSet< T >::remove(), ClassSet< T >::remove(), ClassSet< T >::remove(), ClassSet< T >::remove(), and ClassSet< T >::remove(). ◆ size()
template<class T >
returns the maximum DataKey::idx currently in ClassSet. Definition at line 406 of file classset.h. References ClassSet< T >::thesize. Referenced by ClassSet< T >::number(), ClassSet< T >::number(), ClassSet< T >::operator=(), and ClassSet< T >::reMax(). Member Data Documentation◆ firstfree
template<class T >
first unused element in theitem Definition at line 117 of file classset.h. Referenced by ClassSet< T >::ClassSet(), ClassSet< T >::ClassSet(), ClassSet< T >::clear(), ClassSet< T >::create(), ClassSet< T >::isConsistent(), ClassSet< T >::operator=(), ClassSet< T >::reMax(), ClassSet< T >::remove(), and ClassSet< T >::remove(). ◆ theitem
template<class T >
array of elements in the ClassSet Referenced by ClassSet< T >::ClassSet(), ClassSet< T >::ClassSet(), ClassSet< T >::create(), ClassSet< T >::has(), ClassSet< T >::isConsistent(), ClassSet< T >::number(), ClassSet< T >::number(), ClassSet< T >::operator=(), ClassSet< T >::operator[](), ClassSet< T >::operator[](), ClassSet< T >::operator[](), ClassSet< T >::operator[](), ClassSet< T >::reMax(), ClassSet< T >::remove(), ClassSet< T >::remove(), and ClassSet< T >::~ClassSet(). ◆ thekey
template<class T >
DataKey::idx's of elements. Definition at line 113 of file classset.h. Referenced by ClassSet< T >::ClassSet(), ClassSet< T >::ClassSet(), ClassSet< T >::create(), ClassSet< T >::isConsistent(), ClassSet< T >::key(), ClassSet< T >::key(), ClassSet< T >::operator=(), ClassSet< T >::operator[](), ClassSet< T >::operator[](), ClassSet< T >::reMax(), ClassSet< T >::remove(), ClassSet< T >::remove(), and ClassSet< T >::~ClassSet(). ◆ themax
template<class T >
length of arrays theitem and thekey Definition at line 114 of file classset.h. Referenced by ClassSet< T >::ClassSet(), ClassSet< T >::ClassSet(), ClassSet< T >::clear(), ClassSet< T >::create(), ClassSet< T >::isConsistent(), ClassSet< T >::max(), ClassSet< T >::operator=(), and ClassSet< T >::reMax(). ◆ thenum
template<class T >
number of elements in ClassSet Definition at line 116 of file classset.h. Referenced by ClassSet< T >::ClassSet(), ClassSet< T >::clear(), ClassSet< T >::create(), ClassSet< T >::isConsistent(), ClassSet< T >::num(), ClassSet< T >::operator=(), ClassSet< T >::operator[](), ClassSet< T >::operator[](), ClassSet< T >::remove(), and ClassSet< T >::remove(). ◆ thesize
template<class T >
highest used element in theitem Definition at line 115 of file classset.h. Referenced by ClassSet< T >::clear(), ClassSet< T >::create(), ClassSet< T >::isConsistent(), ClassSet< T >::operator=(), ClassSet< T >::operator[](), ClassSet< T >::operator[](), ClassSet< T >::remove(), and ClassSet< T >::size().
|