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

Factory class for all supported lanelet map writers. More...

#include <Factory.h>

Public Types

using WriterCreationFcn = std::function< Writer *(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 > availableWriters ()
 returns all available writers as vector More...
 
static Writer::Ptr create (const std::string &writerName, const Projector &projector, const io::Configuration &config=io::Configuration())
 creates a writer that matches the given name. More...
 
static Writer::Ptr createFromExtension (const std::string &extension, const Projector &projector, const io::Configuration &config=io::Configuration())
 creates a matching writer for the given file extension More...
 
static WriterFactoryinstance ()
 

Private Member Functions

void registerWriter (const std::string &strategy, const std::string &extension, const WriterCreationFcn &factoryFunction)
 
 WriterFactory ()=default
 

Private Attributes

std::map< std::string, WriterCreationFcnextensionRegistry_
 
std::map< std::string, WriterCreationFcnregistry_
 

Friends

template<typename T >
class RegisterWriter
 

Detailed Description

Factory class for all supported lanelet map writers.

Definition at line 75 of file Factory.h.

Member Typedef Documentation

◆ WriterCreationFcn

Definition at line 77 of file Factory.h.

Constructor & Destructor Documentation

◆ WriterFactory()

lanelet::io_handlers::WriterFactory::WriterFactory ( )
privatedefault

Member Function Documentation

◆ availableExtensions()

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

returns all available extensions as vector

Returns
vector of extensions (including the dot)

Definition at line 114 of file Factory.cpp.

◆ availableWriters()

std::vector< std::string > lanelet::io_handlers::WriterFactory::availableWriters ( )
static

returns all available writers as vector

Returns
vector of writer names

Definition at line 105 of file Factory.cpp.

◆ create()

Writer::Ptr lanelet::io_handlers::WriterFactory::create ( const std::string &  writerName,
const Projector projector,
const io::Configuration config = io::Configuration() 
)
static

creates a writer that matches the given name.

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

Definition at line 81 of file Factory.cpp.

◆ createFromExtension()

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

creates a matching writer for the given file extension

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

Definition at line 93 of file Factory.cpp.

◆ instance()

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

Definition at line 123 of file Factory.cpp.

◆ registerWriter()

void lanelet::io_handlers::WriterFactory::registerWriter ( const std::string &  strategy,
const std::string &  extension,
const WriterCreationFcn factoryFunction 
)
private

Definition at line 128 of file Factory.cpp.

Friends And Related Function Documentation

◆ RegisterWriter

template<typename T >
friend class RegisterWriter
friend

Definition at line 117 of file Factory.h.

Member Data Documentation

◆ extensionRegistry_

std::map<std::string, WriterCreationFcn> lanelet::io_handlers::WriterFactory::extensionRegistry_
private

Definition at line 125 of file Factory.h.

◆ registry_

std::map<std::string, WriterCreationFcn> lanelet::io_handlers::WriterFactory::registry_
private

Definition at line 124 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