52 #ifndef __PCL_ReferenceSortedArray_h
53 #define __PCL_ReferenceSortedArray_h
57 #include <pcl/Diagnostics.h>
99 template <
typename T,
class A = StandardAllocator>
155 PCL_PRECONDITION( p !=
nullptr )
203 return m_array.IsUnique();
214 return m_array.IsAliasOf( x.m_array );
227 m_array.EnsureUnique();
236 return m_array.Size();
244 return m_array.Length();
254 return m_array.Capacity();
266 return m_array.Available();
286 return m_array.IsValid();
294 return m_array.IsEmpty();
303 return m_array.LowerBound();
312 return m_array.UpperBound();
320 return m_array.Allocator();
328 m_array.SetAllocator( a );
337 return m_array.At( i );
346 return m_array.At( i );
361 return m_array.MutableIterator( i );
387 return m_array.ConstBegin();
395 return m_array.Begin();
403 return m_array.ConstEnd();
411 return m_array.End();
422 return m_array.ConstReverseBegin();
433 return m_array.ReverseBegin();
445 return m_array.ConstReverseEnd();
457 return m_array.ReverseEnd();
464 const T& First()
const
466 return m_array.First();
475 return m_array.First();
482 const T& Last()
const
484 return m_array.Last();
493 return m_array.Last();
507 m_array.UniquifyIterator( i );
522 m_array.UniquifyIterators( i, j );
525 #ifndef __PCL_NO_STL_COMPATIBLE_ITERATORS
567 m_array.Assign( x.m_array );
590 m_array.Transfer( x.m_array );
604 m_array.Transfer( std::move( x.m_array ) );
656 m_array.Transfer( x );
671 m_array.Transfer( std::move( x ) );
683 m_array.Assign( p, n );
700 m_array.Assign( i, j );
718 m_array.CloneAssign( x );
726 m_array.CloneAssign( x.m_array );
733 m_array.CloneAssign( x );
740 m_array.CloneAssign( x );
752 m_array.Import( i, j );
769 return m_array.Release();
777 for (
iterator i = Begin(); i < End() && p < q; ++i )
779 i = m_array.Insert( i, (T*)p++ );
781 m_array.Append( p, q );
839 m_array.Remove( i, n );
851 m_array.Remove( i, j );
869 m_array.Truncate( i );
911 m_array.Remove( v, p );
922 m_array.RemovePointer( p );
957 m_array.Destroy( i, n );
980 m_array.Destroy( i, j );
996 m_array.Destroy( v );
1013 m_array.Destroy( v, p );
1037 m_array.Reserve( n );
1115 return m_array.Count( p );
1125 return m_array.Count( v, p );
1135 return m_array.CountIf( p );
1157 return IsEmpty() ? End() : End()-1;
1179 return m_array.Search( p );
1201 return m_array.SearchLast( p );
1216 return Search( v ) != End();
1223 return m_array.Contains( p );
1231 return Search( v, p ) != End();
1256 return x1.m_array == x2.m_array;
1266 return x1.m_array == x2;
1276 return x1 == x2.m_array;
1286 return x1.m_array < x2.m_array;
1296 return x1.m_array < x2;
1306 return x1 < x2.m_array;
1325 template <
class S,
typename SP>
1326 S& ToSeparated( S& s, SP separator )
const
1328 return m_array.ToSeparated( s, separator );
1353 template <
class S,
typename SP,
class AF>
1354 S& ToSeparated( S& s, SP separator, AF append )
const
1356 return m_array.ToSeparated( s, separator, append );
1368 S& ToCommaSeparated( S& s )
const
1370 return m_array.ToCommaSeparated( s );
1382 S& ToSpaceSeparated( S& s )
const
1384 return m_array.ToSpaceSeparated( s );
1396 S& ToTabSeparated( S& s )
const
1398 return m_array.ToTabSeparated( s );
1410 S& ToNewLineSeparated( S& s )
const
1412 return m_array.ToNewLineSeparated( s );
1427 return m_array.Hash64( seed );
1442 return m_array.Hash32( seed );
1456 array_implementation m_array;
1468 template <
class T,
class A,
class V>
inline
1469 ReferenceSortedArray<T,A>&
operator <<( ReferenceSortedArray<T,A>& x,
const V* p )
1471 x.Add(
static_cast<const T*
>( p ) );
1482 template <
class T,
class A,
class V>
inline
1483 ReferenceSortedArray<T,A>&
operator <<( ReferenceSortedArray<T,A>&& x,
const V* p )
1485 x.Add(
static_cast<const T*
>( p ) );
1494 template <
class T,
class A>
inline
1495 ReferenceSortedArray<T,A>&
operator <<( ReferenceSortedArray<T,A>& x1,
const ReferenceSortedArray<T,A>& x2 )
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 ReferenceArray<T,A>& x2 )
1530 template <
class T,
class A>
inline
1531 ReferenceSortedArray<T,A>&
operator <<( ReferenceSortedArray<T,A>&& x1,
const ReferenceArray<T,A>& x2 )
Root base class of all PCL containers of objects.
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))