PCL
Utility Algorithms

Macros

#define ItemsInArray(a)   (sizeof( a )/sizeof( *a ))
 

Functions

template<class FI , class F >
void pcl::Apply (FI i, FI j, F f)
 
template<class FI , class F , typename T1 >
void pcl::Apply (FI i, FI j, F f, T1 x)
 
template<class FI , class F , class UP >
void pcl::ApplyIf (FI i, FI j, F f, UP p)
 
template<class FI , class F , class UP , typename T1 >
void pcl::ApplyIf (FI i, FI j, F f, UP p, T1 x)
 
template<class FI1 , class FI2 >
int pcl::Compare (FI1 i1, FI1 j1, FI2 i2, FI2 j2)
 
template<class FI1 , class FI2 , class BP >
int pcl::Compare (FI1 i1, FI1 j1, FI2 i2, FI2 j2, BP p)
 
template<class FI , typename T >
size_type pcl::Count (FI i, FI j, const T &v)
 
template<class FI , typename T , class BP >
size_type pcl::Count (FI i, FI j, const T &v, BP p)
 
template<class FI , class UP >
size_type pcl::CountIf (FI i, FI j, UP p)
 
template<class FI1 , class FI2 >
bool pcl::Equal (FI1 i1, FI2 i2, FI2 j2)
 
template<class FI1 , class FI2 , class BP >
bool pcl::Equal (FI1 i1, FI2 i2, FI2 j2, BP p)
 
template<class FI >
void pcl::FindExtremeItems (FI &kmin, FI &kmax, FI i, FI j)
 
template<class FI , class BP >
void pcl::FindExtremeItems (FI &kmin, FI &kmax, FI i, FI j, BP p)
 
template<class FI1 , class FI2 >
Association< FI1, FI2 > pcl::FindNotEqual (FI1 i1, FI2 i2, FI2 j2)
 
template<class FI1 , class FI2 , class BP >
Association< FI1, FI2 > pcl::FindNotEqual (FI1 i1, FI2 i2, FI2 j2, BP p)
 
template<class FI , class UP >
FI pcl::FirstThat (FI i, FI j, UP p)
 
template<class FI , class UP , typename T1 >
FI pcl::FirstThat (FI i, FI j, UP p, T1 x)
 
template<class BI , class UP >
BI pcl::LastThat (BI i, BI j, UP p)
 
template<class BI , class UP , typename T1 >
BI pcl::LastThat (BI i, BI j, UP p, T1 x)
 
template<typename T >
constexpr const T & pcl::Max (const T &a, const T &b)
 
template<typename T , class BP >
const T & pcl::Max (const T &a, const T &b, BP p)
 
template<class FI >
FI pcl::MaxItem (FI i, FI j)
 
template<class FI , class BP >
FI pcl::MaxItem (FI i, FI j, BP p)
 
template<typename T >
constexpr const T & pcl::Median (const T &a, const T &b, const T &c)
 
template<typename T , class BP >
const T & pcl::Median (const T &a, const T &b, const T &c, BP p)
 
template<typename T >
constexpr const T & pcl::Min (const T &a, const T &b)
 
template<typename T , class BP >
const T & pcl::Min (const T &a, const T &b, BP p)
 
template<class FI >
FI pcl::MinItem (FI i, FI j)
 
template<class FI , class BP >
FI pcl::MinItem (FI i, FI j, BP p)
 
template<typename T >
constexpr const T & pcl::Range (const T &x, const T &a, const T &b)
 
template<typename T , class BP >
const T & pcl::Range (const T &x, const T &a, const T &b, BP p)
 
template<typename T >
void pcl::Swap (T &a, T &b) noexcept(std::is_nothrow_copy_constructible< T >::value &&std::is_nothrow_copy_assignable< T >::value &&std::is_nothrow_move_assignable< T >::value)
 

Detailed Description

Template formal parameters:

FI Forward iterator
BI Bidirectional iterator
RI Random access iterator
UP Unary predicate
BP Binary predicate
T Item type
F Function

Macro Definition Documentation

◆ ItemsInArray

