 |
OpendTect
6.6
|
Go to the documentation of this file.
36 : allowmultiples_(allowmultiples) {}
65 std::vector<T>&
vec() {
return vec_.vec(); }
66 const std::vector<T>&
vec()
const {
return vec_.vec(); }
67 T*
arr() {
return size() ? &(*this)[0] : 0; }
68 const T*
arr()
const {
return size() ? &(*this)[0] : 0; }
84 template <
class T>
inline
91 T startval = (*this)[start]; T stopval = (*this)[stop];
92 if ( typ > stopval )
return sz;
94 while ( stopval > startval )
97 return typ>startval ? stop : start;
100 T middleval = (*this)[middle];
102 if ( middleval > typ )
109 startval = middleval;
118 template <
class T>
inline
121 if ( !size() )
return -1;
125 if ( pos>=size() || pos<0 || (*
this)[pos]!=typ )
132 template <
class T>
inline
137 if ( newpos == size() )
139 vec_.push_back( nv );
143 if ( !allowmultiples_ && (*
this)[newpos] == nv )
146 vec_.insert( newpos, nv );
151 template <
class T>
inline
155 if ( !sz )
return *
this;
159 if ( pos == -1 )
return *
this;
161 vec_.removeSingle( pos );
166 template <
class T>
template <
class U>
inline
169 for (
size_type idx=0; idx<size(); idx++ )
171 if ( b.indexOf( (*
this)[idx]) == -1 )
180 template <
class T>
template <
class U>
inline
186 (*
this) += array[idx];
191 template <
class T>
template <
class U>
inline
193 {
return copy(array); }
196 template <
class T>
template <
class U>
inline
201 (*
this) += array[idx];
206 template <
class T>
template <
class U>
inline
211 (*
this) -= array[idx];
216 template <
class T>
inline
222 template <
class T>
inline
225 vec_.remove( p1, p2 );
bool allowmultiples_
Definition: sortedlist.h:79
void intersect(const U &)
Definition: sortedlist.h:167
SortedList< T > & operator+=(const T &)
Definition: sortedlist.h:133
SortedList< T > & operator=(const U &)
Definition: sortedlist.h:192
SortedList< T > & operator-=(const T &)
Definition: sortedlist.h:152
size_type indexOf(const T &) const
Definition: sortedlist.h:119
size_type getPos(const T &) const
Definition: sortedlist.h:85
int size_type
Definition: sortedlist.h:32
BufferStringSet::idx_type indexOf(const BufferStringSet &, const char *)
void removeRange(size_type, size_type)
Definition: sortedlist.h:223
#define mClass(module)
Definition: commondefs.h:181
const std::vector< T > & vec() const
Definition: sortedlist.h:66
T * arr()
Definition: sortedlist.h:67
void removeSingle(size_type)
Definition: sortedlist.h:217
A SortedList is a list where all objects are stored in ascending order. The objects should be capable...
Definition: sortedlist.h:29
void copy(OD::ValVec< T, IT > &to, const OD::ValVec< S, IT > &from)
Definition: typeset.h:255
T object_type
Definition: sortedlist.h:33
const T * arr() const
Definition: sortedlist.h:68
const T & operator[](size_type idx) const
Definition: sortedlist.h:40
void erase()
Definition: sortedlist.h:60
SortedList< T > & add(const T &t)
Definition: sortedlist.h:47
SortedList(bool allowmultiples=true)
Definition: sortedlist.h:35
bool isPresent(const T &t) const
Definition: sortedlist.h:41
std::vector< T > & vec()
Definition: sortedlist.h:65
size_type size() const
Definition: sortedlist.h:39
SortedList< T > & copy(const U &)
Definition: sortedlist.h:181
void setEmpty()
Definition: sortedlist.h:61
VectorAccess< T, size_type > vec_
Definition: sortedlist.h:78
bool isEmpty() const
Definition: sortedlist.h:38
Generated at
for the OpendTect
seismic interpretation project.
Copyright (C): dGB Beheer B.V. 1995-2021