52 #ifndef __PCL_SortedArray_h
53 #define __PCL_SortedArray_h
58 #include <pcl/Diagnostics.h>
81 template <
class T,
class A = StandardAllocator>
169 template <
typename T1>
198 return m_array.IsUnique();
208 return m_array.IsAliasOf( x.m_array );
220 m_array.EnsureUnique();
229 return m_array.Size();
237 return m_array.Length();
244 return m_array.Capacity();
251 return m_array.Available();
258 return m_array.IsValid();
265 return m_array.IsEmpty();
272 return m_array.LowerBound();
279 return m_array.UpperBound();
286 return m_array.Allocator();
293 m_array.SetAllocator( a );
300 return m_array.At( i );
307 return m_array.At( i );
314 return m_array.MutableIterator( i );
335 return m_array.ConstBegin();
342 return m_array.Begin();
349 return m_array.ConstEnd();
356 return m_array.End();
363 return m_array.ConstReverseBegin();
370 return m_array.ReverseBegin();
377 return m_array.ConstReverseEnd();
384 return m_array.ReverseEnd();
397 return m_array.UniquifyIterator( i );
411 return m_array.UniquifyIterators( i, j );
414 #ifndef __PCL_NO_STL_COMPATIBLE_ITERATORS
448 m_array.Assign( x.m_array );
464 m_array.Transfer( x.m_array );
471 m_array.Transfer( x.m_array );
502 m_array.Transfer( x );
510 m_array.Transfer( x );
518 m_array.Assign( v, n );
526 m_array.Assign( i, j );
534 m_array.Import( i, j );
542 return m_array.Release();
550 for (
iterator i = m_array.Begin(); i < m_array.End() && p < q; ++i )
552 i = m_array.Insert( i, *p++ );
554 m_array.Append( p, q );
578 m_array.EnsureUnique();
579 for (
iterator l = m_array.Begin(), r = m_array.End(); ; )
605 m_array.Remove(
const_cast<iterator>( i ), n );
626 m_array.RemoveFirst( n );
640 m_array.RemoveLast( n );
655 m_array.Truncate(
const_cast<iterator>( i ) );
687 m_array.Reserve( n );
742 return m_array.Count( v, p );
750 return m_array.CountIf( p );
772 return IsEmpty() ? End() : End()-1;
795 return m_array.Search( v, p );
810 return m_array.SearchLast( v, p );
817 return Search( v ) != End();
825 return Search( v, p ) != End();
849 return x1.m_array == x2.m_array;
858 return x1.m_array == x2;
867 return x1 == x2.m_array;
877 return x1.m_array < x2.m_array;
886 return x1.m_array < x2;
895 return x1 < x2.m_array;
914 template <
class S,
typename SP>
915 S& ToSeparated( S& s, SP separator )
const
917 return m_array.ToSeparated( s, separator );
942 template <
class S,
typename SP,
class AF>
943 S& ToSeparated( S& s, SP separator, AF append )
const
945 return m_array.ToSeparated( s, separator, append );
957 S& ToCommaSeparated( S& s )
const
959 return m_array.ToCommaSeparated( s );
971 S& ToSpaceSeparated( S& s )
const
973 return m_array.ToSpaceSeparated( s );
985 S& ToTabSeparated( S& s )
const
987 return m_array.ToTabSeparated( s );
999 S& ToNewLineSeparated( S& s )
const
1001 return m_array.ToNewLineSeparated( s );
1014 return m_array.Hash64( seed );
1027 return m_array.Hash32( seed );
1043 array_implementation m_array;
1056 template <
class T,
class A,
class V>
inline
1057 SortedArray<T,A>&
operator <<( SortedArray<T,A>& x,
const V& v )
1071 template <
class T,
class A,
class V>
inline
1072 SortedArray<T,A>&
operator <<( SortedArray<T,A>&& x,
const V& v )
1083 template <
class T,
class A>
inline
1084 SortedArray<T,A>&
operator <<( SortedArray<T,A>& x1,
const SortedArray<T,A>& x2 )
1095 template <
class T,
class A>
inline
1096 SortedArray<T,A>&
operator <<( SortedArray<T,A>&& x1,
const SortedArray<T,A>& x2 )
1107 template <
class T,
class A>
inline
1108 SortedArray<T,A>&
operator <<( SortedArray<T,A>& x1,
const Array<T,A>& x2 )
1119 template <
class T,
class A>
inline
1120 SortedArray<T,A>&
operator <<( SortedArray<T,A>&& x1,
const Array<T,A>& x2 )
Provides memory allocation for PCL containers.
Root base class of all PCL sorted containers of objects.
typename DirectContainer< T >::item_type item_type
typename DirectContainer< T >::const_item_type const_item_type
Reverse random access iterator.
Generic dynamic sorted array.
void Shrink(size_type n=1)
SortedArray(const SortedArray &)=default
SortedArray(size_type n, const T &v)
const_reverse_iterator ReverseBegin() const
typename array_implementation::block_allocator block_allocator
void UniquifyIterator(iterator &i)
SortedArray(SortedArray &&)=default
const allocator & Allocator() const
const_iterator SearchLast(const T &v, BP p) const
friend void Swap(SortedArray &x1, SortedArray &x2)
typename array_implementation::allocator allocator
const_reverse_iterator ReverseEnd() const
bool Contains(const T &v, BP p) const
uint32 Hash32(uint32 seed=0) const
void Assign(const SortedArray &x)
const_iterator End() const
void Transfer(array_implementation &&x)
void UniquifyIterators(iterator &i, iterator &j)
const_iterator begin() const
typename array_implementation::const_iterator const_iterator
size_type UpperBound() const
const_iterator At(size_type i) const
size_type LowerBound() const
void Assign(const array_implementation &x)
void Transfer(SortedArray &&x)
void Add(const SortedArray &x)
const_iterator Search(const T &v) const
iterator MutableAt(size_type i)
void SetAllocator(const allocator &a)
void Truncate(const_iterator i)
size_type Available() const
typename array_implementation::reverse_iterator reverse_iterator
const_iterator MaxItem() const
void Remove(const_iterator i, size_type n=1)
const_iterator Search(const T &v, BP p) const
reverse_iterator MutableReverseBegin()
void RemoveFirst(size_type n=1)
const_iterator FirstThat(F f) const
size_type CountIf(UP p) const
typename array_implementation::const_reverse_iterator const_reverse_iterator
const_iterator SearchLast(const T &v) const
void Assign(const T &v, size_type n=1)
bool IsAliasOf(const SortedArray &x) const
void Add(const Array< T, A > &x)
const_iterator Begin() const
void Transfer(SortedArray &x)
size_type Count(const T &v) const
const_iterator Add(const T &v, size_type n=1)
uint64 Hash(uint64 seed=0) const
void Transfer(array_implementation &x)
reverse_iterator MutableReverseEnd()
void Reserve(size_type n)
const_iterator LastThat(F f) const
const_iterator end() const
uint64 Hash64(uint64 seed=0) const
const_iterator MinItem() const
void Import(iterator i, iterator j)
const_iterator MaxItem(BP p) const
iterator MutableIterator(const_iterator i)
typename array_implementation::iterator iterator
bool Contains(const T &v) const
void Remove(const_iterator i, const_iterator j)
void RemoveLast(size_type n=1)
size_type Count(const T &v, BP p) const
const_iterator MinItem(BP p) const
size_type Capacity() const
SortedArray(std::initializer_list< T1 > l)
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
BI LastThat(BI i, BI j, UP p) noexcept(noexcept(p))
FI MinItem(FI i, FI j) noexcept
FI MaxItem(FI i, FI j) noexcept
void Apply(FI i, FI j, F f) noexcept(noexcept(f))
FI FirstThat(FI i, FI j, UP p) noexcept(noexcept(p))