#define ItemsInArray (   a)    (sizeof( a )/sizeof( *a ))

Returns the number of elements in the specified C array a.

Definition at line 223 of file Utility.h.

Function Documentation

◆ Apply() [1/2]

◆ Apply() [2/2]

template<class FI , class F , typename T1 >
void pcl::Apply ( FI  i,
FI  j,
f,
T1  x 
)
inline

Applies a binary function f to the range [i,j) with the specified right-hand constant argument x. For each iterator t in the range [i,j) this function performs the function call f(*t,x).

Definition at line 265 of file Utility.h.

◆ ApplyIf() [1/2]

template<class FI , class F , class UP >
void pcl::ApplyIf ( FI  i,
FI  j,
f,
UP  p 
)
inline

Applies a unary function f to those elements in the range [i,j) that satisfy a condition given by a unary predicate p. For each iterator t in the range [i,j) this function performs the function call f(*t) if and only if p(*t) is true.

Definition at line 282 of file Utility.h.

◆ ApplyIf() [2/2]

template<class FI , class F , class UP , typename T1 >
void pcl::ApplyIf ( FI  i,
FI  j,
f,
UP  p,
T1  x 
)
inline

Applies a unary function f to those elements in the range [i,j) that satisfy a condition given by a unary predicate p, with right-hand constant argument x. For each iterator t in the range [i,j) this function performs the function call f(*t,x) if and only if p(*t) is true.

Definition at line 300 of file Utility.h.

◆ Compare() [1/2]

template<class FI1 , class FI2 >
int pcl::Compare ( FI1  i1,
FI1  j1,
FI2  i2,
FI2  j2 
)
inline

Performs a comparison of the objects in the ranges [i1,j1) and [i2,j2). Returns the result of the comparison encoded as an integer:

Returns 0 if:

  • (1) Distance(i1,j1) == Distance(i2,j2).
  • (2) For each pair {u,v} of iterators such that u in [i1,j1) and v in [i2,j2) and Distance(i1,u) == Distance(i2,v), *u == *v.

Returns -1 if:

  • (3) A pair {u,v} of iterators exists such that u in [i1,j1) and v in [i2,j2) and Distance(i1,u) == Distance(i2,v) and *u < *v.
  • (4) Condition (2) is true and Distance(i1,j1) < Distance(i2,j2).

Returns +1 if:

  • (5) A pair {u,v} of iterators exists such that u in [i1,j1) and v in [i2,j2) and Distance(i1,u) == Distance(i2,v) and *v < *u.
  • (6) Condition (2) is true and Distance(i1,j1) > Distance(i2,j2).

Definition at line 639 of file Utility.h.

Referenced by pcl::GenericString< char, IsoCharTraits, StandardAllocator >::Compare(), pcl::GenericString< char, IsoCharTraits, StandardAllocator >::CompareIC(), pcl::GenericMatrix< coefficient >::operator<(), pcl::Variant::operator<(), pcl::GenericVector< sample *>::operator<(), pcl::operator<(), and pcl::Variant::operator==().

◆ Compare() [2/2]

template<class FI1 , class FI2 , class BP >
int pcl::Compare ( FI1  i1,
FI1  j1,
FI2  i2,
FI2  j2,
BP  p 
)
inline

Performs a comparison of the objects in the ranges [i1,j1) and [i2,j2) as specified by a binary predicate p. Returns the result of the comparison encoded as an integer:

Returns 0 if:

  • (1) Distance(i1,j1) == Distance(i2,j2).
  • (2) For each pair {u,v} of iterators such that u in [i1,j1) and v in [i2,j2) and Distance(i1,u) == Distance(i2,v), both p(*u,*v) and p(*v,*u) are false.

Returns -1 if:

  • (3) A pair {u,v} of iterators exists such that u in [i1,j1) and v in [i2,j2) and Distance(i1,u) == Distance(i2,v) and p(*u,*v) is true.
  • (4) Condition (2) is true and Distance(i1,j1) < Distance(i2,j2).

