maliput
maliput::common Namespace Reference

Namespaces

 internal
 
 logger
 

Classes

class  assertion_error
 This is what MALIPUT_THROW_UNLESS throws. More...
 
struct  ComparisonResult
 ComparisonResult is a struct that holds the result of a comparison between two objects of type T. More...
 
class  ComparisonResultCollector
 ComparisonResultCollector is a class that collects the results of a series of comparisons between objects of type T. More...
 
struct  DelegatingHasher
 An adapter that forwards the HashAlgorithm::operator(data, length) function concept into a runtime-provided std::function of the same signature. More...
 
class  Filesystem
 
class  Logger
 A logger class implementation. More...
 
class  never_destroyed
 Wraps an underlying type T such that its storage is a direct member field of this object (i.e., without any indirection into the heap), but unlike most member fields T's destructor is never invoked. More...
 
class  Passkey
 Simple generic implementation of the "Passkey Idiom". More...
 
class  Path
 
class  RangeValidator
 Functor to validate if a number is within [min, max] and considering assuming a tolerance. More...
 
struct  Serialize
 Convenient functor for getting a string from a object that has serialization operator defined. More...
 
class  Sink
 Sink that uses std::cout to dump the log messages. More...
 
class  SinkBase
 Interface of a sink to dump all log messages. More...
 
struct  uhash
 A hashing functor, somewhat like std::hash. More...
 

Typedefs

using DefaultHasher = internal::FNV1aHasher
 The default HashAlgorithm concept implementation across Maliput. More...
 
using DefaultHash = maliput::common::uhash< DefaultHasher >
 The default hashing functor, akin to std::hash. More...
 

Functions

template<class HashAlgorithm , class T >
std::enable_if_t< std::is_integral< T >::value > hash_append (HashAlgorithm &hasher, const T &item) noexcept
 Provides hash_append generic hashing for integral constants. More...
 
template<class HashAlgorithm , class T >
std::enable_if_t< std::is_enum< T >::value > hash_append (HashAlgorithm &hasher, const T &item) noexcept
 Provides hash_append generic hashing for enumerations. More...
 
template<class HashAlgorithm , class T >
std::enable_if_t< std::is_floating_point< T >::value > hash_append (HashAlgorithm &hasher, const T &item) noexcept
 Provides hash_append generic hashing for floating point values. More...
 
template<class HashAlgorithm , class Traits , class Allocator >
void hash_append (HashAlgorithm &hasher, const std::basic_string< char, Traits, Allocator > &item) noexcept
 Provides hash_append generic hashing for std::string. More...
 
template<class HashAlgorithm , class T1 , class T2 >
void hash_append (HashAlgorithm &hasher, const std::pair< T1, T2 > &item) noexcept
 Provides hash_append generic hashing for std::pair. More...
 
template<class HashAlgorithm , class T >
void hash_append (HashAlgorithm &hasher, const std::optional< T > &item) noexcept
 Provides hash_append generic hashing for std::optional. More...
 
template<class HashAlgorithm , class Iter >
void hash_append_range (HashAlgorithm &hasher, Iter begin, Iter end) noexcept
 Provides hash_append generic hashing for a range, as given by two iterators. More...
 
template<class HashAlgorithm , class T1 , class T2 , class Compare , class Allocator >
void hash_append (HashAlgorithm &hasher, const std::map< T1, T2, Compare, Allocator > &item) noexcept
 Provides hash_append generic hashing for std::map. More...
 
template<class HashAlgorithm , class Key , class Compare , class Allocator >
void hash_append (HashAlgorithm &hasher, const std::set< Key, Compare, Allocator > &item) noexcept
 Provides hash_append generic hashing for std::set. More...
 
template<typename... Args>
void unused (const Args &...)
 Documents the argument(s) as unused, placating GCC's -Wunused-parameter warning. More...
 
std::string set_log_level (const std::string &level)
 Invokes drake::log()->set_level(level). More...
 

Typedef Documentation

◆ DefaultHash

The default hashing functor, akin to std::hash.

◆ DefaultHasher

The default HashAlgorithm concept implementation across Maliput.

This is guaranteed to have a result_type of size_t to be compatible with std::hash.

Function Documentation

◆ hash_append() [1/8]

void maliput::common::hash_append ( HashAlgorithm &  hasher,
const std::basic_string< char, Traits, Allocator > &  item 
)
noexcept

Provides hash_append generic hashing for std::string.

