Namespaces | Classes | Typedefs | Functions
lanelet::utils Namespace Reference

Namespaces

 detail
 

Classes

struct  IdLess
 Compares ids of primitives. Can be used for some sorted stl containers. More...
 

Typedefs

template<typename PrimitiveT >
using ConstLayerPrimitive = typename PrimitiveLayer< PrimitiveT >::ConstPrimitiveT
 

Functions

template<class T >
std::shared_ptr< const T > addConst (std::shared_ptr< T > t)
 
template<class T >
const T & addConst (T &t)
 
template<typename Container , typename Predicate >
bool anyOf (const Container &c, Predicate &&p)
 
template<typename ContainerT >
auto concatenate (ContainerT &&c)
 overload assuming that c is a container of containers. The return type will be the type of the inner container. More...
 
template<typename ContainerT , typename Func >
auto concatenate (ContainerT &&c, Func f)
 create one big vector from a vector and a function that returns a vector for each element in this vector More...
 
template<typename T >
auto concatenate (std::initializer_list< T > &&c)
 
template<typename T , typename Func >
auto concatenate (std::initializer_list< T > &&c, Func f)
 
template<typename ContainerT , typename Func >
auto concatenateRange (ContainerT &&c, Func f)
 Similar to concatenate but expects Func to return a pair of begin and end of the range to concatenated. More...
 
template<typename ContainerT , typename Func , typename AllocatorT >
auto concatenateRange (ContainerT &&c, Func f, const AllocatorT &alloc)
 Overload for an allocator (e.g. for Eigen::aligned_allocator) More...
 
template<typename T , typename Func >
auto concatenateRange (std::initializer_list< T > &&c, Func f)
 
template<typename T , typename Func , typename AllocatorT >
auto concatenateRange (std::initializer_list< T > &&c, Func f, const AllocatorT &alloc)
 
template<typename Container , typename Value >
bool contains (const Container &c, const Value &v)
 
LaneletMapConstUPtr createConstMap (const ConstLanelets &fromLanelets, const ConstAreas &fromAreas)
 
LaneletSubmapConstUPtr createConstSubmap (const ConstLanelets &fromLanelets, const ConstAreas &fromAreas)
 
LaneletMapUPtr createMap (const Areas &fromAreas)
 
LaneletMapUPtr createMap (const Lanelets &fromLanelets)
 
LaneletMapUPtr createMap (const Lanelets &fromLanelets, const Areas &fromAreas)
 
LaneletMapUPtr createMap (const LineStrings3d &fromLineStrings)
 
LaneletMapUPtr createMap (const Points3d &fromPoints)
 Efficiently create a LaneletMap from a vector of things. All elements must have a valid id! More...
 
LaneletMapUPtr createMap (const Polygons3d &fromPolygons)
 
LaneletSubmapUPtr createSubmap (const Areas &fromAreas)
 
LaneletSubmapUPtr createSubmap (const Lanelets &fromLanelets)
 
LaneletSubmapUPtr createSubmap (const Lanelets &fromLanelets, const Areas &fromAreas)
 
LaneletSubmapUPtr createSubmap (const LineStrings3d &fromLineStrings)
 
LaneletSubmapUPtr createSubmap (const Points3d &fromPoints)
 Efficiently create a LaneletSubmap from a vector of things. All elements must have a valid id! More...
 
LaneletSubmapUPtr createSubmap (const Polygons3d &fromPolygons)
 
template<typename ContainerT , typename ValueT >
auto find (ContainerT &&c, const ValueT &val)
 
template<typename ContainerT , typename Func >
auto findIf (ContainerT &&c, Func f)
 
template<typename PrimitiveT >
std::vector< ConstLayerPrimitive< PrimitiveT > > findUsages (const PrimitiveLayer< PrimitiveT > &layer, Id id)
 
template std::vector< ConstLayerPrimitive< Lanelet > > findUsages< Lanelet > (const PrimitiveLayer< Lanelet > &, Id)
 
template std::vector< ConstLayerPrimitive< LineString3d > > findUsages< LineString3d > (const PrimitiveLayer< LineString3d > &, Id)
 
template std::vector< ConstLayerPrimitive< Polygon3d > > findUsages< Polygon3d > (const PrimitiveLayer< Polygon3d > &, Id)
 
template std::vector< ConstLayerPrimitive< RegulatoryElementPtr > > findUsages< RegulatoryElementPtr > (const PrimitiveLayer< RegulatoryElementPtr > &, Id)
 