Returns +1 if:

  • (5) A pair {u,v} of iterators exists such that u in [i1,j1) and v in [i2,j2) and Distance(i1,u) == Distance(i2,v) and p(*v,*u) is true.
  • (6) Condition (2) is true and Distance(i1,j1) > Distance(i2,j2).

Definition at line 683 of file Utility.h.

◆ Count() [1/2]

template<class FI , typename T >
size_type pcl::Count ( FI  i,
FI  j,
const T &  v 
)
inline

Returns the total number of objects in the range [i,j) that are equal to the specified constant object v.

Definition at line 384 of file Utility.h.

Referenced by pcl::ReferenceArray< XMLNode >::Count(), pcl::Histogram::operator[](), and pcl::Histogram::PeakCount().

◆ Count() [2/2]

template<class FI , typename T , class BP >
size_type pcl::Count ( FI  i,
FI  j,
const T &  v,
BP  p 
)
inline

Returns the total number of objects in the range [i,j) that are equal to a constant object v, as specified by the binary predicate p. For each iterator t in the range [i,j), counts the number of objects for which p(*t,v) is true.

Definition at line 404 of file Utility.h.

◆ CountIf()

template<class FI , class UP >
size_type pcl::CountIf ( FI  i,
FI  j,
UP  p 
)
inline

Returns the total number of objects in the range [i,j) that satisfy a condition given by a unary predicate p. For each iterator t in the range [i,j), counts the number of objects for which p(*t) is true.

Definition at line 423 of file Utility.h.

Referenced by pcl::Array< GenericVector< T > >::CountIf(), pcl::IndirectArray< MetaObject >::CountIf(), and pcl::ReferenceArray< XMLNode >::CountIf().

◆ Equal() [1/2]

template<class FI1 , class FI2 >
bool pcl::Equal ( FI1  i1,
FI2  i2,
FI2  j2 
)
inline

Returns true iff the objects in the range [i1,j1) are equal to the corresponding objects in the range [i2,j2), with j1 = Advance(i1,Distance(i2,j2)).

Definition at line 592 of file Utility.h.

References pcl::FindNotEqual().

Referenced by pcl::GenericMatrix< coefficient >::operator==(), pcl::GenericVector< sample *>::operator==(), and pcl::operator==().

◆ Equal() [2/2]

template<class FI1 , class FI2 , class BP >
bool pcl::Equal ( FI1  i1,
FI2  i2,
FI2  j2,
BP  p 
)
inline

Returns true iff the objects in the range [i1,j1) satisfy the condition specified by the binary predicate p for the corresponding objects in the range [i2,j2), with j1 = Advance(i1,Distance(i2,j2)).

Definition at line 607 of file Utility.h.

References pcl::FindNotEqual().

◆ FindExtremeItems() [1/2]

template<class FI >
void pcl::FindExtremeItems ( FI &  kmin,
FI &  kmax,
FI  i,
FI  j 
)
inline

Finds two iterators n and m in the range [i,j) such that *n <= *u for any u != n in [i,j) and *m >= *v for any v != m in [i,j).

Definition at line 517 of file Utility.h.

◆ FindExtremeItems() [2/2]

template<class FI , class BP >
void pcl::FindExtremeItems ( FI &  kmin,
FI &  kmax,
FI  i,
FI  j,
BP  p 
)
inline

Finds two iterators n and m in the range [i,j) such that p(*u,*n) is false for any u != n in [i,j) and p(*m,*v) is false for any v != m in [i,j).

Definition at line 539 of file Utility.h.

◆ FindNotEqual() [1/2]

template<class FI1 , class FI2 >
Association<FI1, FI2> pcl::FindNotEqual ( FI1  i1,
FI2  i2,
FI2  j2 
)
inline

Returns a tuple {i,j} such that *i != *j, where i >= i1 and j is in the range [i2,j2), or a tuple {i>=i1,j2} if no such j exists.

Definition at line 561 of file Utility.h.

References pcl::Associate().

Referenced by pcl::Equal().

◆ FindNotEqual() [2/2]

template<class FI1 , class FI2 , class BP >
Association<FI1, FI2> pcl::FindNotEqual ( FI1  i1,
FI2  i2,
FI2  j2,
BP  p 
)
inline

