g2o
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Private Attributes | List of all members
g2o::RobustKernelFactory Class Reference

create robust kernels based on their human readable name More...

#include <robust_kernel_factory.h>

Public Member Functions

 RobustKernelFactory (RobustKernelFactory const &)=delete
 
RobustKernelFactoryoperator= (RobustKernelFactory const &)=delete
 
void registerRobustKernel (const std::string &tag, const AbstractRobustKernelCreator::Ptr &c)
 
void unregisterType (const std::string &tag)
 
RobustKernelconstruct (const std::string &tag) const
 
AbstractRobustKernelCreatorcreator (const std::string &tag) const
 
void fillKnownKernels (std::vector< std::string > &types) const
 

Static Public Member Functions

static RobustKernelFactoryinstance ()
 return the instance
 
static void destroy ()
 free the instance
 

Protected Types

typedef std::map< std::string, AbstractRobustKernelCreator::PtrCreatorMap
 

Protected Member Functions

 RobustKernelFactory ()=default
 

Protected Attributes

CreatorMap _creator
 look-up map for the existing creators
 

Static Private Attributes

static std::unique_ptr< RobustKernelFactoryfactoryInstance
 

Detailed Description

create robust kernels based on their human readable name

Definition at line 68 of file robust_kernel_factory.h.

Member Typedef Documentation

◆ CreatorMap

Definition at line 106 of file robust_kernel_factory.h.

Constructor & Destructor Documentation

◆ RobustKernelFactory() [1/2]

g2o::RobustKernelFactory::RobustKernelFactory ( RobustKernelFactory const &  )
delete

◆ RobustKernelFactory() [2/2]

g2o::RobustKernelFactory::RobustKernelFactory ( )
protecteddefault

Member Function Documentation

◆ construct()

RobustKernel * g2o::RobustKernelFactory::construct ( const std::string &  tag) const

construct a robust kernel based on its tag

Definition at line 66 of file robust_kernel_factory.cpp.

66 {
67 CreatorMap::const_iterator foundIt = _creator.find(tag);
68 if (foundIt != _creator.end()) {
69 return foundIt->second->construct();
70 }
71 return nullptr;
72}
CreatorMap _creator
look-up map for the existing creators

References _creator.

◆ creator()

AbstractRobustKernelCreator * g2o::RobustKernelFactory::creator ( const std::string &  tag) const

return the creator for a specific tag

Definition at line 74 of file robust_kernel_factory.cpp.

75 {
76 CreatorMap::const_iterator foundIt = _creator.find(tag);
77 if (foundIt != _creator.end()) {
78 return foundIt->second.get();
79 }
80 return nullptr;
81}

References _creator.

Referenced by main(), and MainWindow::setRobustKernel().

◆ destroy()

void g2o::RobustKernelFactory::destroy ( )
static

free the instance

Definition at line 91 of file robust_kernel_factory.cpp.

91 {
92 std::unique_ptr<RobustKernelFactory> aux;
93 factoryInstance.swap(aux);
94}
static std::unique_ptr< RobustKernelFactory > factoryInstance

References factoryInstance.

◆ fillKnownKernels()

void g2o::RobustKernelFactory::fillKnownKernels ( std::vector< std::string > &  types) const

get a list of all known robust kernels

Definition at line 83 of file robust_kernel_factory.cpp.

84 {
85 types.clear();
86 for (CreatorMap::const_iterator it = _creator.begin(); it != _creator.end();
87 ++it)
88 types.push_back(it->first);
89}

References _creator.

Referenced by main(), and MainWindow::updateRobustKernels().

◆ instance()

RobustKernelFactory * g2o::RobustKernelFactory::instance ( )
static

return the instance

Definition at line 39 of file robust_kernel_factory.cpp.

39 {
40 if (factoryInstance == nullptr) {
42 }
43
44 return factoryInstance.get();
45}

References factoryInstance.

Referenced by main(), g2o::RegisterRobustKernelProxy< T >::RegisterRobustKernelProxy(), MainWindow::setRobustKernel(), and MainWindow::updateRobustKernels().

◆ operator=()

RobustKernelFactory & g2o::RobustKernelFactory::operator= ( RobustKernelFactory const &  )
delete

◆ registerRobustKernel()

void g2o::RobustKernelFactory::registerRobustKernel ( const std::string &  tag,
const AbstractRobustKernelCreator::Ptr c 
)

register a tag for a specific creator

Definition at line 47 of file robust_kernel_factory.cpp.

48 {
49 CreatorMap::const_iterator foundIt = _creator.find(tag);
50 if (foundIt != _creator.end()) {
51 G2O_WARN("RobustKernelFactory WARNING: Overwriting robust kernel tag {}",
52 tag);
53 assert(0);
54 }
55
56 _creator[tag] = c;
57}
#define G2O_WARN(...)
Definition logger.h:88

References _creator, and G2O_WARN.

Referenced by g2o::RegisterRobustKernelProxy< T >::RegisterRobustKernelProxy().

◆ unregisterType()

void g2o::RobustKernelFactory::unregisterType ( const std::string &  tag)

unregister a tag for a specific creator

Definition at line 59 of file robust_kernel_factory.cpp.

59 {
60 CreatorMap::iterator tagPosition = _creator.find(tag);
61 if (tagPosition != _creator.end()) {
62 _creator.erase(tagPosition);
63 }
64}

References _creator.

Member Data Documentation

◆ _creator

CreatorMap g2o::RobustKernelFactory::_creator
protected

look-up map for the existing creators

Definition at line 109 of file robust_kernel_factory.h.

Referenced by construct(), creator(), fillKnownKernels(), registerRobustKernel(), and unregisterType().

◆ factoryInstance

std::unique_ptr< RobustKernelFactory > g2o::RobustKernelFactory::factoryInstance
staticprivate

Definition at line 112 of file robust_kernel_factory.h.

Referenced by destroy(), and instance().


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