Basic Primitive class for all primitives of lanelet2. More...
#include <Primitive.h>
Public Types | |
using | DataType = Data |
Public Member Functions | |
const Attribute & | attribute (AttributeName name) const |
retrieve an attribute (enum version) More... | |
const Attribute & | attribute (const std::string &name) const |
retrieve an attribute More... | |
template<typename T > | |
T | attributeOr (AttributeName name, T defaultVal) const |
retrieve an attribute (enum version) More... | |
template<typename T > | |
T | attributeOr (const std::string &name, T defaultVal) const noexcept |
retrieve an attribute (string version) More... | |
const AttributeMap & | attributes () const |
get the attributes of this primitive More... | |
const std::shared_ptr< const Data > & | constData () const |
get the internal data of this primitive More... | |
ConstPrimitive (const std::shared_ptr< const Data > &data) | |
Construct from a pointer to the data. More... | |
bool | hasAttribute (AttributeName name) const noexcept |
check for an attribute (enum version) More... | |
bool | hasAttribute (const std::string &name) const noexcept |
check whether this primitive has a specific attribute More... | |
Id | id () const noexcept |
get the unique id of this primitive More... | |
bool | operator!= (const ConstPrimitive &rhs) const |
bool | operator== (const ConstPrimitive &rhs) const |
Static Public Attributes | |
static constexpr bool | IsConst = true |
Protected Member Functions | |
ConstPrimitive (const ConstPrimitive &rhs)=default | |
ConstPrimitive (ConstPrimitive &&rhs) noexcept=default | |
ConstPrimitive & | operator= (const ConstPrimitive &rhs)=default |
ConstPrimitive & | operator= (ConstPrimitive &&rhs) noexcept=default |
~ConstPrimitive () noexcept=default | |
Private Attributes | |
std::shared_ptr< const Data > | constData_ |
the data this primitive holds More... | |
Basic Primitive class for all primitives of lanelet2.
Data | Type of the data object that this ConstPrimitive holds |
Definition at line 70 of file Primitive.h.
using lanelet::ConstPrimitive< Data >::DataType = Data |
Definition at line 72 of file Primitive.h.
|
inlineexplicit |
Construct from a pointer to the data.
data | internal data for this primitive. Must not be null. |
Definition at line 78 of file Primitive.h.
|
protecteddefaultnoexcept |
|
protecteddefault |
|
protecteddefaultnoexcept |
|
inline |
retrieve an attribute (enum version)
NoSuchAttributeError | if it does not exist |
Definition at line 125 of file Primitive.h.
|
inline |
retrieve an attribute
NoSuchAttributeError | if it does not exist |
Definition at line 113 of file Primitive.h.
|
inline |
retrieve an attribute (enum version)
name | name of the attribute |
defaultVal | value returned if not existing |
T | return type (must be one of Attribute::as<T>()) |
T can also be an Optional so that you get an empty optional if the value did not exist or could not be converted.
Definition at line 165 of file Primitive.h.
|
inlinenoexcept |
retrieve an attribute (string version)
name | name of the attribute |
defaultVal | value returned if not existing |
T | return type (must be one of Attribute::as<T>()) |
T can also be an Optional so that you get an empty optional if the value did not exist or could not be converted.
Definition at line 143 of file Primitive.h.
|
inline |
get the attributes of this primitive
Definition at line 89 of file Primitive.h.
|
inline |
get the internal data of this primitive
Definition at line 178 of file Primitive.h.
|
inlinenoexcept |
check for an attribute (enum version)
The enum version provides a much more efficient access to the data. It is basically the difference between access via a vector and a std::map lookup. However, this kind of access only works for the most common attribte names.
Definition at line 107 of file Primitive.h.
|
inlinenoexcept |
check whether this primitive has a specific attribute
Definition at line 99 of file Primitive.h.
|
inlinenoexcept |
get the unique id of this primitive
Keep in mind that the Id can also be InvalId, if the element is a temporary structure that is not a part of the map.
Definition at line 96 of file Primitive.h.
|
inline |
Definition at line 86 of file Primitive.h.
|
protecteddefault |
|
protecteddefaultnoexcept |
|
inline |
Definition at line 85 of file Primitive.h.
|
private |
the data this primitive holds
Definition at line 189 of file Primitive.h.
|
staticconstexpr |
Definition at line 73 of file Primitive.h.