template struct mrpt::graphslam::apps::TUserOptionsChecker

Class containing the declarations of supplementary methods that can be used in application-related code.

Class instance can be handy for adding keeping the available deciders/optimizers in a compact manner and for verifying whether a given decider can be used.

#include <mrpt/graphslam/apps_related/TUserOptionsChecker.h>

template <class GRAPH_t>
struct TUserOptionsChecker
{
    // typedefs

    typedef typename GRAPH_t::constraint_t constraint_t;
    typedef typename GRAPH_t::constraint_t::type_value pose_t;
    typedef std::map<std::string, mrpt::graphslam::deciders::CNodeRegistrationDecider<GRAPH_t>*(*)()> node_regs_t;
    typedef std::map<std::string, mrpt::graphslam::deciders::CEdgeRegistrationDecider<GRAPH_t>*(*)()> edge_regs_t;
    typedef std::map<std::string, mrpt::graphslam::optimizers::CGraphSlamOptimizer<GRAPH_t>*(*)()> optimizers_t;

    //
fields

    node_regs_t node_regs_map;
    edge_regs_t edge_regs_map;
    optimizers_t optimizers_map;
    std::vector<TRegistrationDeciderProps*> regs_descriptions;
    std::vector<TOptimizerProps*> optimizers_descriptions;
    const std::string sep_header;
    const std::string sep_subheader;

    // construction

    TUserOptionsChecker();

    //
methods

    template <class T>
    static mrpt::graphslam::deciders::CNodeRegistrationDecider<GRAPH_t>* createNodeRegistrationDecider();

    template <class T>
    static mrpt::graphslam::deciders::CEdgeRegistrationDecider<GRAPH_t>* createEdgeRegistrationDecider();

    template <class T>
    static mrpt::graphslam::optimizers::CGraphSlamOptimizer<GRAPH_t>* createGraphSlamOptimizer();

    virtual void createDeciderOptimizerMappings();
    virtual void _createDeciderOptimizerMappings();
    virtual void populateDeciderOptimizerProperties();
    virtual bool checkRegistrationDeciderExists(std::string given_reg, std::string reg_type) const;
    virtual bool checkOptimizerExists(std::string given_opt) const;
    virtual void dumpRegistrarsToConsole(std::string reg_type = "all") const;
    virtual void dumpOptimizersToConsole() const;
    void _createDeciderOptimizerMappings();
    void _createDeciderOptimizerMappings();
    void _createDeciderOptimizerMappings();
};

Construction

TUserOptionsChecker()

Constructor.

Methods

virtual void createDeciderOptimizerMappings()

Create the necessary mappings from strings to the corresponding instance creation functors.

Method is used for populating a map from string to instance creation function. The decider/optimzer can then be spawned according to the user selection.

virtual void populateDeciderOptimizerProperties()

Populate the available decider, optimizer classes available in user applications.

virtual bool checkRegistrationDeciderExists(
    std::string given_reg,
    std::string reg_type
    ) const

Check if the given registrator decider exists in the vector of deciders.

Parameters:

given_reg

String specifying the type of decider - This should either be “node” or “edge”

Returns:

True if it exists, false otherwise

virtual bool checkOptimizerExists(std::string given_opt) const

Check if the given optimizer exists in the vector of optimizers.

Returns:

True if it exists, false otherwise

virtual void dumpRegistrarsToConsole(std::string reg_type = "all") const

Print the registration deciders vector in a formatted manner to the standard output.

Parameters:

reg_type

Method prints both the node registration and edge registration deciders of the given vector unless specified otherwise. The available argument options are “node”, “edge”, “all”

virtual void dumpOptimizersToConsole() const

Print the optimizers vector in a formatted manner to the standard output.