Returns a tuple {i,j} such that p(*i,*j) is false, where i >= i1 and j is in the range [i2,j2), or a tuple {i>=i1,j2} if no such j exists.

Definition at line 576 of file Utility.h.

References pcl::Associate().

◆ FirstThat() [1/2]

template<class FI , class UP >
FI pcl::FirstThat ( FI  i,
FI  j,
UP  p 
)
inline

Returns the first iterator t in the range [i,j) such that the specified unary predicate p(*t) is true, or j if no such iterator exists.

Definition at line 316 of file Utility.h.

◆ FirstThat() [2/2]

template<class FI , class UP , typename T1 >
FI pcl::FirstThat ( FI  i,
FI  j,
UP  p,
T1  x 
)
inline

Returns the first iterator t in the range [i,j) such that the specified unary predicate p(*t,x) is true, or j if no such iterator exists.

Definition at line 333 of file Utility.h.

◆ LastThat() [1/2]

template<class BI , class UP >
BI pcl::LastThat ( BI  i,
BI  j,
UP  p 
)
inline

Returns the last iterator t in the range [i,j) such that the specified unary predicate p(*t) is true, or j if no such iterator exists.

Definition at line 350 of file Utility.h.

◆ LastThat() [2/2]

template<class BI , class UP , typename T1 >
BI pcl::LastThat ( BI  i,
BI  j,
UP  p,
T1  x 
)
inline

Returns the last iterator t in the range [i,j) such that the specified unary predicate p(*t,x) is true, or j if no such iterator exists.

Definition at line 367 of file Utility.h.

◆ Max() [1/2]

template<typename T >
constexpr const T& pcl::Max ( const T &  a,
const T &  b 
)
inline

Returns a reference to the largest of two objects a and b. Returns b if a < b. Returns a if b <= a.

Definition at line 119 of file Utility.h.

Referenced by pcl::PSFData::Bounds(), pcl::QuadTree< vector_type >::Build(), pcl::IndirectArray< MetaObject >::Delete(), pcl::GenericMatrix< coefficient >::GenericMatrix(), pcl::RGBColorSystem::HSISaturation(), pcl::RGBColorSystem::HSVSaturation(), pcl::RGBColorSystem::Hue(), pcl::RGBColorSystem::Intensity(), pcl::GenericRectangle< T >::Intersect(), pcl::GenericRectangle< T >::IntersectFast(), pcl::GenericRectangle< T >::LeftBottom(), pcl::AbstractImage::NumberOfThreadsForRows(), pcl::operator<(), pcl::AbstractImage::OptimalThreadRows(), pcl::Array< GenericVector< T > >::Remove(), pcl::AbstractImage::ResetChannelRange(), pcl::GenericRectangle< T >::RightBottom(), pcl::GenericRectangle< T >::RightTop(), pcl::BicubicFilterInterpolation< T >::SetFilter(), pcl::HistogramTransformation::SetHighRange(), pcl::InterlacedTransformation::SetInterlacingDistance(), pcl::RedundantMultiscaleTransform::SetLinearScalingSequence(), pcl::MultiscaleMedianTransform::SetMedianWaveletThreshold(), pcl::MultiscaleMedianTransform::SetMedianWaveletTransform(), pcl::RedundantMultiscaleTransform::SetNumberOfLayers(), pcl::BicubicFilterInterpolation< T >::SetRadii(), pcl::HistogramTransformation::SetRange(), pcl::ImageResolution::SetResolution(), pcl::RedundantMultiscaleTransform::SetScalingSequence(), pcl::AdaptiveLocalFilter::SetSigma(), pcl::AdaptiveLocalFilter::SetSize(), pcl::GenericRectangle< T >::Unite(), pcl::GenericRectangle< T >::UniteFast(), and pcl::RGBColorSystem::Value().

◆ Max() [2/2]

template<typename T , class BP >
const T& pcl::Max ( const T &  a,
const T &  b,
BP  p 
)
inline

