Class ParserFactory

Class Documentation

class ParserFactory

Factory class for all suppored lanelet map parsers.

Public Types

using ParserCreationFcn = std::function<Parser*(const Projector&, const io::Configuration&)>

Public Static Functions

static ParserFactory &instance()
static Parser::Ptr create(const std::string &parserName, const Projector &projector, const io::Configuration &config = io::Configuration())

creates a parser that matches the given name.

Parameters:
  • parserName – name of the parser (one of availableParsers())

  • projector – projection object passed to the parser

  • config – config object passed to the parser

Throws:

a – lanelet2::UnsupportedIOHandlerError if handler is not registered

Returns:

created parser

static Parser::Ptr createFromExtension(const std::string &extension, const Projector &projector, const io::Configuration &config = io::Configuration())

creates a matching parser for the given file extension

Parameters:
  • extension – extension to look for (including the dot!)

  • projector – projection object passed to the parser

  • config – config object passed to the parser

Throws:

a – lanelet2::UnsupportedExtensionError if extension is not registered

Returns:

created parser

static std::vector<std::string> availableParsers()

returns all available parsers as vector

Returns:

vector of parser names

static std::vector<std::string> availableExtensions()

returns all available extensions as vector

Returns:

vector of extensions (including the dot)

Friends

friend class RegisterParser