ConstAreas findUsagesInAreas (const LaneletMapLayers &map, const ConstPoint3d &p)
 
ConstLanelets findUsagesInLanelets (const LaneletMapLayers &map, const ConstPoint3d &p)
 
template<typename Container , typename Func >
void forEach (Container &&c, Func &&f)
 
ConstAreas getAllAreas (const ConstLaneletOrAreas &lars)
 
ConstLanelets getAllLanelets (const ConstLaneletOrAreas &lars)
 
Id getId ()
 returns a unique id by incrementing a counter each time this is called. More...
 
template<typename T , typename Variant >
std::vector< T > getVariant (const std::vector< Variant > &v)
 
template<typename PointT >
bool has (const CompoundLineStringImpl< PointT > &ls, Id id)
 returns true if element of a primitive has a matching Id More...
 
bool has (const ConstArea &ll, Id id)
 returns true if element of a regulatory element has a matching Id More...
 
bool has (const ConstLanelet &ll, Id id)
 returns true if element of a regulatory element has a matching Id More...
 
template<typename PointT >
bool has (const ConstLineStringImpl< PointT > &ls, Id id)
 returns true if element of a lanelet primitive has a matching Id More...
 
bool has (const LaneletSequence &ll, Id id)
 returns true if element of a primitive has a matching Id More...
 
bool has (const RegulatoryElement &regElem, Id id)
 returns true if element of a regulatory element has a matching Id More...
 
bool has (const RegulatoryElementConstPtr &ls, Id id)
 
template<typename PrimitiveT >
constexpr bool idLess (const PrimitiveT &p1, const PrimitiveT &p2)
 Compares ids of primitives. Can be used for some stl algorithms. More...
 
template<typename Container >
Container invert (const Container &cont)
 
bool nearZero (double d)
 Tests if a double is close to zero within a small margin. More...
 
template<typename T1 , typename T2 >
auto orderedPair (T1 &first, T2 &second)
 
void registerId (Id id)
 
template<class T >
T & removeConst (const T &t)
 
template<class T >
std::shared_ptr< T > removeConst (std::shared_ptr< const T > t)
 
constexpr bool strequal (char const *lhs, char const *rhs)
 compares two c-strings at compile time. Do not use this for run time. More...
 
template<typename WeakT >
auto strong (std::vector< WeakT > v)
 transforms a vector of weak_ptrs to a vector of shared_ptrs More...
 
template<typename Range , typename Func >
auto sum (Range &&r, Func f)
 Wrapper around std::accumulate for summing up the result of Func over a range. More...
 
template<typename Container , typename Func >
auto transform (Container &&c, Func f)
 
template<typename Iterator , typename Func >
auto transform (Iterator begin, Iterator end, const Func f)
 
template<typename T , typename Func >
auto transform (std::initializer_list< T > &&c, Func f)
 
template<typename OutT , typename InT >
auto transformSharedPtr (const std::vector< std::shared_ptr< InT >> &v)
 

Typedef Documentation

◆ ConstLayerPrimitive

template<typename PrimitiveT >
using lanelet::utils::ConstLayerPrimitive = typedef typename PrimitiveLayer<PrimitiveT>::ConstPrimitiveT

Definition at line 504 of file LaneletMap.h.

Function Documentation

◆ addConst() [1/2]

template<class T >
std::shared_ptr<const T> lanelet::utils::addConst ( std::shared_ptr< T >  t)

Definition at line 154 of file Utilities.h.

◆ addConst() [2/2]

template<class T >
const T& lanelet::utils::addConst ( T &  t)

Definition at line 149 of file Utilities.h.

◆ anyOf()

template<typename Container , typename Predicate >
bool lanelet::utils::anyOf ( const Container &  c,
Predicate &&  p 
)

Definition at line 216 of file Utilities.h.

◆ concatenate() [1/4]

template<typename ContainerT >
auto lanelet::utils::concatenate ( ContainerT &&  c)

overload assuming that c is a container of containers. The return type will be the type of the inner container.

For containers holding heavy objects consider moving the container into this.

Definition at line 260 of file Utilities.h.

◆ concatenate() [2/4]

template<typename ContainerT , typename Func >
auto lanelet::utils::concatenate ( ContainerT &&  c,
Func  f 
)

create one big vector from a vector and a function that returns a vector for each element in this vector

Definition at line 276 of file Utilities.h.

◆ concatenate() [3/4]

template<typename T >
auto lanelet::utils::concatenate ( std::initializer_list< T > &&  c)

Definition at line 266 of file Utilities.h.

