maliput
|
TypeSpecificIdentifier<T> represents an identifier specifically identifying an entity of type T
.
A new TypeSpecificIdentifier is constructed from a non-empty string; TypeSpecificIdentifiers constructed from equal strings are considered to be equal. There is currently no other semantic value attributed to the contents of the string.
Construction from empty strings is not allowed; there is no notion of an "unassigned" value for a TypeSpecificIdentifier. To represent a possibly-unassigned TypeSpecificIdentifier, use std::optional<TypeSpecificIdentifier<T>>.
TypeSpecificIdentifier is EqualityComparable (and provides == and != operators), but it is not LessThanComparable; there is no particular ordering ascribed to TypeSpecificIdentifier instances. However, TypeSpecificIdentifier does provide a strict weak ordering via a specialization of std::less for use in ordered containers such as std::set and std::map. This ordering may change in future implementations of TypeSpecificIdentifier.
TypeSpecificIdentifier also provides a specialization of std::hash to make it easy to use with std::unordered_set and std::unordered_map.
#include <include/maliput/api/type_specific_identifier.h>
Public Types | |
typedef T | identified_type |
The type whose instances are identified by this TypeSpecificIdentifier. More... | |
Public Member Functions | |
MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN (TypeSpecificIdentifier) | |
TypeSpecificIdentifier (std::string string) | |
Constructs a TypeSpecificIdentifier from the given string . More... | |
const std::string & | string () const |
Returns the string representation of the TypeSpecificIdentifier. More... | |
bool | operator== (const TypeSpecificIdentifier< T > &rhs) const |
Tests for equality with another TypeSpecificIdentifier. More... | |
bool | operator!= (const TypeSpecificIdentifier< T > &rhs) const |
Tests for inequality with another TypeSpecificIdentifier, specifically returning the opposite of operator==(). More... | |
Friends | |
template<class HashAlgorithm > | |
void | hash_append (HashAlgorithm &hasher, const TypeSpecificIdentifier &item) noexcept |
Implements the hash_append concept. More... | |
typedef T identified_type |
The type whose instances are identified by this TypeSpecificIdentifier.
|
explicit |
Constructs a TypeSpecificIdentifier from the given string
.
maliput::common::assertion_error | if string is empty. |
MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN | ( | TypeSpecificIdentifier< T > | ) |
bool operator!= | ( | const TypeSpecificIdentifier< T > & | rhs | ) | const |
Tests for inequality with another TypeSpecificIdentifier, specifically returning the opposite of operator==().
bool operator== | ( | const TypeSpecificIdentifier< T > & | rhs | ) | const |
Tests for equality with another TypeSpecificIdentifier.
const std::string& string | ( | ) | const |
Returns the string representation of the TypeSpecificIdentifier.
|
friend |
Implements the hash_append concept.