(Technically, any string based on CharT = char.)

◆ hash_append() [2/8]

void maliput::common::hash_append ( HashAlgorithm &  hasher,
const std::map< T1, T2, Compare, Allocator > &  item 
)
noexcept

Provides hash_append generic hashing for std::map.

Note that there is no hash_append overload for std::unordered_map, and such an overload must never appear. See n3980.html::unordered for details.

◆ hash_append() [3/8]

void maliput::common::hash_append ( HashAlgorithm &  hasher,
const std::optional< T > &  item 
)
noexcept

Provides hash_append generic hashing for std::optional.

Note that std::hash<std::optional<T>> provides the peculiar invariant that the hash of an optional bearing a value v shall evaluate to the same hash as that of the value v itself. Hash operations implemented with this hash_append do not provide that invariant.

◆ hash_append() [4/8]

void maliput::common::hash_append ( HashAlgorithm &  hasher,
const std::pair< T1, T2 > &  item 
)
noexcept

Provides hash_append generic hashing for std::pair.

◆ hash_append() [5/8]

void maliput::common::hash_append ( HashAlgorithm &  hasher,
const std::set< Key, Compare, Allocator > &  item 
)
noexcept

Provides hash_append generic hashing for std::set.

Note that there is no hash_append overload for std::unordered_set, and such an overload must never appear. See n3980.html::unordered for details.

◆ hash_append() [6/8]

std::enable_if_t<std::is_integral<T>::value> maliput::common::hash_append ( HashAlgorithm &  hasher,
const T &  item 
)
noexcept

Provides hash_append generic hashing for integral constants.

◆ hash_append() [7/8]

std::enable_if_t<std::is_enum<T>::value> maliput::common::hash_append ( HashAlgorithm &  hasher,
const T &  item 
)
noexcept

Provides hash_append generic hashing for enumerations.

◆ hash_append() [8/8]

std::enable_if_t<std::is_floating_point<T>::value> maliput::common::hash_append ( HashAlgorithm &  hasher,
const T &  item 
)
noexcept

Provides hash_append generic hashing for floating point values.

◆ hash_append_range()

void maliput::common::hash_append_range ( HashAlgorithm &  hasher,
Iter  begin,
Iter  end 
)
noexcept

Provides hash_append generic hashing for a range, as given by two iterators.

◆ set_log_level()

std::string maliput::common::set_log_level ( const std::string &  level)
related

Invokes drake::log()->set_level(level).

Parameters
levelMust be a string from spdlog enumerations: trace, debug, info, warn, err, critical, off, or unchanged (not an enum, but useful for command-line).
Returns
The string value of the previous log level. If SPDLOG is disabled, then this returns an empty string.

◆ unused()

void maliput::common::unused ( const Args &  ...)

Documents the argument(s) as unused, placating GCC's -Wunused-parameter warning.

This can be called within function bodies to mark that certain parameters are unused.

When possible, removing the unused parameter is better than placating the warning. However, in some cases the parameter is part of a virtual API or template concept that is used elsewhere, so we can't remove it. In those cases, this function might be an appropriate work-around.

Here's rough advice on how to fix Wunused-parameter warnings:

(1) If the parameter can be removed entirely, prefer that as the first choice. (This may not be possible if, e.g., a method must match some virtual API or template concept.)

(2) Unless the parameter name has acute value, prefer to omit the name of the parameter, leaving only the type, e.g.

void Print(const State& state) override { /* No state to print. */ }

changes to

void Print(const State&) override { /* No state to print. */}

This no longer triggers the warning and further makes it clear that a parameter required by the API is definitively unused in the function.

This is an especially good solution in the context of method definitions (vs declarations); the parameter name used in a definition is entirely irrelevant to Doxygen and most readers.

(3) When leaving the parameter name intact has acute value, it is acceptable to keep the name and mark it unused. For example, when the name appears as part of a virtual method's base class declaration, the name is used by Doxygen to document the method, e.g.,

/** Sets the default State of a System. This default implementation is to
* set all zeros. Subclasses may override to use non-zero defaults. The
* custom defaults may be based on the given @p context, when relevant. */
virtual void SetDefault(const Context<T>& context, State<T>* state) const {
unused(context);
state->SetZero();
}
maliput::common::unused
void unused(const Args &...)
Documents the argument(s) as unused, placating GCC's -Wunused-parameter warning.
Definition: maliput_unused.h:119