52 #ifndef __PCL_IndirectSortedArray_h
53 #define __PCL_IndirectSortedArray_h
58 #include <pcl/Diagnostics.h>
90 template <
class T,
class A = StandardAllocator>
208 return m_array.IsUnique();
220 return m_array.IsAliasOf( x.m_array );
233 m_array.EnsureUnique();
242 return m_array.Size();
249 return m_array.Length();
256 return m_array.Capacity();
263 return m_array.Available();
270 return m_array.IsValid();
277 return m_array.IsEmpty();
284 return m_array.LowerBound();
291 return m_array.UpperBound();
298 return m_array.Allocator();
305 m_array.SetAllocator( a );
312 return m_array.At( i );
319 return m_array.At( i );
326 return m_array.MutableIterator( i );
347 return m_array.ConstBegin();
354 return m_array.Begin();
361 return m_array.ConstEnd();
368 return m_array.End();
375 return m_array.ConstReverseBegin();
382 return m_array.ReverseBegin();
389 return m_array.ConstReverseEnd();
396 return m_array.ReverseEnd();
401 const T* First()
const
403 return m_array.First();
410 return IsEmpty() ? nullptr : *MutableBegin();
415 const T* Last()
const
417 return m_array.Last();
424 return IsEmpty() ? nullptr : *MutableReverseBegin();
437 m_array.UniquifyIterator( i );
451 m_array.UniquifyIterators( i, j );
454 #ifndef __PCL_NO_STL_COMPATIBLE_ITERATORS
488 m_array.Assign( x.m_array );
504 m_array.Transfer( x.m_array );
511 m_array.Transfer( x.m_array );
542 m_array.Transfer( x );
550 m_array.Transfer( x );
558 m_array.Assign( p, n );
566 m_array.Assign( i, j );
575 m_array.CloneAssign( x );
583 m_array.CloneAssign( x );
590 m_array.CloneAssign( x );
597 m_array.Import( i, j );
605 return m_array.Release();
614 for (
iterator i = m_array.Begin(); i < m_array.End() && p < q; ++i )
616 i = m_array.Insert( i, *p++ );
618 m_array.Append( p, q );
642 m_array.EnsureUnique();
651 if (
less()( *i, *h ) )
669 m_array.Remove( i, n );
676 m_array.Remove( i, j );
693 m_array.RemoveFirst( n );
710 m_array.RemoveLast( n );
728 m_array.Truncate( i );
754 m_array.Remove( v, p );
787 m_array.Delete( i, j );
789 pcl::Fill( pcl::Copy( i, j,
const_cast<iterator>( End() ) ),
791 static_cast<T*
>(
nullptr ) );
812 m_array.Delete( v, p );
827 m_array.Destroy( i, n );
834 m_array.Destroy( i, j );
852 m_array.Destroy( v, p );
874 m_array.Reserve( n );
905 return m_array.FirstThat( f );
913 return m_array.LastThat( f );
928 return m_array.Count( p );
936 return m_array.Count( v, p );
944 return m_array.CountIf( p );
959 return m_array.MinItem( p );
966 return IsEmpty() ? End() : End()-1;
974 return m_array.MaxItem( p );
988 return m_array.Search( p );
996 return m_array.Search( v, p );
1010 return m_array.SearchLast( p );
1018 return m_array.SearchLast( v, p );
1025 return Search( v ) != End();
1032 return m_array.Contains( p );
1040 return Search( v, p ) != End();
1065 return x1.m_array == x2.m_array;
1075 return x1.m_array == x2;
1085 return x1 == x2.m_array;
1095 return x1.m_array < x2.m_array;
1105 return x1.m_array < x2;
1115 return x1 < x2.m_array;
1134 template <
class S,
typename SP>
1135 S& ToSeparated( S& s, SP separator )
const
1137 return m_array.ToSeparated( s, separator );
1162 template <
class S,
typename SP,
class AF>
1163 S& ToSeparated( S& s, SP separator, AF append )
const
1165 return m_array.ToSeparated( s, separator, append );
1177 S& ToCommaSeparated( S& s )
const
1179 return m_array.ToCommaSeparated( s );
1191 S& ToSpaceSeparated( S& s )
const
1193 return m_array.ToSpaceSeparated( s );
1205 S& ToTabSeparated( S& s )
const
1207 return m_array.ToTabSeparated( s );
1222 return m_array.Hash64( seed );
1237 return m_array.Hash32( seed );
1253 array_implementation m_array;
1265 template <
class T,
class A,
class V>
inline
1266 IndirectSortedArray<T,A>&
operator <<( IndirectSortedArray<T,A>& x,
const V* p )
1268 x.Add(
static_cast<const T*
>( p ) );
1279 template <
class T,
class A,
class V>
inline
1280 IndirectSortedArray<T,A>&
operator <<( IndirectSortedArray<T,A>&& x,
const V* p )
1282 x.Add(
static_cast<const T*
>( p ) );
1291 template <
class T,
class A>
inline
1292 IndirectSortedArray<T,A>&
operator <<( IndirectSortedArray<T,A>& x1,
const IndirectSortedArray<T,A>& x2 )
1303 template <
class T,
class A>
inline
1304 IndirectSortedArray<T,A>&
operator <<( IndirectSortedArray<T,A>&& x1,
const IndirectSortedArray<T,A>& x2 )
1315 template <
class T,
class A>
inline
1316 IndirectSortedArray<T,A>&
operator <<( IndirectSortedArray<T,A>& x1,
const IndirectArray<T,A>& x2 )
1327 template <
class T,
class A>
inline
1328 IndirectSortedArray<T,A>&
operator <<( IndirectSortedArray<T,A>&& x1,
const IndirectArray<T,A>& x2 )
Provides memory allocation for PCL containers.
Generic dynamic array of pointers to objects.
T *const * const_iterator
const T * const_item_type
Generic dynamic sorted array of pointers to objects.
bool Contains(const T *p) const
const_iterator Search(const T &v, BP p) const
void Import(iterator i, iterator j)
size_type UpperBound() const
reverse_iterator MutableReverseEnd()
IndirectSortedArray(const IndirectSortedArray &)=default
iterator MutableAt(size_type i)
const_iterator Add(const T *p, size_type n=1)
iterator MutableIterator(const_iterator i)
reverse_iterator MutableReverseBegin()
typename array_implementation::const_reverse_iterator const_reverse_iterator
typename array_implementation::reverse_iterator reverse_iterator
const_iterator MinItem(BP p) const
size_type Count(const T &v, BP p) const
void CloneAssign(const C &x)
void UniquifyIterators(iterator &i, iterator &j)
void Add(const IndirectSortedArray &x)
const_iterator At(size_type i) const
void Delete(iterator i, iterator j)
const_iterator Begin() const
IndirectSortedArray(size_type n, const T *p)
uint32 Hash32(uint32 seed=0) const
void Remove(const_iterator i, size_type n=1)
size_type LowerBound() const
const_iterator Search(const T *p) const
const_reverse_iterator ReverseEnd() const
const_iterator SearchLast(const T *p) const
void RemoveFirst(size_type n=1)
IndirectSortedArray(IndirectSortedArray &&)=default
bool Contains(const T &v, BP p) const
const_iterator SearchLast(const T &v, BP p) const
void Destroy(iterator i, iterator j)
void Add(const IndirectArray< T, A > &x)
typename array_implementation::equal equal
void Delete(iterator i, size_type n=1)
const_iterator MaxItem() const
void RemoveLast(size_type n=1)
void Delete(const T &v, BP p)
typename array_implementation::less less
size_type Count(const T &v) const
const_iterator begin() const
void Remove(const T &v, BP p)
size_type Count(const T *p) const
IndirectSortedArray()=default
typename array_implementation::block_allocator block_allocator
friend void Swap(IndirectSortedArray &x1, IndirectSortedArray &x2)
typename array_implementation::iterator iterator
size_type Available() const
void Destroy(const T &v, BP p)
void Reserve(size_type n)
const_iterator LastThat(F f) const
const_reverse_iterator ReverseBegin() const
const allocator & Allocator() const
const_iterator MinItem() const
void Assign(const array_implementation &x)
void Truncate(const_iterator i)
void Transfer(IndirectSortedArray &x)
void Transfer(IndirectSortedArray &&x)
typename array_implementation::const_iterator const_iterator
const_iterator end() const
IndirectSortedArray(FI i, FI j)
void CloneAssign(SortedArray< T, A > &x)
uint64 Hash(uint64 seed=0) const
const_iterator MaxItem(BP p) const
void Destroy(iterator i, size_type n=1)
const_iterator End() const
bool IsAliasOf(const IndirectSortedArray &x) const
void Remove(const_iterator i, const_iterator j)
void Transfer(array_implementation &x)
void UniquifyIterator(iterator &i)
uint64 Hash64(uint64 seed=0) const
void CloneAssign(IndirectSortedArray &x)
size_type CountIf(UP p) const
const_iterator FirstThat(F f) const
bool Contains(const T &v) const
const_iterator Search(const T &v) const
typename array_implementation::allocator allocator
void Assign(const T *p, size_type n=1)
void Shrink(size_type n=1)
const_iterator SearchLast(const T &v) const
size_type Capacity() const
void SetAllocator(const allocator &a)
IndirectSortedArray(size_type n)
void Assign(const IndirectSortedArray &x)
void Transfer(array_implementation &&x)
Root base class of all PCL sorted containers of pointers to objects.
typename IndirectContainer< T >::item_type item_type
typename IndirectContainer< T >::const_item_type const_item_type
Reverse random access iterator.
Generic dynamic sorted array.
Array< T, A > & operator<<(Array< T, A > &x, const V &v)
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
bool operator<(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
Complex< T1 > operator*(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
uint64 Hash64(const void *data, size_type size, uint64 seed=0) noexcept
void Swap(GenericPoint< T > &p1, GenericPoint< T > &p2) noexcept
unsigned long long uint64
FI BinarySearch(FI i, FI j, const T &v) noexcept
FI BinarySearchLast(FI i, FI j, const T &v) noexcept
FI1 Search(FI1 i1, FI1 j1, FI2 i2, FI2 j2) noexcept
FI InsertionPoint(FI i, FI j, const T &v) noexcept
void QuickSort(RI i, RI j)
constexpr const T & Min(const T &a, const T &b) noexcept
constexpr const T & Max(const T &a, const T &b) noexcept
A functional class that tests two pointers for equality of the pointed objects.
A functional class that applies the less than relational operator to the objects pointed to by two po...