g2o
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Variables
optimization_algorithm_factory.h File Reference
#include <iostream>
#include <list>
#include <memory>
#include "g2o/config.h"
#include "g2o/stuff/misc.h"
#include "g2o_core_api.h"
#include "optimization_algorithm_property.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

namespace  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
 

Macro Definition Documentation

◆ G2O_OAF_EXPORT

#define G2O_OAF_EXPORT

Definition at line 146 of file optimization_algorithm_factory.h.

◆ G2O_OAF_IMPORT

#define G2O_OAF_IMPORT

Definition at line 147 of file optimization_algorithm_factory.h.

◆ G2O_REGISTER_OPTIMIZATION_ALGORITHM

#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);

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 181 of file optimization_algorithm_factory.h.

183 {} \
184 static g2o::RegisterOptimizationAlgorithmProxy \
185 g_optimization_algorithm_proxy_##optimizername(instance);

◆ G2O_REGISTER_OPTIMIZATION_LIBRARY

#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 program 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 160 of file optimization_algorithm_factory.h.

161 {}

◆ G2O_USE_OPTIMIZATION_ALGORITHM

#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);

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 192 of file optimization_algorithm_factory.h.

◆ G2O_USE_OPTIMIZATION_LIBRARY

#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);

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 170 of file optimization_algorithm_factory.h.