Returns a reference to the largest of two objects a and b, as specified by the binary predicate p. Returns b if p(a,b) is true; returns a otherwise.

Definition at line 134 of file Utility.h.

◆ MaxItem() [1/2]

◆ MaxItem() [2/2]

template<class FI , class BP >
FI pcl::MaxItem ( FI  i,
FI  j,
BP  p 
)
inline

Returns an iterator m in the range [i,j) such that p(*m,*t) is false for any t != m in [i,j). Returns j if and only if i == j.

Definition at line 498 of file Utility.h.

◆ Median() [1/2]

template<typename T >
constexpr const T& pcl::Median ( const T &  a,
const T &  b,
const T &  c 
)
inline

Returns a reference to the median of three objects a, b and c:

  • a if (c <= a < b) || (b <= a < c)
  • b if (a < b < c) || (c <= b <= a)
  • c if (a < c < b) || (b < c <= a)

Definition at line 151 of file Utility.h.

◆ Median() [2/2]

template<typename T , class BP >
const T& pcl::Median ( const T &  a,
const T &  b,
const T &  c,
BP  p 
)
inline

Returns a reference to the median of three objects a, b and c, as specified by the binary predicate p:

  • a if p(a,b) && !p(b,c) && !p(a,c) || !p(a,b) && p(a,c)
  • b if p(a,b) && p(b,c) || !p(a,b) && !p(a,c) && !p(b,c)
  • c if p(a,b) && !p(b,c) && p(a,c) || !p(a,b) && !p(a,c) && p(b,c)

Definition at line 170 of file Utility.h.

◆ Min() [1/2]

template<typename T >
constexpr const T& pcl::Min ( const T &  a,
const T &  b 
)
inline

Returns a reference to the smaller of two objects a and b. Returns b if b < a. Returns a if a <= b.

Definition at line 90 of file Utility.h.

Referenced by pcl::GenericString< char, IsoCharTraits, StandardAllocator >::Assign(), pcl::String::Assign(), pcl::GenericString< char, IsoCharTraits, StandardAllocator >::c_copy(), pcl::GenericRectangle< T >::CenterBottom(), pcl::GenericRectangle< T >::CenterLeft(), pcl::GenericRectangle< T >::CenterRight(), pcl::GenericRectangle< T >::CenterTop(), pcl::IndirectArray< MetaObject >::Delete(), pcl::GenericString< char, IsoCharTraits, StandardAllocator >::Delete(), pcl::GenericString< char, IsoCharTraits, StandardAllocator >::Fill(), pcl::GenericString< char, IsoCharTraits, StandardAllocator >::FindLast(), pcl::GenericString< char, IsoCharTraits, StandardAllocator >::FindLastIC(), pcl::GenericString< char, IsoCharTraits, StandardAllocator >::GenericString(), pcl::RGBColorSystem::HSISaturation(), pcl::RGBColorSystem::HSVSaturation(), pcl::RGBColorSystem::Hue(), pcl::GenericString< char, IsoCharTraits, StandardAllocator >::Insert(), pcl::RGBColorSystem::Intensity(), pcl::GenericRectangle< T >::Intersect(), pcl::GenericRectangle< T >::IntersectFast(), pcl::IsoString::IsoString(), pcl::GenericString< char, IsoCharTraits, StandardAllocator >::Left(), pcl::GenericRectangle< T >::LeftBottom(), pcl::GenericRectangle< T >::LeftTop(), pcl::ZenithalEqualAreaProjection::Name(), pcl::operator<(), pcl::GenericString< char, IsoCharTraits, StandardAllocator >::Replace(), pcl::GenericString< char, IsoCharTraits, StandardAllocator >::Right(), pcl::GenericRectangle< T >::RightTop(), pcl::HistogramTransformation::SetLowRange(), pcl::HistogramTransformation::SetRange(), pcl::GenericString< char, IsoCharTraits, StandardAllocator >::Substring(), pcl::String::ToWCharArray(), pcl::UIResourceScalingIndex(), pcl::GenericRectangle< T >::Unite(), and pcl::GenericRectangle< T >::UniteFast().

◆ Min() [2/2]