◆ concatenate() [4/4]

template<typename T , typename Func >
auto lanelet::utils::concatenate ( std::initializer_list< T > &&  c,
Func  f 
)

Definition at line 282 of file Utilities.h.

◆ concatenateRange() [1/4]

template<typename ContainerT , typename Func >
auto lanelet::utils::concatenateRange ( ContainerT &&  c,
Func  f 
)

Similar to concatenate but expects Func to return a pair of begin and end of the range to concatenated.

Significantly more efficient than the above but requires that the range is already present in memory. A use case is a vector of vectors.

Definition at line 295 of file Utilities.h.

◆ concatenateRange() [2/4]

template<typename ContainerT , typename Func , typename AllocatorT >
auto lanelet::utils::concatenateRange ( ContainerT &&  c,
Func  f,
const AllocatorT &  alloc 
)

Overload for an allocator (e.g. for Eigen::aligned_allocator)

Definition at line 306 of file Utilities.h.

◆ concatenateRange() [3/4]

template<typename T , typename Func >
auto lanelet::utils::concatenateRange ( std::initializer_list< T > &&  c,
Func  f 
)

Definition at line 300 of file Utilities.h.

◆ concatenateRange() [4/4]

template<typename T , typename Func , typename AllocatorT >
auto lanelet::utils::concatenateRange ( std::initializer_list< T > &&  c,
Func  f,
const AllocatorT &  alloc 
)

Definition at line 311 of file Utilities.h.

◆ contains()

template<typename Container , typename Value >
bool lanelet::utils::contains ( const Container &  c,
const Value &  v 
)

Definition at line 221 of file Utilities.h.

◆ createConstMap()

LaneletMapConstUPtr lanelet::utils::createConstMap ( const ConstLanelets fromLanelets,
const ConstAreas fromAreas 
)

Definition at line 875 of file LaneletMap.cpp.

◆ createConstSubmap()

LaneletSubmapConstUPtr lanelet::utils::createConstSubmap ( const ConstLanelets fromLanelets,
const ConstAreas fromAreas 
)

Definition at line 924 of file LaneletMap.cpp.

◆ createMap() [1/6]

LaneletMapUPtr lanelet::utils::createMap ( const Areas fromAreas)

Definition at line 867 of file LaneletMap.cpp.

◆ createMap() [2/6]

LaneletMapUPtr lanelet::utils::createMap ( const Lanelets fromLanelets)

Definition at line 865 of file LaneletMap.cpp.

◆ createMap() [3/6]

LaneletMapUPtr lanelet::utils::createMap ( const Lanelets fromLanelets,
const Areas fromAreas 
)

Definition at line 824 of file LaneletMap.cpp.

◆ createMap() [4/6]

LaneletMapUPtr lanelet::utils::createMap ( const LineStrings3d fromLineStrings)

Definition at line 818 of file LaneletMap.cpp.

◆ createMap() [5/6]

LaneletMapUPtr lanelet::utils::createMap ( const Points3d fromPoints)

Efficiently create a LaneletMap from a vector of things. All elements must have a valid id!

Definition at line 813 of file LaneletMap.cpp.

◆ createMap() [6/6]

LaneletMapUPtr lanelet::utils::createMap ( const Polygons3d fromPolygons)

Definition at line 869 of file LaneletMap.cpp.

◆ createSubmap() [1/6]

LaneletSubmapUPtr lanelet::utils::createSubmap ( const Areas fromAreas)

Definition at line 910 of file LaneletMap.cpp.

◆ createSubmap() [2/6]

LaneletSubmapUPtr lanelet::utils::createSubmap ( const Lanelets fromLanelets)

Definition at line 908 of file LaneletMap.cpp.

◆ createSubmap() [3/6]

LaneletSubmapUPtr lanelet::utils::createSubmap ( const Lanelets fromLanelets,
const Areas fromAreas 
)

Definition at line 912 of file LaneletMap.cpp.

◆ createSubmap() [4/6]

LaneletSubmapUPtr lanelet::utils::createSubmap ( const LineStrings3d fromLineStrings)

Definition at line 898 of file LaneletMap.cpp.

◆ createSubmap() [5/6]

LaneletSubmapUPtr lanelet::utils::createSubmap ( const Points3d fromPoints)

Efficiently create a LaneletSubmap from a vector of things. All elements must have a valid id!

Definition at line 893 of file LaneletMap.cpp.

◆ createSubmap() [6/6]

LaneletSubmapUPtr lanelet::utils::createSubmap ( const Polygons3d fromPolygons)

