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 firstfree, isConsistent(), soplex::spx_alloc(), soplex::spx_free(), theitem, thekey, themax, thenum, and thesize. Referenced by ClassSet(). ◆ ClassSet() [2/2]copy constructor. Definition at line 590 of file classset.h. References ClassSet(), firstfree, isConsistent(), soplex::spx_alloc(), soplex::spx_free(), theitem, thekey, themax, thenum, and thesize. ◆ ~ClassSet()
template<class T>
destructor. Definition at line 674 of file classset.h. References soplex::spx_free(), theitem, and thekey. Member Function Documentation◆ add() [1/6]
template<class T>
adds all elements of Definition at line 179 of file classset.h. ◆ add() [2/6]
template<class T>
◆ add() [3/6]
template<class T>
adds Definition at line 160 of file classset.h. ◆ add() [4/6]
template<class T>
◆ add() [5/6]adds several new items. Definition at line 170 of file classset.h. ◆ add() [6/6]
template<class T>
◆ clear()
template<class T>
remove all elements. Definition at line 347 of file classset.h. References firstfree, themax, thenum, and thesize. Referenced by operator=(). ◆ create() [1/2]
template<class T>
◆ create() [2/2]
template<class T>
◆ has() [1/3]
template<class T>
Is Definition at line 449 of file classset.h. References DataKey::idx, and theitem. Referenced by remove(). ◆ has() [2/3]
template<class T>
◆ has() [3/3]
template<class T>
Is Definition at line 455 of file classset.h. References num(). ◆ isConsistent()
template<class T>
consistency check. Definition at line 529 of file classset.h. References firstfree, SPX_MSG_INCONSISTENT, theitem, thekey, themax, thenum, and thesize. Referenced by ClassSet(), ClassSet(), and operator=(). ◆ key() [1/2]
template<class T>
◆ key() [2/2]
template<class T>
◆ max()
template<class T>
◆ num()
template<class T>
◆ number() [1/2]
template<class T>
◆ number() [2/2]
template<class T>
◆ 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 clear(), firstfree, ClassSet< T >::Item::info, isConsistent(), max(), num(), reMax(), size(), theitem, thekey, themax, thenum, and thesize. ◆ operator[]() [1/4]
template<class T>
Definition at line 377 of file classset.h. References DataKey::idx, theitem, and thesize. ◆ operator[]() [2/4]
template<class T>
returns element with DataKey Definition at line 383 of file classset.h. References DataKey::idx, theitem, and thesize. ◆ operator[]() [3/4]
template<class T>
Definition at line 364 of file classset.h. ◆ operator[]() [4/4]
template<class T>
returns element number Definition at line 370 of file classset.h. ◆ 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, firstfree, ClassSet< T >::Item::info, max(), size(), soplex::spx_alloc(), soplex::spx_free(), soplex::spx_realloc(), theitem, thekey, and themax. Referenced by operator=(). ◆ remove() [1/7]
template<class T>
removes element with key Definition at line 261 of file classset.h. ◆ remove() [2/7]
template<class T>
remove Definition at line 321 of file classset.h. References DataArray< T >::get_ptr(), num(), and remove(). ◆ remove() [3/7]
template<class T>
remove Definition at line 308 of file classset.h. ◆ remove() [4/7]
template<class T>
remove Definition at line 340 of file classset.h. References DataArray< T >::get_ptr(), num(), and remove(). ◆ remove() [5/7]
template<class T>
remove Definition at line 327 of file classset.h. ◆ remove() [6/7]
template<class T>
◆ remove() [7/7]
template<class T>
◆ size()
template<class T>
returns the maximum DataKey::idx currently in ClassSet. Definition at line 406 of file classset.h. References thesize. Referenced by number(), number(), operator=(), and reMax(). Member Data Documentation◆ firstfree
template<class T>
first unused element in theitem Definition at line 117 of file classset.h. Referenced by ClassSet(), ClassSet(), clear(), create(), isConsistent(), operator=(), reMax(), remove(), and remove(). ◆ theitem
template<class T>
array of elements in the ClassSet Referenced by ClassSet(), ClassSet(), create(), has(), isConsistent(), number(), number(), operator=(), operator[](), operator[](), operator[](), operator[](), reMax(), remove(), remove(), and ~ClassSet(). ◆ thekey
template<class T>
DataKey::idx's of elements. Definition at line 113 of file classset.h. Referenced by ClassSet(), ClassSet(), create(), isConsistent(), key(), key(), operator=(), operator[](), operator[](), reMax(), remove(), remove(), and ~ClassSet(). ◆ themax
template<class T>
length of arrays theitem and thekey Definition at line 114 of file classset.h. Referenced by ClassSet(), ClassSet(), clear(), create(), isConsistent(), max(), operator=(), and reMax(). ◆ thenum
template<class T>
number of elements in ClassSet Definition at line 116 of file classset.h. Referenced by ClassSet(), ClassSet(), clear(), create(), isConsistent(), num(), operator=(), operator[](), operator[](), remove(), and remove(). ◆ thesize
template<class T>
highest used element in theitem Definition at line 115 of file classset.h. Referenced by ClassSet(), ClassSet(), clear(), create(), isConsistent(), operator=(), operator[](), operator[](), remove(), and size().
|