template<typename T , class BP >
const T& pcl::Min ( const T &  a,
const T &  b,
BP  p 
)
inline

Returns a reference to the smallest of two objects a and b, as specified by the binary predicate p. Returns b if p(b,a) is true; returns a otherwise.

Definition at line 105 of file Utility.h.

◆ MinItem() [1/2]

template<class FI >
FI pcl::MinItem ( FI  i,
FI  j 
)
inline

◆ MinItem() [2/2]

template<class FI , class BP >
FI pcl::MinItem ( FI  i,
FI  j,
BP  p 
)
inline

Returns an iterator m in the range [i,j) such that p(*t,*m) is false for any t != m in [i,j). Returns j if and only if i == j.

Definition at line 460 of file Utility.h.

◆ Range() [1/2]

template<typename T >
constexpr const T& pcl::Range ( const T &  x,
const T &  a,
const T &  b 
)
inline

Returns a reference to the specified object x, if and only if it belongs to the range [a,b]. Returns a reference to the nearest range bounding object otherwise. Returns:

  • x if (a <= x <= b)
  • a if (x < a)
  • b if (b < x)

Definition at line 190 of file Utility.h.

Referenced by pcl::Histogram::Count(), pcl::EphemerisFile::Handle::EndTime(), pcl::GenericMatrix< coefficient >::GenericMatrix(), pcl::Histogram::GetData(), pcl::Array< GenericVector< T > >::Grow(), pcl::Histogram::HistogramLevel(), pcl::HistogramTransformation::HistogramTransformation(), pcl::Array< GenericVector< T > >::Insert(), pcl::Histogram::NormalizedLevel(), pcl::Histogram::PeakCount(), pcl::ReadoutOptions::RealCoordinatePrecision(), pcl::Array< GenericVector< T > >::Replace(), pcl::LanczosInterpolation< T >::SetClampingThreshold(), pcl::BicubicSplineInterpolation< T >::SetClampingThreshold(), pcl::Compression::SetCompressionLevel(), pcl::ReadoutOptions::SetCoordinateItems(), pcl::ReadoutOptions::SetCoordinatePrecision(), pcl::XMLDocument::SetIndentSize(), pcl::ReadoutOptions::SetIntegerRange(), pcl::Compression::SetItemSize(), pcl::FFTRotationAndScaling::SetLowFrequencyCutoff(), pcl::DrizzleData::SetPedestal(), pcl::SourceCodeError::SetPosition(), pcl::ReadoutOptions::SetPrecision(), pcl::ReadoutOptions::SetPreviewSize(), pcl::ReadoutOptions::SetPreviewZoomFactor(), pcl::ReadoutOptions::SetProbeSize(), pcl::SurfaceSimplifier::SetRejectFraction(), pcl::SelectionFilter::SetSelectionPoint(), pcl::Compression::SetSubblockSize(), pcl::AlphaTrimmedMeanFilter::SetTrimmingFactor(), pcl::EphemerisFile::Handle::StartTime(), pcl::DisplayFunction::TargetBackground(), pcl::UInt8PixelTraits::ToSampleConstrained(), pcl::UInt16PixelTraits::ToSampleConstrained(), pcl::UInt32PixelTraits::ToSampleConstrained(), pcl::UInt20PixelTraits::ToSampleConstrained(), pcl::UInt24PixelTraits::ToSampleConstrained(), and pcl::UIResourceScalingFactorForIndex().

◆ Range() [2/2]

template<typename T , class BP >
const T& pcl::Range ( const T &  x,
const T &  a,
const T &  b,
BP  p 
)
inline

Returns a reference to the specified object x, if and only if it belongs to the range [a,b], as specified by the binary predicate p. Returns a reference to the nearest range bounding object otherwise. Returns:

  • x if !p(x,a) && !p(b,x)
  • a if p(x,a)
  • b if p(b,x)

Definition at line 210 of file Utility.h.

◆ Swap()

template<typename T >
void pcl::Swap ( T &  a,
T &  b 
)
inlinenoexcept

Exchanges two objects a and b.

Definition at line 233 of file Utility.h.