maliput_malidrive
AttributeParser Class Reference

Detailed Description

Parses XML node's attributes descriptions.

There are specializations for:

  • double
  • std::string

#include <src/maliput_malidrive/xodr/parser.h>

Inheritance diagram for AttributeParser:
[legend]

Public Member Functions

 MALIDRIVE_NO_COPY_NO_MOVE_NO_ASSIGN (AttributeParser)
 
 AttributeParser ()=delete
 
 ~AttributeParser ()=default
 
 AttributeParser (tinyxml2::XMLElement *element, const ParserConfiguration &parser_configuration)
 Creates an AttributeParser from a tinyxml2::XMLElement. More...
 
template<typename T >
std::optional< T > As (const std::string &attribute_name) const
 Parses the attribute_name as T. More...
 
template<>
std::optional< double > As (const std::string &attribute_name) const
 
- Public Member Functions inherited from ParserBase
 MALIDRIVE_NO_COPY_NO_MOVE_NO_ASSIGN (ParserBase)
 
 ParserBase ()=delete
 
virtual ~ParserBase ()=default
 
 ParserBase (tinyxml2::XMLElement *element, const ParserConfiguration &parser_configuration)
 Creates an ParserBase from a tinyxml2::XMLElement. More...
 
int NumberOfAttributes () const
 Count the number of attributes the tinyxml2::XMLElement has. More...
 
std::string GetName () const
 

Additional Inherited Members

- Protected Attributes inherited from ParserBase
tinyxml2::XMLElement * element_ {}
 A XML node. More...
 
ParserConfiguration parser_configuration_ {}
 Parser configuration. More...
 

Constructor & Destructor Documentation

◆ AttributeParser() [1/2]

AttributeParser ( )
delete

◆ ~AttributeParser()

~AttributeParser ( )
default

◆ AttributeParser() [2/2]

AttributeParser ( tinyxml2::XMLElement *  element,
const ParserConfiguration parser_configuration 
)

Creates an AttributeParser from a tinyxml2::XMLElement.

Parameters
elementIs the XML Node that contains attributes to be parsed.
parser_configurationHolds the configuration for the parser.
Exceptions
maliput::common::assertion_errorWhen element is nullptr.

Member Function Documentation

◆ As() [1/2]

std::optional<T> As ( const std::string &  attribute_name) const

Parses the attribute_name as T.

Template Parameters
TIs the type to parse the attribute's value into.
Parameters
attribute_nameIs the attribute to be parsed.
Returns
A T(value) object when attribute_name is present, otherwise a std::nullopt.

◆ As() [2/2]

std::optional< Unit > As ( const std::string &  attribute_name) const

◆ MALIDRIVE_NO_COPY_NO_MOVE_NO_ASSIGN()

MALIDRIVE_NO_COPY_NO_MOVE_NO_ASSIGN ( AttributeParser  )

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