Definition at line 903 of file LaneletMap.cpp.

◆ find()

template<typename ContainerT , typename ValueT >
auto lanelet::utils::find ( ContainerT &&  c,
const ValueT &  val 
)

Definition at line 186 of file Utilities.h.

◆ findIf()

template<typename ContainerT , typename Func >
auto lanelet::utils::findIf ( ContainerT &&  c,
Func  f 
)

Definition at line 196 of file Utilities.h.

◆ findUsages()

template<typename PrimitiveT >
std::vector< ConstLayerPrimitive< PrimitiveT > > lanelet::utils::findUsages ( const PrimitiveLayer< PrimitiveT > &  layer,
Id  id 
)

Definition at line 779 of file LaneletMap.cpp.

◆ findUsages< Lanelet >()

template std::vector<ConstLayerPrimitive<Lanelet> > lanelet::utils::findUsages< Lanelet > ( const PrimitiveLayer< Lanelet > &  ,
Id   
)

◆ findUsages< LineString3d >()

◆ findUsages< Polygon3d >()

template std::vector<ConstLayerPrimitive<Polygon3d> > lanelet::utils::findUsages< Polygon3d > ( const PrimitiveLayer< Polygon3d > &  ,
Id   
)

◆ findUsages< RegulatoryElementPtr >()

◆ findUsagesInAreas()

ConstAreas lanelet::utils::findUsagesInAreas ( const LaneletMapLayers map,
const ConstPoint3d p 
)

Definition at line 803 of file LaneletMap.cpp.

◆ findUsagesInLanelets()

ConstLanelets lanelet::utils::findUsagesInLanelets ( const LaneletMapLayers map,
const ConstPoint3d p 
)

Definition at line 793 of file LaneletMap.cpp.

◆ forEach()

template<typename Container , typename Func >
void lanelet::utils::forEach ( Container &&  c,
Func &&  f 
)

Definition at line 226 of file Utilities.h.

◆ getAllAreas()

ConstAreas lanelet::utils::getAllAreas ( const ConstLaneletOrAreas lars)
inline

Definition at line 125 of file LaneletOrArea.h.

◆ getAllLanelets()

ConstLanelets lanelet::utils::getAllLanelets ( const ConstLaneletOrAreas lars)
inline

Definition at line 115 of file LaneletOrArea.h.

◆ getId()

Id lanelet::utils::getId ( )

returns a unique id by incrementing a counter each time this is called.

Useful for creating a new map with primitives. As long as all the ids are generated using this function, it is guaranteed that there will be no duplicates. This is different from PrimitiveLayer::uniqueId, which only guarantees that an Id is unique within this layer.

This is threa safe.

Definition at line 883 of file LaneletMap.cpp.

◆ getVariant()

template<typename T , typename Variant >
std::vector<T> lanelet::utils::getVariant ( const std::vector< Variant > &  v)

Definition at line 316 of file Utilities.h.

◆ has() [1/7]

template<typename PointT >
bool lanelet::utils::has ( const CompoundLineStringImpl< PointT > &  ls,
Id  id 
)

returns true if element of a primitive has a matching Id

Parameters
lsthe element holding other primitives
idid to look for
Returns
true if the primitive has such an element

This function does not look for the id of the element, only its members Works for linestrings and polylines. A similar implementation exists for regulatory elements and lanelets.

Definition at line 355 of file CompoundLineString.h.

◆ has() [2/7]

bool lanelet::utils::has ( const ConstArea ll,
Id  id 
)
inline

returns true if element of a regulatory element has a matching Id

Parameters
llthe element holding other primitives
idid to look for
Returns
true if the primitive has such an element

This function does not look for the id of the element, only its members Works for linestrings and polylines. Does NOT check members in regulatory elements, only ids of regulatory elements itself. A similar implementation exists for linestrings and regulatory elements.

Definition at line 324 of file primitives/Area.h.

◆ has() [3/7]

bool lanelet::utils::has ( const ConstLanelet ll,
Id  id 
)

returns true if element of a regulatory element has a matching Id

Parameters
llthe element holding other primitives
idid to look for
Returns
true if the primitive has such an element

This function does not look for the id of the element, only its members Works for linestrings and polylines. Does NOT check members in regulatory elements, only ids of regulatory elements itself. A similar implementation exists for linestrings and regulatory elements.

Definition at line 307 of file Lanelet.cpp.

◆ has() [4/7]

template<typename PointT >
bool lanelet::utils::has ( const ConstLineStringImpl< PointT > &  ls,
Id  id 
)

