g2o
Classes | Namespaces | Macros | Variables
optimization_algorithm_factory.h File Reference
#include "g2o/config.h"
#include "g2o/stuff/misc.h"
#include "optimization_algorithm_property.h"
#include <list>
#include <iostream>
#include <typeinfo>
#include "g2o_core_api.h"
Include dependency graph for optimization_algorithm_factory.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  g2o::AbstractOptimizationAlgorithmCreator
 base for allocating an optimization algorithm More...
 
class  g2o::OptimizationAlgorithmFactory
 create solvers based on their short name More...
 
class  g2o::RegisterOptimizationAlgorithmProxy
 

Namespaces

 g2o
 

Macros

#define G2O_OAF_EXPORT
 
#define G2O_OAF_IMPORT
 
#define G2O_REGISTER_OPTIMIZATION_LIBRARY(libraryname)   extern "C" void G2O_OAF_EXPORT g2o_optimization_library_##libraryname(void) {}
 
#define G2O_USE_OPTIMIZATION_LIBRARY(libraryname)
 
#define G2O_REGISTER_OPTIMIZATION_ALGORITHM(optimizername, instance)
 
#define G2O_USE_OPTIMIZATION_ALGORITHM(optimizername)
 

Variables

class G2O_CORE_API g2o::OptimizationAlgorithm
 
class G2O_CORE_API g2o::SparseOptimizer
 

Macro Definition Documentation

#define G2O_OAF_EXPORT

Definition at line 149 of file optimization_algorithm_factory.h.

#define G2O_OAF_IMPORT

Definition at line 150 of file optimization_algorithm_factory.h.

#define G2O_REGISTER_OPTIMIZATION_ALGORITHM (   optimizername,
  instance 
)
Value:
extern "C" void G2O_OAF_EXPORT g2o_optimization_algorithm_##optimizername(void) {} \
static g2o::RegisterOptimizationAlgorithmProxy g_optimization_algorithm_proxy_##optimizername(instance);
#define G2O_OAF_EXPORT

Similarly to G2O_OAF_IMPORT this macro allows to register a singla more specific algorithm to the library, i.e., gn_var, where gn_var corresponds to a specific instance of csparse based solver for example

Definition at line 182 of file optimization_algorithm_factory.h.

Referenced by g2o::DenseSolverCreator::construct(), g2o::PCGSolverCreator::construct(), g2o::EigenSolverCreator::construct(), g2o::CSparseSolverCreator::construct(), and g2o::CholmodSolverCreator::construct().

#define G2O_REGISTER_OPTIMIZATION_LIBRARY (   libraryname)    extern "C" void G2O_OAF_EXPORT g2o_optimization_library_##libraryname(void) {}

Use the following macro to register a whole library of algorithms to the factory, e.g., G2O_REGISTER_OPTIMIZATION_LIBRARY(csparse) In another programm that links to your library or loads it via dlopen() (or similar functions) you should indicate the desired usage of the solver by using the G2O_REGISTER_OPTIMIZATION_LIBRARY() macro. Here, you should then provide the same name as to the macro before.

Definition at line 163 of file optimization_algorithm_factory.h.

Referenced by g2o::DenseSolverCreator::construct(), g2o::PCGSolverCreator::construct(), g2o::EigenSolverCreator::construct(), g2o::CSparseSolverCreator::construct(), and g2o::CholmodSolverCreator::construct().

#define G2O_USE_OPTIMIZATION_ALGORITHM (   optimizername)
Value:
extern "C" void G2O_OAF_IMPORT g2o_optimization_algorithm_##optimizername(void); \
static g2o::ForceLinker g2o_force_optimization_algorithm_link_##optimizername(g2o_optimization_algorithm_##optimizername);
#define G2O_OAF_IMPORT

see the documentation of the macros above. It allows to enforce linking to library that contains a specific solver instance and guarantees its usage with the factory

Definition at line 191 of file optimization_algorithm_factory.h.

#define G2O_USE_OPTIMIZATION_LIBRARY (   libraryname)
Value:
extern "C" void G2O_OAF_IMPORT g2o_optimization_library_##libraryname(void); \
static g2o::ForceLinker g2o_force_optimization_algorithm_library_##libraryname(g2o_optimization_library_##libraryname);
#define G2O_OAF_IMPORT

see the documentation to G2O_OAF_EXPORT() above. You should but this into your code, if you expect the factory to be able to allocate a solver but it fails. It enforces linking to the library containing the solver. Hence, the usage of the macro should enforce that the library is actually linked with the binary.

Definition at line 173 of file optimization_algorithm_factory.h.