maliput
TypeSpecificIdentifier< T > Class Template Reference

Detailed Description

template<typename T>
class maliput::api::TypeSpecificIdentifier< T >

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...
 

Member Typedef Documentation

◆ identified_type

typedef T identified_type

The type whose instances are identified by this TypeSpecificIdentifier.

Constructor & Destructor Documentation

◆ TypeSpecificIdentifier()

TypeSpecificIdentifier ( std::string  string)
explicit

Constructs a TypeSpecificIdentifier from the given string.

Exceptions
maliput::common::assertion_errorif string is empty.

Member Function Documentation

◆ MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN()

MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN ( TypeSpecificIdentifier< T >  )

◆ operator!=()

bool operator!= ( const TypeSpecificIdentifier< T > &  rhs) const

Tests for inequality with another TypeSpecificIdentifier, specifically returning the opposite of operator==().

◆ operator==()

bool operator== ( const TypeSpecificIdentifier< T > &  rhs) const

Tests for equality with another TypeSpecificIdentifier.

◆ string()

const std::string& string ( ) const

Returns the string representation of the TypeSpecificIdentifier.

Friends And Related Function Documentation

◆ hash_append

void hash_append ( HashAlgorithm &  hasher,
const TypeSpecificIdentifier< T > &  item 
)
friend

Implements the hash_append concept.


The documentation for this class was generated from the following file: