Public Types | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
lanelet::io_handlers::ParserFactory Class Reference

Factory class for all suppored lanelet map parsers. More...

#include <Factory.h>

Public Types

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

Static Public Member Functions

static std::vector< std::string > availableExtensions ()
 returns all available extensions as vector More...
 
static std::vector< std::string > availableParsers ()
 returns all available parsers as vector More...
 
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. More...
 
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 More...
 
static ParserFactoryinstance ()
 

Private Member Functions

 ParserFactory ()=default
 
void registerParser (const std::string &strategy, const std::string &extension, const ParserCreationFcn &factoryFunction)
 

Private Attributes

std::map< std::string, ParserCreationFcnextensionRegistry_
 
std::map< std::string, ParserCreationFcnregistry_
 

Friends

template<typename T >
class RegisterParser
 

Detailed Description

Factory class for all suppored lanelet map parsers.

Definition at line 19 of file Factory.h.

Member Typedef Documentation

◆ ParserCreationFcn

Definition at line 21 of file Factory.h.

Constructor & Destructor Documentation

◆ ParserFactory()

lanelet::io_handlers::ParserFactory::ParserFactory ( )
privatedefault

Member Function Documentation

◆ availableExtensions()

std::vector< std::string > lanelet::io_handlers::ParserFactory::availableExtensions ( )
static

returns all available extensions as vector

Returns
vector of extensions (including the dot)

Definition at line 56 of file Factory.cpp.

◆ availableParsers()

std::vector< std::string > lanelet::io_handlers::ParserFactory::availableParsers ( )
static

returns all available parsers as vector

Returns
vector of parser names

Definition at line 47 of file Factory.cpp.

◆ create()

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

creates a parser that matches the given name.

Parameters
parserNamename of the parser (one of availableParsers())
projectorprojection object passed to the parser
configconfig object passed to the parser
Returns
created parser
Exceptions
alanelet2::UnsupportedIOHandlerError if handler is not registered

Definition at line 23 of file Factory.cpp.

◆ createFromExtension()

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

creates a matching parser for the given file extension

Parameters
extensionextension to look for (including the dot!)
projectorprojection object passed to the parser
configconfig object passed to the parser
Returns
created parser
Exceptions
alanelet2::UnsupportedExtensionError if extension is not registered

Definition at line 35 of file Factory.cpp.

◆ instance()

ParserFactory & lanelet::io_handlers::ParserFactory::instance ( )
static

Definition at line 65 of file Factory.cpp.

◆ registerParser()

void lanelet::io_handlers::ParserFactory::registerParser ( const std::string &  strategy,
const std::string &  extension,
const ParserCreationFcn factoryFunction 
)
private

Definition at line 70 of file Factory.cpp.

Friends And Related Function Documentation

◆ RegisterParser

template<typename T >
friend class RegisterParser
friend

Definition at line 61 of file Factory.h.

Member Data Documentation

◆ extensionRegistry_

std::map<std::string, ParserCreationFcn> lanelet::io_handlers::ParserFactory::extensionRegistry_
private

Definition at line 69 of file Factory.h.

◆ registry_

std::map<std::string, ParserCreationFcn> lanelet::io_handlers::ParserFactory::registry_
private

Definition at line 68 of file Factory.h.


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


lanelet2_io
Author(s): Fabian Poggenhans
autogenerated on Thu Mar 6 2025 03:26:03