![]() ![]() The template parameter DataType is the type of the stored data points. Requirements for the DataType template parameter Implementing one-dimensional plottables that make use of a QCPDataContainer is usually done by subclassing from QCPAbstractPlottable1D, which introduces an according mDataContainer member and some convenience methods. ![]() Failing to do so can not be detected by the container efficiently and will cause both rendering artifacts and potential data loss. after finishing all sort key manipulation) can be done by calling sort. It is thus the responsibility of the user to leave the container in a sorted state when finished with the data manipulation, before calling any other methods on the container. For performance reasons, the iterators don't automatically cause a re-sorting upon their manipulation. Great care must be taken however if the sort key is modified through the non-const iterators. Changing data members that are not the sort key (for most data types called key) is safe from the container's perspective. If it is necessary to alter existing data in-place, the non-const iterators can be used ( begin, end). The data can be accessed with the provided const iterators ( constBegin, constEnd). The user can further improve performance by specifying that added data is already itself sorted by key, if he can guarantee that this is the case (see for example add(const QVector &data, bool alreadySorted)). If data is added which needs to be inserted between existing keys, the merge usually can be done quickly too, using the fact that existing data is always sorted. The container uses a preallocation and a postallocation scheme, such that appending and prepending data (with respect to the sort key) is very fast and minimizes reallocations. The data is stored in a sorted fashion, which allows very quick lookups by the sorted key as well as retrieval of ranges (see findBegin, findEnd, keyRange) using binary search. The data type is specified as template parameter (called DataType in the following) and must provide some methods as described in the next section. This class template provides a fast container for data storage of one-dimensional data. QcpLessThanSortKey (const DataType &a, const DataType &b) (Note that these are not member functions.) PreallocateGrow (int minimumPreallocSize) LimitIteratorsToDataRange (const_iterator & begin, const_iterator & end, const QCPDataRange & dataRange) const ValueRange (bool &foundRange, QCP::SignDomain signDomain= QCP::sdBoth, const QCPRange &inKeyRange= QCPRange()) KeyRange (bool &foundRange, QCP::SignDomain signDomain= QCP::sdBoth) Squeeze (bool preAllocation=true, bool postAllocation=true)įindBegin (double sortKey, bool expandedRange=true) constįindEnd (double sortKey, bool expandedRange=true) const Remove (double sortKeyFrom, double sortKeyTo) Set (const QVector &data, bool alreadySorted=false)Īdd (const QVector &data, bool alreadySorted=false) The generic data container for one-dimensional plottables. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |