Loading...
Searching...
No Matches
DataSet< DATA > Class Template Reference Set of data objects. More...
Detailed DescriptionSet of data objects. Class DataSet manages of sets of data objects of a template type DATA. For constructing a DataSet 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 DataSet will core dump. However, method reMax() allows to reset max() without loss of elements currently in the DataSet. The current number of elements in a DataSet is returned by method num(). Adding elements to a DataSet is done via methods add() or create(), while remove() removes elements from a DataSet. When adding an element to a DataSet the new element is assigned a DataKey. DataKeys serve to access DATA elements in a set via a version of the subscript operator[](DataKey). For convenience all elements in a DataSet 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 DataSet is that the Key of an element remains unchanged as long as the element is a member of the DataSet, while the numbers will change in an undefined way, if other elements are added to or removed from the DataSet. The elements in a DataSet 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 DataSet. The current number of elements in the DataSet is counted in thenum. In theitem only elements 0 thru thesize-1 are used, but only some of them actually contain real data elements of the DataSet. 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
Constructor & Destructor Documentation◆ DataSet() [1/2]default constructor. Definition at line 547 of file dataset.h. References DataSet< DATA >::firstfree, DataSet< DATA >::isConsistent(), soplex::spx_alloc(), soplex::spx_free(), DataSet< DATA >::theitem, DataSet< DATA >::thekey, and DataSet< DATA >::themax. ◆ DataSet() [2/2]copy constructor. Definition at line 573 of file dataset.h. References DataSet< DATA >::firstfree, DataSet< DATA >::isConsistent(), soplex::spx_alloc(), soplex::spx_free(), DataSet< DATA >::theitem, DataSet< DATA >::thekey, DataArray< T >::themax, and DataSet< DATA >::themax. ◆ ~DataSet()destructor. Definition at line 648 of file dataset.h. References soplex::spx_free(), DataSet< DATA >::theitem, and DataSet< DATA >::thekey. Member Function Documentation◆ add() [1/6]adds element
Definition at line 146 of file dataset.h. References DataSet< DATA >::create(). ◆ add() [2/6]adds Definition at line 166 of file dataset.h. References DataSet< DATA >::add(), DataSet< DATA >::max(), and DataSet< DATA >::num(). ◆ add() [3/6]adds all elements of Definition at line 185 of file dataset.h. References DataSet< DATA >::add(), DataSet< DATA >::max(), and DataSet< DATA >::num(). ◆ add() [4/6]adds an element. Definition at line 135 of file dataset.h. References DataSet< DATA >::create(). Referenced by DataSet< DATA >::add(), DataSet< DATA >::add(), DataSet< DATA >::add(), and DataSet< DATA >::add(). ◆ add() [5/6]add several items. Definition at line 156 of file dataset.h. References DataSet< DATA >::add(), DataSet< DATA >::max(), and DataSet< DATA >::num(). ◆ add() [6/6]adds several new items. Definition at line 176 of file dataset.h. References DataSet< DATA >::add(), DataSet< DATA >::max(), and DataSet< DATA >::num(). ◆ clear()remove all elements. Definition at line 353 of file dataset.h. References DataSet< DATA >::firstfree, DataSet< DATA >::themax, DataSet< DATA >::thenum, and DataSet< DATA >::thesize. Referenced by NameSet::clear(), and DataSet< DATA >::operator=(). ◆ create() [1/2]creates new (uninitialized) data element in DataSet.
Definition at line 217 of file dataset.h. References DataSet< DATA >::create(). Referenced by DataSet< DATA >::add(), DataSet< DATA >::add(), and DataSet< DATA >::create(). ◆ create() [2/2]creates new data element in DataSet.
Definition at line 196 of file dataset.h. References DataArray< T >::data, DataSet< DATA >::firstfree, DataSet< DATA >::max(), DataSet< DATA >::num(), DataSet< DATA >::theitem, DataSet< DATA >::thekey, DataSet< DATA >::themax, DataSet< DATA >::thenum, and DataSet< DATA >::thesize. Referenced by NameSet::add(). ◆ has() [1/3]Does Definition at line 467 of file dataset.h. References DataSet< DATA >::number(). ◆ has() [2/3]Is Definition at line 455 of file dataset.h. References DataSet< DATA >::theitem. Referenced by NameSet::has(), NameSet::has(), and DataSet< DATA >::remove(). ◆ has() [3/3]Is Definition at line 461 of file dataset.h. References DataSet< DATA >::num(). ◆ isConsistent()consistency check. Definition at line 516 of file dataset.h. References DataSet< DATA >::firstfree, MSGinconsistent, DataSet< DATA >::theitem, DataSet< DATA >::thekey, DataSet< DATA >::themax, DataSet< DATA >::thenum, and DataSet< DATA >::thesize. Referenced by DataSet< DATA >::DataSet(), DataSet< DATA >::DataSet(), NameSet::isConsistent(), and DataSet< DATA >::operator=(). ◆ key() [1/2]returns DataKey of element Definition at line 425 of file dataset.h. References DataSet< DATA >::number(), and DataSet< DATA >::thekey. ◆ key() [2/2]returns DataKey of Definition at line 418 of file dataset.h. References DataSet< DATA >::num(), and DataSet< DATA >::thekey. Referenced by NameSet::key(). ◆ max()returns maximum number of elements that would fit into DataSet. Definition at line 400 of file dataset.h. References DataSet< DATA >::themax. Referenced by DataSet< DATA >::add(), DataSet< DATA >::add(), DataSet< DATA >::add(), DataSet< DATA >::add(), DataSet< DATA >::create(), NameSet::max(), NameSet::NameSet(), and DataSet< DATA >::operator=(). ◆ num()returns number of elements currently in DataSet. Definition at line 406 of file dataset.h. References DataSet< DATA >::thenum. Referenced by DataSet< DATA >::add(), DataSet< DATA >::add(), DataSet< DATA >::add(), DataSet< DATA >::add(), DataSet< DATA >::create(), DataSet< DATA >::has(), DataSet< DATA >::key(), NameSet::num(), DataSet< DATA >::remove(), DataSet< DATA >::remove(), DataSet< DATA >::remove(), DataSet< DATA >::remove(), NameSet::remove(), and DataSet< DATA >::remove(). ◆ number() [1/2]returns the number of element
Definition at line 444 of file dataset.h. References DataSet< DATA >::size(), and DataSet< DATA >::theitem. ◆ number() [2/2]returns the number of the element with DataKey Definition at line 433 of file dataset.h. References DataSet< DATA >::size(), and DataSet< DATA >::theitem. Referenced by DataSet< DATA >::has(), DataSet< DATA >::key(), NameSet::number(), DataSet< DATA >::remove(), and DataSet< DATA >::remove(). ◆ operator=()assignment operator. The assignment operator involves reMax()ing the lvalue DataSet 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 data elements. Definition at line 608 of file dataset.h. References DataSet< DATA >::clear(), DataSet< DATA >::firstfree, DataSet< DATA >::isConsistent(), DataSet< DATA >::max(), DataSet< DATA >::reMax(), DataArray< T >::size(), DataSet< DATA >::theitem, DataSet< DATA >::thekey, DataArray< T >::themax, DataSet< DATA >::themax, DataSet< DATA >::thenum, DataArray< T >::thesize, and DataSet< DATA >::thesize. ◆ operator[]() [1/4]Definition at line 383 of file dataset.h. References DataArray< T >::data, DataSet< DATA >::theitem, and DataSet< DATA >::thesize. ◆ operator[]() [2/4]returns element with DataKey Definition at line 389 of file dataset.h. References DataArray< T >::data, DataSet< DATA >::theitem, and DataSet< DATA >::thesize. ◆ operator[]() [3/4]Definition at line 370 of file dataset.h. References DataArray< T >::data, DataKey::idx, DataSet< DATA >::theitem, DataSet< DATA >::thekey, and DataSet< DATA >::thenum. ◆ operator[]() [4/4]returns element number Definition at line 376 of file dataset.h. References DataArray< T >::data, DataKey::idx, DataSet< DATA >::theitem, DataSet< DATA >::thekey, and DataSet< DATA >::thenum. ◆ reMax()resets max() to This method will not succeed if Definition at line 495 of file dataset.h. References DataSet< DATA >::firstfree, DataSet< DATA >::size(), soplex::spx_realloc(), DataSet< DATA >::theitem, DataSet< DATA >::thekey, and DataSet< DATA >::themax. Referenced by DataSet< DATA >::operator=(), and NameSet::reMax(). ◆ remove() [1/7]removes element with key Definition at line 267 of file dataset.h. References DataSet< DATA >::number(), and DataSet< DATA >::remove(). ◆ remove() [2/7]remove Definition at line 327 of file dataset.h. References DataArray< T >::get_ptr(), DataSet< DATA >::num(), and DataSet< DATA >::remove(). ◆ remove() [3/7]remove Definition at line 314 of file dataset.h. References DataSet< DATA >::num(), DataSet< DATA >::number(), and DataSet< DATA >::remove(). ◆ remove() [4/7]remove Definition at line 346 of file dataset.h. References DataArray< T >::get_ptr(), DataSet< DATA >::num(), and DataSet< DATA >::remove(). ◆ remove() [5/7]remove Definition at line 333 of file dataset.h. References DataSet< DATA >::num(), and DataSet< DATA >::remove(). ◆ remove() [6/7]remove multiple elements. This method removes all elements for the DataSet with an index i such that Definition at line 277 of file dataset.h. References DataSet< DATA >::firstfree, DataKey::idx, DataSet< DATA >::num(), DataSet< DATA >::theitem, DataSet< DATA >::thekey, and DataSet< DATA >::thenum. ◆ remove() [7/7]removes the Definition at line 241 of file dataset.h. References DataSet< DATA >::firstfree, DataSet< DATA >::has(), DataKey::idx, DataSet< DATA >::theitem, DataSet< DATA >::thekey, DataSet< DATA >::thenum, and DataSet< DATA >::thesize. Referenced by NameSet::remove(), NameSet::remove(), DataSet< DATA >::remove(), DataSet< DATA >::remove(), DataSet< DATA >::remove(), DataSet< DATA >::remove(), DataSet< DATA >::remove(), and NameSet::remove(). ◆ size()returns the maximum DataKey::idx currently in DataSet. Definition at line 412 of file dataset.h. References DataSet< DATA >::thesize. Referenced by DataSet< DATA >::number(), DataSet< DATA >::number(), DataSet< DATA >::reMax(), and NameSet::size(). Member Data Documentation◆ firstfreefirst unused element in theitem Definition at line 121 of file dataset.h. Referenced by DataSet< DATA >::clear(), DataSet< DATA >::create(), DataSet< DATA >::DataSet(), DataSet< DATA >::DataSet(), DataSet< DATA >::isConsistent(), DataSet< DATA >::operator=(), DataSet< DATA >::reMax(), DataSet< DATA >::remove(), and DataSet< DATA >::remove(). ◆ theitem
array of elements in the DataSet Referenced by DataSet< DATA >::create(), DataSet< DATA >::DataSet(), DataSet< DATA >::DataSet(), DataSet< DATA >::has(), DataSet< DATA >::isConsistent(), DataSet< DATA >::number(), DataSet< DATA >::number(), DataSet< DATA >::operator=(), DataSet< DATA >::operator[](), DataSet< DATA >::operator[](), DataSet< DATA >::operator[](), DataSet< DATA >::operator[](), DataSet< DATA >::reMax(), DataSet< DATA >::remove(), DataSet< DATA >::remove(), and DataSet< DATA >::~DataSet(). ◆ thekeyDataKey::idx's of elements. Definition at line 117 of file dataset.h. Referenced by DataSet< DATA >::create(), DataSet< DATA >::DataSet(), DataSet< DATA >::DataSet(), DataSet< DATA >::isConsistent(), DataSet< DATA >::key(), DataSet< DATA >::key(), DataSet< DATA >::operator=(), DataSet< DATA >::operator[](), DataSet< DATA >::operator[](), DataSet< DATA >::reMax(), DataSet< DATA >::remove(), DataSet< DATA >::remove(), and DataSet< DATA >::~DataSet(). ◆ themaxlength of arrays theitem and thekey Definition at line 118 of file dataset.h. Referenced by DataSet< DATA >::clear(), DataSet< DATA >::create(), DataSet< DATA >::DataSet(), DataSet< DATA >::DataSet(), DataSet< DATA >::isConsistent(), DataSet< DATA >::max(), DataSet< DATA >::operator=(), and DataSet< DATA >::reMax(). ◆ thenumnumber of elements in DataSet Definition at line 120 of file dataset.h. Referenced by DataSet< DATA >::clear(), DataSet< DATA >::create(), DataSet< DATA >::isConsistent(), DataSet< DATA >::num(), DataSet< DATA >::operator=(), DataSet< DATA >::operator[](), DataSet< DATA >::operator[](), DataSet< DATA >::remove(), and DataSet< DATA >::remove(). ◆ thesizehighest used element in theitem Definition at line 119 of file dataset.h. Referenced by DataSet< DATA >::clear(), DataSet< DATA >::create(), DataSet< DATA >::isConsistent(), DataSet< DATA >::operator=(), DataSet< DATA >::operator[](), DataSet< DATA >::operator[](), DataSet< DATA >::remove(), and DataSet< DATA >::size().
|