returns true if element of a lanelet primitive has a matching Id

Parameters
lsthe element holding other primitives
idid to look for
Returns
true if the primitive has such an element

This function does not look for the id of the element, only its members Works for linestrings and polylines. A similar implementation exists for regulatory elements and lanelets.

Definition at line 790 of file primitives/LineString.h.

◆ has() [5/7]

bool lanelet::utils::has ( const LaneletSequence ll,
Id  id 
)
inline

returns true if element of a primitive has a matching Id

Parameters
llthe element holding other primitives
idid to look for
Returns
true if the primitive has such an element

This function does not look for the id of the element, only its members Works for linestrings and polylines. A similar implementation exists for regulatory elements and lanelets.

Definition at line 256 of file LaneletSequence.h.

◆ has() [6/7]

bool lanelet::utils::has ( const RegulatoryElement regElem,
Id  id 
)

returns true if element of a regulatory element has a matching Id

Parameters
regElemthe element holding other primitives
idid to look for
Returns
true if the primitive has such an element

This function does not look for the id of the element, only its members Works for linestrings and polylines. A similar implementation exists for linestrings and lanelets.

Definition at line 164 of file RegulatoryElement.cpp.

◆ has() [7/7]

bool lanelet::utils::has ( const RegulatoryElementConstPtr ls,
Id  id 
)
inline

Definition at line 326 of file primitives/RegulatoryElement.h.

◆ idLess()

template<typename PrimitiveT >
constexpr bool lanelet::utils::idLess ( const PrimitiveT &  p1,
const PrimitiveT &  p2 
)
constexpr

Compares ids of primitives. Can be used for some stl algorithms.

Definition at line 133 of file Utilities.h.

◆ invert()

template<typename Container >
Container lanelet::utils::invert ( const Container &  cont)

Definition at line 169 of file Utilities.h.

◆ nearZero()

bool lanelet::utils::nearZero ( double  d)
inline

Tests if a double is close to zero within a small margin.

Definition at line 359 of file Utilities.h.

◆ orderedPair()

template<typename T1 , typename T2 >
auto lanelet::utils::orderedPair ( T1 &  first,
T2 &  second 
)
inline

Definition at line 144 of file Utilities.h.

◆ registerId()

void lanelet::utils::registerId ( Id  id)

Register an id as being in use. This id will no longer be returned by getId. Function is thread safe.

Definition at line 885 of file LaneletMap.cpp.

◆ removeConst() [1/2]

template<class T >
T& lanelet::utils::removeConst ( const T &  t)

Definition at line 164 of file Utilities.h.

◆ removeConst() [2/2]

template<class T >
std::shared_ptr<T> lanelet::utils::removeConst ( std::shared_ptr< const T >  t)

Definition at line 159 of file Utilities.h.

◆ strequal()

constexpr bool lanelet::utils::strequal ( char const *  lhs,
char const *  rhs 
)
constexpr

compares two c-strings at compile time. Do not use this for run time.

Returns
true if strings match.

Definition at line 332 of file Utilities.h.

◆ strong()

template<typename WeakT >
auto lanelet::utils::strong ( std::vector< WeakT >  v)

transforms a vector of weak_ptrs to a vector of shared_ptrs

Expired elements are discarded.

Definition at line 347 of file Utilities.h.

◆ sum()

template<typename Range , typename Func >
auto lanelet::utils::sum ( Range &&  r,
Func  f 
)

Wrapper around std::accumulate for summing up the result of Func over a range.

Definition at line 248 of file Utilities.h.

◆ transform() [1/3]

template<typename Container , typename Func >
auto lanelet::utils::transform ( Container &&  c,
Func  f 
)

Definition at line 206 of file Utilities.h.

◆ transform() [2/3]

template<typename Iterator , typename Func >
auto lanelet::utils::transform ( Iterator  begin,
Iterator  end,
const Func  f 
)

Definition at line 176 of file Utilities.h.

◆ transform() [3/3]

template<typename T , typename Func >
auto lanelet::utils::transform ( std::initializer_list< T > &&  c,
Func  f 
)

Definition at line 211 of file Utilities.h.

◆ transformSharedPtr()

template<typename OutT , typename InT >
auto lanelet::utils::transformSharedPtr ( const std::vector< std::shared_ptr< InT >> &  v)

Definition at line 231 of file Utilities.h.



lanelet2_core
Author(s): Fabian Poggenhans
autogenerated on Thu Mar 6 2025 03:25:53