52 #ifndef __PCL_ReferenceArray_h
53 #define __PCL_ReferenceArray_h
57 #include <pcl/Diagnostics.h>
94 template <
typename T,
class A = StandardAllocator>
183 T* operator ->()
const
377 const T* Pointer()
const
386 operator const T*()
const
404 const T* operator ->()
const
596 PCL_PRECONDITION( p !=
nullptr )
611 for ( ; i != j; ++i )
613 m_array.Append( *i );
643 return m_array.IsUnique();
654 return m_array.IsAliasOf( x.m_array );
667 m_array.EnsureUnique();
676 return m_array.Size();
684 return m_array.Length();
694 return m_array.Capacity();
706 return m_array.Available();
726 return m_array.IsValid();
734 return m_array.IsEmpty();
743 return m_array.LowerBound();
752 return m_array.UpperBound();
760 return m_array.Allocator();
768 m_array.SetAllocator( a );
801 return iterator( m_array.MutableIterator( i.it ) );
827 return **m_array.Begin();
836 return **m_array.Begin();
917 PCL_PRECONDITION( !IsEmpty() )
930 PCL_PRECONDITION( !IsEmpty() )
931 return iterator( m_array.Begin()-1 );
943 PCL_PRECONDITION( !IsEmpty() )
956 PCL_PRECONDITION( !IsEmpty() )
966 return **m_array.Begin();
973 const T& First()
const
975 return **m_array.Begin();
984 return **m_array.ReverseBegin();
991 const T& Last()
const
993 return **m_array.ReverseBegin();
1007 m_array.UniquifyIterator( i.it );
1022 m_array.UniquifyIterators( i.it, j.it );
1025 #ifndef __PCL_NO_STL_COMPATIBLE_ITERATORS
1082 m_array.Assign( x.m_array );
1105 m_array.Transfer( x.m_array );
1119 m_array.Transfer( std::move( x.m_array ) );
1131 m_array.Assign( p, n );
1149 for ( ; i != j; ++i )
1150 if ( *i !=
nullptr )
1151 m_array.Append( *i );
1167 PCL_ASSERT_CONTAINER( C, T );
1168 CloneObjects( x, (C*)
nullptr );
1178 m_array.Import( i.it, j.it );
1194 return m_array.Release();
1210 return iterator( m_array.Insert( i.it, x.m_array ) );
1226 return (p !=
nullptr) ?
iterator( m_array.Insert( i.it, p, n ) ) :
1248 for ( ; p != q; ++p )
1249 if ( *p !=
nullptr )
1250 it = m_array.Insert( it, *p );
1260 m_array.Append( x.m_array );
1272 m_array.Append( p, n );
1287 for ( ; p != q; ++p )
1288 if ( *p !=
nullptr )
1289 m_array.Append( *p );
1298 m_array.Prepend( x.m_array );
1310 m_array.Prepend( p, n );
1325 for ( ; p != q; ++p )
1326 if ( *p !=
nullptr )
1327 m_array.Prepend( *p );
1364 m_array.Remove( i.it, n );
1376 m_array.Remove( i.it, j.it );
1393 m_array.RemoveFirst( n );
1410 m_array.RemoveLast( n );
1428 m_array.Truncate( i.it );
1437 m_array.Shrink( n );
1449 m_array.Remove( v );
1462 m_array.Remove( v, p );
1473 m_array.Remove( p );
1508 m_array.Destroy( i.it, n );
1531 m_array.Destroy( i.it, j.it );
1546 m_array.Destroy( v );
1563 m_array.Destroy( v, p );
1593 return iterator( m_array.Replace( i.it, j.it, x.m_array ) );
1606 return iterator( m_array.Replace( i.it, j.it, p, (p !=
nullptr) ? n :
size_type( 0 ) ) );
1630 for ( ; p != q; ++p )
1631 if ( *p !=
nullptr )
1633 return iterator( m_array.Replace( i.it, j.it, m ) );
1645 m_array.Reserve( n );
1670 pcl::Fill( Begin(), End(), v );
1754 return m_array.Count( p );
1848 m_array.Rotate( n );
1855 m_array.ShiftLeft( p, n );
1862 m_array.ShiftRight( p, n );
1890 return iterator( m_array.Search( p ) );
1934 return iterator( m_array.SearchLast( p ) );
1971 template <
class FI,
class BP>
1979 template <
class FI,
class BP>
2003 template <
class C,
class BP>
2011 template <
class C,
class BP>
2035 template <
class BI,
class BP>
2043 template <
class BI,
class BP>
2067 template <
class C,
class BP>
2075 template <
class C,
class BP>
2085 return Search( v ) != End();
2092 return m_array.Contains( p );
2100 return Search( v, p ) != End();
2108 return SearchSubset( i, j ) != End();
2113 template <
class FI,
class BP>
2116 return SearchSubset( i, j, p ) != End();
2124 return m_array.ContainsSubset( c );
2129 template <
class C,
class BP>
2132 return SearchSubset( c ) != End();
2140 [](
const T* a,
const T* b ){ return *a < *b; } );
2149 [p](
const T* a,
const T* b ){ return p( *a, *b ); } );
2176 template <
class S,
typename SP>
2177 S& ToSeparated( S& s, SP separator )
const
2182 s.Append( S( *i ) );
2186 s.Append( separator );
2187 s.Append( S( *i ) );
2189 while ( ++i < End() );
2216 template <
class S,
typename SP,
class AF>
2217 S& ToSeparated( S& s, SP separator, AF append )
const
2222 append( s, S( *i ) );
2229 append( s, S( *i ) );
2231 while ( ++i < End() );
2246 S& ToCommaSeparated( S& s )
const
2248 return ToSeparated( s,
',' );
2260 S& ToSpaceSeparated( S& s )
const
2262 return ToSeparated( s,
' ' );
2274 S& ToTabSeparated( S& s )
const
2276 return ToSeparated( s,
'\t' );
2288 S& ToNewLineSeparated( S& s )
const
2290 return ToSeparated( s,
'\n' );
2305 return m_array.Hash64( seed );
2320 return m_array.Hash32( seed );
2334 array_implementation m_array;
2339 m_array.CloneAssign( x );
2343 void CloneObjects(
const C& x, IndirectContainer<T>* )
2346 m_array.Reserve( x.Length() );
2348 for (
typename C::const_iterator p = x.Begin(); p != x.End(); ++p )
2349 if ( *p !=
nullptr )
2351 T* o = a.Allocate( 1 );
2353 m_array.Append( o );
2366 template <
class T,
class A>
inline
2378 template <
class T,
class A>
inline
2391 template <
class T,
class A,
class V>
inline
2392 ReferenceArray<T,A>&
operator <<( ReferenceArray<T,A>& x,
const V* p )
2394 x.Append(
static_cast<const T*
>( p ) );
2405 template <
class T,
class A,
class V>
inline
2406 ReferenceArray<T,A>&
operator <<( ReferenceArray<T,A>&& x,
const V* p )
2408 x.Append(
static_cast<const T*
>( p ) );
2417 template <
class T,
class A>
inline
2418 ReferenceArray<T,A>&
operator <<( ReferenceArray<T,A>& x1,
const ReferenceArray<T,A>& x2 )
2429 template <
class T,
class A>
inline
2430 ReferenceArray<T,A>&
operator <<( ReferenceArray<T,A>&& x1,
const ReferenceArray<T,A>& x2 )
Provides memory allocation for PCL containers.
Root base class of all PCL containers of objects.
Generic dynamic array of pointers to objects.
T *const * const_iterator
void Append(const IndirectArray &x)
Random access iterator class.
Immutable ReferenceArray iterator.
const_iterator(const const_iterator &)=default
const_iterator(const iterator &i)
const_iterator(std::nullptr_t)
Immutable ReferenceArray reverse iterator.
Mutable ReferenceArray iterator.
iterator(const iterator &)=default
Mutable ReferenceArray reverse iterator.
Dynamic array of pointers to objects providing direct iteration and element access by reference.
iterator SearchLast(const T *p)
void CloneAssign(const C &x)
iterator Search(const T &v, BP p)
iterator Insert(const_iterator i, FI p, FI q)
const_iterator SearchSubset(const C &c) const
iterator ContainsSubset(FI i, FI j, BP p) const
iterator Insert(const_iterator i, const T *p, size_type n=1)
reverse_iterator ReverseBegin()
void RemovePointer(const T *p)
void Remove(const T &v, BP p)
void Assign(const ReferenceArray &x)
void ShiftLeft(const T *p, size_type n=1)
const_iterator MaxItem() const
const_reverse_iterator ConstReverseBegin() const
ReferenceArray(FI i, FI j)
const_iterator ConstBegin() const
iterator Replace(const_iterator i, const_iterator j, const T *p, size_type n=1)
const_iterator SearchLastSubset(const C &c) const
iterator ContainsSubset(FI i, FI j) const
const_reverse_iterator ReverseEnd() const
const_iterator SearchSubset(FI i, FI j) const
void Transfer(ReferenceArray &&x)
const_reverse_iterator ConstReverseEnd() const
size_type Count(const T *p) const
void Destroy(iterator i, iterator j)
size_type Capacity() const
iterator MutableIterator(const_iterator i)
void Append(const T *p, size_type n=1)
void Destroy(iterator i, size_type n=1)
void Append(const ReferenceArray &x)
void Assign(const T *p, size_type n=1)
iterator SearchSubset(const C &c, BP p)
const_iterator MinItem(BP p) const
const_iterator ConstEnd() const
typename array_implementation::iterator indirect_iterator
iterator Search(const T *p)
const_iterator Search(const T &v) const
const_iterator SearchLastSubset(const C &c, BP p) const
void UniquifyIterators(iterator &i, iterator &j)
void Prepend(const T *p, size_type n=1)
const_iterator MaxItem(BP p) const
uint32 Hash32(uint32 seed=0) const
size_type Count(const T &v) const
friend void Swap(ReferenceArray &x1, ReferenceArray &x2)
size_type CountIf(UP p) const
const_iterator Search(const T &v, BP p) const
void Destroy(const T &v, BP p)
bool Contains(const T *p) const
const_reverse_iterator ReverseBegin() const
const_iterator FirstThat(F f) const
const allocator & Allocator() const
iterator SearchLastSubset(BI i, BI j, BP p)
iterator SearchSubset(FI i, FI j, BP p)
const_iterator begin() const
size_type Available() const
reverse_iterator ReverseEnd()
iterator SearchLastSubset(BI i, BI j)
size_type Count(const T &v, BP p) const
iterator SearchLastSubset(const C &c, BP p)
const_iterator SearchLast(const T &v, BP p) const
iterator SearchLast(const T &v, BP p)
void RemoveFirst(size_type n=1)
void Reserve(size_type n)
bool Contains(const T &v) const
const_iterator SearchLastSubset(BI i, BI j, BP p) const
uint64 Hash64(uint64 seed=0) const
void Remove(const_iterator i, const_iterator j)
const_iterator Begin() const
void ShiftRight(const T *p, size_type n=1)
const_iterator Search(const T *p) const
const_iterator MinItem() const
iterator ContainsSubset(const C &c, BP p) const
const_iterator SearchLastSubset(BI i, BI j) const
const_iterator End() const
bool Contains(const T &v, BP p) const
indirect_iterator Release()
void Add(const ReferenceArray &x)
const_iterator LastThat(F f) const
void Remove(const_iterator i, size_type n=1)
typename array_implementation::const_iterator const_indirect_iterator
void Add(const T *p, size_type n=1)
typename array_implementation::allocator allocator
const_iterator SearchLast(const T *p) const
iterator Replace(const_iterator i, const_iterator j, const ReferenceArray &x)
const_iterator SearchSubset(const C &c, BP p) const
ReferenceArray(size_type n, const T *p)
void UniquifyIterator(iterator &i)
ReferenceArray(ReferenceArray &&)=default
bool IsAliasOf(const ReferenceArray &x) const
const_iterator SearchLast(const T &v) const
size_type LowerBound() const
void SetAllocator(const allocator &a)
const_iterator SearchSubset(FI i, FI j, BP p) const
void Prepend(const ReferenceArray &x)
iterator Insert(const_iterator i, const ReferenceArray &x)
void RemoveLast(size_type n=1)
void Shrink(size_type n=1)
const_iterator At(size_type i) const
uint64 Hash(uint64 seed=0) const
size_type UpperBound() const
void Transfer(ReferenceArray &x)
iterator Replace(const_iterator i, const_iterator j, FI p, FI q)
void Rotate(distance_type n)
iterator Search(const T &v)
typename array_implementation::block_allocator block_allocator
iterator SearchSubset(const C &c)
iterator ContainsSubset(const C &c) const
const_iterator end() const
void Truncate(const_iterator i)
iterator SearchLastSubset(const C &c)
void Import(iterator i, iterator j)
iterator SearchSubset(FI i, FI j)
ReferenceArray(const ReferenceArray &)=default
iterator SearchLast(const T &v)
Reverse random access iterator.
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
Complex< T1 > operator*(const Complex< T1 > &c1, const Complex< T2 > &c2) 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 Construct(T *p, A &a)
void Swap(GenericPoint< T > &p1, GenericPoint< T > &p2) noexcept
unsigned long long uint64
FI LinearSearch(FI i, FI j, const T &v) noexcept
BI1 SearchLast(BI1 i1, BI1 j1, FI2 i2, FI2 j2) noexcept
BI LinearSearchLast(BI i, BI j, const T &v) noexcept
FI1 Search(FI1 i1, FI1 j1, FI2 i2, FI2 j2) noexcept
void QuickSort(RI i, RI j)
size_type CountIf(FI i, FI j, UP p) noexcept(noexcept(p))
BI LastThat(BI i, BI j, UP p) noexcept(noexcept(p))
size_type Count(FI i, FI j, const T &v) noexcept
FI MinItem(FI i, FI j) noexcept
bool Equal(FI1 i1, FI2 i2, FI2 j2) noexcept
int Compare(FI1 i1, FI1 j1, FI2 i2, FI2 j2) 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))
Generic container iterator.
T item_type
Represents the item type.