class mrpt::graphslam::detail::CEdgeCounter

Generic class for tracking the total number of edges for different tpes of edges and for storing visualization-related information for each type.

#include <mrpt/graphslam/misc/CEdgeCounter.h>

class CEdgeCounter
{
public:
    // typedefs

    typedef std::map<std::string, int>::iterator iterator;
    typedef std::map<std::string, int>::const_iterator const_iterator;

    //
methods

    void setWindowManagerPtr(mrpt::graphslam::CWindowManager* win_manager);
    void setRemovedEdges(int removed_edges);
    void setLoopClosureEdgesManually(int num_loop_closures);
    int getLoopClosureEdges() const;
    int getTotalNumOfEdges() const;
    void getTotalNumOfEdges(int* total_num_edges) const;
    int getNumForEdgeType(const std::string& name) const;
    void getNumForEdgeType(const std::string& name, int* total_num);
    void setEdgesManually(const std::string& name, int num_of_edges);

    void addEdge(
        const std::string& name,
        bool is_loop_closure = false,
        bool is_new = false
        );

    void addEdgeType(const std::string& name);
    void clearAllEdges();
    void dumpToConsole() const;
    void getAsString(std::string* str_out) const;
    std::string getAsString() const;

    void setTextMessageParams(
        const std::map<std::string, double>& name_to_offset_y,
        const std::map<std::string, int>& name_to_text_index
        );

    void setTextMessageParams(
        const std::map<std::string, double>& name_to_offset_y,
        const std::map<std::string, int>& name_to_text_index,
        double offset_y_total_edges,
        int text_index_total_edges,
        double offset_y_loop_closures,
        int text_index_loop_closures
        );

    iterator begin();
    const_iterator cbegin() const;
    iterator end();
    const_iterator cend() const;
};

Methods

void setWindowManagerPtr(mrpt::graphslam::CWindowManager* win_manager)

Provide the instance with a CWindowManager.

void setRemovedEdges(int removed_edges)

State how many of the existing edges have been removed.

Method is to be called after CNetworkOfPoses::collapseDuplicatedEdges method has been executed.

void setLoopClosureEdgesManually(int num_loop_closures)

Method for manually setting the number of loop closures registered so far.

int getLoopClosureEdges() const

Returns the edges that form loop closures in the current graph.

int getTotalNumOfEdges() const

Return the total amount of registered edges.

See also:

getNumForEdgeType, getLoopClosureEdges

void getTotalNumOfEdges(int* total_num_edges) const

Return the total amount of registered edges.

See also:

getNumForEdgeType, getLoopClosureEdges

int getNumForEdgeType(const std::string& name) const

Return the number of edges for the specified type.

Parameters:

std::exception

If edge is not found

See also:

getTotalNumOfEdges

void getNumForEdgeType(const std::string& name, int* total_num)

Return the number of edges for the specified type.

Parameters:

std::exception

If edge is not found

See also:

getTotalNumOfEdges

void setEdgesManually(const std::string& name, int num_of_edges)

Set number of a specific edge type manually.

Handy for not having to call addEdge multiple times in a row.

See also:

addEdge

void addEdge(
    const std::string& name,
    bool is_loop_closure = false,
    bool is_new = false
    )

Increment the number of edges for the specified type.

Parameters:

std::exception

If edge exists and is_new is True

See also:

setEdgesManually

void addEdgeType(const std::string& name)

Explicitly register a new edge type.

void clearAllEdges()

Reset the state of the CEdgeCounter instance.

void dumpToConsole() const

Dump a report of the registered, so far, edges to the console.

See also:

getAsString

void getAsString(std::string* str_out) const

Fill the provided string with a detailed report of the registered, so far, edges.

std::string getAsString() const

Return a detailed report of the registered, so far, edges in a string representation.

void setTextMessageParams(
    const std::map<std::string, double>& name_to_offset_y,
    const std::map<std::string, int>& name_to_text_index
    )

Add the textMessage parameters to the object All the names in the given std::maps have to be already specified and added in the object via addEdge with is_new=true or addEdgeType.

Parameters:

std::exception

If a name in the provided std::map doesn’t already exist

void setTextMessageParams(
    const std::map<std::string, double>& name_to_offset_y,
    const std::map<std::string, int>& name_to_text_index,
    double offset_y_total_edges,
    int text_index_total_edges,
    double offset_y_loop_closures,
    int text_index_loop_closures
    )

Handle the extra visualization parameters for the total number of edges and for loop closures and then passes execution to the other setTextMessageParams function.

iterator begin()

Instance Iterators.