52 #ifndef __PCL_ReferenceSortedArray_h
53 #define __PCL_ReferenceSortedArray_h
57 #include <pcl/Diagnostics.h>
99 template <
typename T,
class A = StandardAllocator>
167 PCL_PRECONDITION( p !=
nullptr )
215 return m_array.IsUnique();
226 return m_array.IsAliasOf( x.m_array );
239 m_array.EnsureUnique();
248 return m_array.Size();
256 return m_array.Length();
266 return m_array.Capacity();
278 return m_array.Available();
298 return m_array.IsValid();
306 return m_array.IsEmpty();
315 return m_array.LowerBound();
324 return m_array.UpperBound();
332 return m_array.Allocator();
340 m_array.SetAllocator( a );
349 return m_array.At( i );
358 return m_array.At( i );
373 return m_array.MutableIterator( i );
399 return m_array.ConstBegin();
407 return m_array.Begin();
415 return m_array.ConstEnd();
423 return m_array.End();
434 return m_array.ConstReverseBegin();
445 return m_array.ReverseBegin();
457 return m_array.ConstReverseEnd();
469 return m_array.ReverseEnd();
476 const T& First()
const
478 return m_array.First();
487 return m_array.First();
494 const T& Last()
const
496 return m_array.Last();
505 return m_array.Last();
519 m_array.UniquifyIterator( i );
534 m_array.UniquifyIterators( i, j );
537 #ifndef __PCL_NO_STL_COMPATIBLE_ITERATORS
579 m_array.Assign( x.m_array );
602 m_array.Transfer( x.m_array );
616 m_array.Transfer( std::move( x.m_array ) );
668 m_array.Transfer( x );
683 m_array.Transfer( std::move( x ) );
695 m_array.Assign( p, n );
712 m_array.Assign( i, j );
730 m_array.CloneAssign( x );
738 m_array.CloneAssign( x.m_array );
745 m_array.CloneAssign( x );
752 m_array.CloneAssign( x );
764 m_array.Import( i, j );
781 return m_array.Release();
789 for (
iterator i = Begin(); i < End() && p < q; ++i )
791 i = m_array.Insert( i, (T*)p++ );
793 m_array.Append( p, q );
851 m_array.Remove( i, n );
863 m_array.Remove( i, j );
881 m_array.Truncate( i );
923 m_array.Remove( v, p );
934 m_array.RemovePointer( p );
969 m_array.Destroy( i, n );
992 m_array.Destroy( i, j );
1008 m_array.Destroy( v );
1025 m_array.Destroy( v, p );
1049 m_array.Reserve( n );
1127 return m_array.Count( p );
1137 return m_array.Count( v, p );
1147 return m_array.CountIf( p );
1169 return IsEmpty() ? End() : End()-1;
1191 return m_array.Search( p );
1213 return m_array.SearchLast( p );
1228 return Search( v ) != End();
1235 return m_array.Contains( p );
1243 return Search( v, p ) != End();
1268 return x1.m_array == x2.m_array;
1278 return x1.m_array == x2;
1288 return x1 == x2.m_array;
1298 return x1.m_array < x2.m_array;
1308 return x1.m_array < x2;
1318 return x1 < x2.m_array;
1337 template <
class S,
typename SP>
1338 S& ToSeparated( S& s, SP separator )
const
1340 return m_array.ToSeparated( s, separator );
1365 template <
class S,
typename SP,
class AF>
1366 S& ToSeparated( S& s, SP separator, AF append )
const
1368 return m_array.ToSeparated( s, separator, append );
1380 S& ToCommaSeparated( S& s )
const
1382 return m_array.ToCommaSeparated( s );
1394 S& ToSpaceSeparated( S& s )
const
1396 return m_array.ToSpaceSeparated( s );
1408 S& ToTabSeparated( S& s )
const
1410 return m_array.ToTabSeparated( s );
1422 S& ToNewLineSeparated( S& s )
const
1424 return m_array.ToNewLineSeparated( s );
1439 return m_array.Hash64( seed );
1454 return m_array.Hash32( seed );
1468 array_implementation m_array;
1480 template <
class T,
class A,
class V>
inline
1481 ReferenceSortedArray<T,A>&
operator <<( ReferenceSortedArray<T,A>& x,
const V* p )
1483 x.Add(
static_cast<const T*
>( p ) );
1494 template <
class T,
class A,
class V>
inline
1495 ReferenceSortedArray<T,A>&
operator <<( ReferenceSortedArray<T,A>&& x,
const V* p )
1497 x.Add(
static_cast<const T*
>( p ) );
1506 template <
class T,
class A>
inline
1507 ReferenceSortedArray<T,A>&
operator <<( ReferenceSortedArray<T,A>& x1,
const ReferenceSortedArray<T,A>& x2 )
1518 template <
class T,
class A>
inline
1519 ReferenceSortedArray<T,A>&
operator <<( ReferenceSortedArray<T,A>&& x1,
const ReferenceSortedArray<T,A>& x2 )
1530 template <
class T,
class A>
inline
1531 ReferenceSortedArray<T,A>&
operator <<( ReferenceSortedArray<T,A>& x1,
const ReferenceArray<T,A>& x2 )
1542 template <
class T,
class A>
inline
1543 ReferenceSortedArray<T,A>&
operator <<( ReferenceSortedArray<T,A>&& x1,
const ReferenceArray<T,A>& x2 )
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
Generic dynamic sorted array of pointers to objects.
Immutable ReferenceArray iterator.
Mutable ReferenceArray iterator.
Dynamic array of pointers to objects providing direct iteration and element access by reference.
typename array_implementation::iterator indirect_iterator
typename array_implementation::const_iterator const_indirect_iterator
typename array_implementation::allocator allocator
typename array_implementation::block_allocator block_allocator
Dynamic sorted array of pointers to objects providing direct iteration and element access by referenc...
const_iterator MinItem() const
size_type Available() const
ReferenceSortedArray(ReferenceSortedArray &&)=default
void Remove(const_iterator i, const_iterator j)
void RemovePointer(const T *p)
void Assign(const ReferenceSortedArray &x)
typename array_implementation::block_allocator block_allocator
iterator MutableIterator(const_iterator i)
const_iterator MaxItem(BP p) const
void Destroy(iterator i, iterator j)
ReferenceSortedArray()=default
friend void Swap(ReferenceSortedArray &x1, ReferenceSortedArray &x2)
void Truncate(const_iterator i)
reverse_iterator MutableReverseEnd()
const_iterator Search(const T &v) const
ReferenceSortedArray(FI i, FI j)
void Transfer(ReferenceSortedArray &&x)
void Add(const ReferenceSortedArray &x)
size_type UpperBound() const
void Assign(const T *p, size_type n=1)
typename array_implementation::const_reverse_iterator const_reverse_iterator
typename array_implementation::const_indirect_iterator const_indirect_iterator
void Destroy(const T &v, BP p)
void Transfer(array_implementation &x)
const_iterator End() const
void UniquifyIterators(iterator &i, iterator &j)
ReferenceSortedArray(const ReferenceSortedArray &)=default
bool IsAliasOf(const ReferenceSortedArray &x) const
void Assign(const array_implementation &x)
typename array_implementation::const_iterator const_iterator
bool Contains(const T &v) const
void Destroy(iterator i, size_type n=1)
void CloneAssign(ReferenceSortedArray &x)
void Transfer(ReferenceSortedArray &x)
const_iterator SearchLast(const T *p) const
bool Contains(const T *p) const
const_iterator Add(const T *p, size_type n=1)
void UniquifyIterator(iterator &i)
size_type Count(const T *p) const
void Shrink(size_type n=1)
uint32 Hash32(uint32 seed=0) const
void CloneAssign(const C &x)
bool Contains(const T &v, BP p) const
typename array_implementation::iterator iterator
uint64 Hash(uint64 seed=0) const
ReferenceSortedArray(size_type n, const T *p)
const_iterator SearchLast(const T &v) const
const_iterator Search(const T &v, BP p) const
size_type Count(const T &v, BP p) const
typename array_implementation::allocator allocator
const_iterator Search(const T *p) const
const_reverse_iterator ReverseEnd() const
typename array_implementation::indirect_iterator indirect_iterator
const_iterator SearchLast(const T &v, BP p) const
const_iterator end() const
uint64 Hash64(uint64 seed=0) const
const allocator & Allocator() const
void Remove(const_iterator i, size_type n=1)
const_reverse_iterator ReverseBegin() const
void Remove(const T &v, BP p)
void Import(iterator i, iterator j)
const_iterator MinItem(BP p) const
const_iterator begin() const
void CloneAssign(IndirectSortedArray< T, A > &x)
const_iterator MaxItem() const
typename array_implementation::reverse_iterator reverse_iterator
void Reserve(size_type n)
size_type CountIf(UP p) const
void Transfer(array_implementation &&x)
const_iterator Begin() const
iterator MutableAt(size_type i)
reverse_iterator MutableReverseBegin()
void SetAllocator(const allocator &a)
const_iterator At(size_type i) const
void Add(const array_implementation &x)
const_iterator LastThat(F f) const
size_type Count(const T &v) const
size_type Capacity() const
size_type LowerBound() const
void CloneAssign(SortedArray< T, A > &x)
indirect_iterator Release()
const_iterator FirstThat(F f) const
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 LinearSearch(FI i, FI j, const T &v) noexcept
FI BinarySearchLast(FI i, FI j, const T &v) noexcept
BI LinearSearchLast(BI i, BI 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))