Main MRPT website > C++ reference for MRPT 1.9.9
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
mrpt::graphslam::detail::CEdgeCounter Class Reference

Detailed Description

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

Definition at line 35 of file CEdgeCounter.h.

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

Public Types

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

Public Member Functions

 CEdgeCounter ()
 Constructor class. More...
 
 ~CEdgeCounter ()
 Destructor class. More...
 
void setWindowManagerPtr (mrpt::graphslam::CWindowManager *win_manager)
 Provide the instance with a CWindowManager. More...
 
void setRemovedEdges (int removed_edges)
 State how many of the existing edges have been removed. More...
 
void setLoopClosureEdgesManually (int num_loop_closures)
 Method for manually setting the number of loop closures registered so far. More...
 
int getLoopClosureEdges () const
 Returns the edges that form loop closures in the current graph. More...
 
int getTotalNumOfEdges () const
 Return the total amount of registered edges. More...
 
void getTotalNumOfEdges (int *total_num_edges) const
 Return the total amount of registered edges. More...
 
int getNumForEdgeType (const std::string &name) const
 Return the number of edges for the specified type. More...
 
void getNumForEdgeType (const std::string &name, int *total_num)
 Return the number of edges for the specified type. More...
 
void setEdgesManually (const std::string &name, int num_of_edges)
 Set number of a specific edge type manually. More...
 
void addEdge (const std::string &name, bool is_loop_closure=false, bool is_new=false)
 Increment the number of edges for the specified type. More...
 
void addEdgeType (const std::string &name)
 Explicitly register a new edge type. More...
 
void clearAllEdges ()
 Reset the state of the CEdgeCounter instance. More...
 
void dumpToConsole () const
 Dump a report of the registered, so far, edges to the console. More...
 
void getAsString (std::string *str_out) const
 Fill the provided string with a detailed report of the registered, so far, edges. More...
 
std::string getAsString () const
 Return a detailed report of the registered, so far, edges in a string representation. More...
 
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. More...
 
void setTextMessageParams (const std::map< std::string, double > &name_to_offset_y, const std::map< std::string, int > &name_to_text_index, const double &offset_y_total_edges, const int &text_index_total_edges, const double &offset_y_loop_closures, const 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. More...
 
iterator begin ()
 Instance Iterators. More...
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 

Private Member Functions

void initCEdgeCounter ()
 Initialization method to be called from the various Constructors. More...
 
void updateTextMessages () const
 Update the given CDisplayWindow3D with the edges registered so far. More...
 

Private Attributes

mrpt::gui::CDisplayWindow3Dm_win
 
mrpt::graphslam::CWindowManagerm_win_manager
 
std::map< std::string, int > m_name_to_edges_num
 Map edge name <=> num of edges. More...
 
int m_num_loop_closures
 
int m_unique_edges
 
std::map< std::string, double > m_name_to_offset_y
 
std::map< std::string, int > m_name_to_text_index
 
bool m_has_read_textmessage_params
 
bool m_display_total_edges
 
bool m_display_loop_closures
 
int m_offset_y_total_edges
 
int m_offset_y_loop_closures
 
int m_text_index_total_edges
 
int m_text_index_loop_closures
 

Member Typedef Documentation

◆ const_iterator

Definition at line 39 of file CEdgeCounter.h.

◆ iterator

Definition at line 38 of file CEdgeCounter.h.

Constructor & Destructor Documentation

◆ CEdgeCounter()

CEdgeCounter::CEdgeCounter ( )

Constructor class.

Definition at line 16 of file CEdgeCounter.cpp.

References initCEdgeCounter().

Here is the call graph for this function:

◆ ~CEdgeCounter()

CEdgeCounter::~CEdgeCounter ( )

Destructor class.

Definition at line 17 of file CEdgeCounter.cpp.

Member Function Documentation

◆ addEdge()

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

Increment the number of edges for the specified type.

Exceptions
std::exceptionIf edge exists and is_new is True
See also
setEdgesManually

Definition at line 134 of file CEdgeCounter.cpp.

References mrpt::mrpt::format(), m_has_read_textmessage_params, m_name_to_edges_num, m_num_loop_closures, m_win_manager, THROW_EXCEPTION, and updateTextMessages().

Here is the call graph for this function:

◆ addEdgeType()

void CEdgeCounter::addEdgeType ( const std::string name)

Explicitly register a new edge type.

Definition at line 191 of file CEdgeCounter.cpp.

References mrpt::mrpt::format(), m_name_to_edges_num, and THROW_EXCEPTION.

Here is the call graph for this function:

◆ begin() [1/2]

iterator mrpt::graphslam::detail::CEdgeCounter::begin ( )
inline

Instance Iterators.

Definition at line 147 of file CEdgeCounter.h.

References m_name_to_edges_num.

◆ begin() [2/2]

const_iterator mrpt::graphslam::detail::CEdgeCounter::begin ( ) const
inline

Definition at line 148 of file CEdgeCounter.h.

References m_name_to_edges_num.

◆ clearAllEdges()

void CEdgeCounter::clearAllEdges ( )

Reset the state of the CEdgeCounter instance.

Definition at line 208 of file CEdgeCounter.cpp.

References m_display_loop_closures, m_display_total_edges, m_has_read_textmessage_params, m_name_to_edges_num, m_name_to_offset_y, m_name_to_text_index, and m_num_loop_closures.

Referenced by initCEdgeCounter().

Here is the caller graph for this function:

◆ dumpToConsole()

void CEdgeCounter::dumpToConsole ( ) const

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

See also
getAsString

Definition at line 221 of file CEdgeCounter.cpp.

References getAsString().

Here is the call graph for this function:

◆ end() [1/2]

iterator mrpt::graphslam::detail::CEdgeCounter::end ( )
inline

Definition at line 149 of file CEdgeCounter.h.

References m_name_to_edges_num.

◆ end() [2/2]

const_iterator mrpt::graphslam::detail::CEdgeCounter::end ( ) const
inline

Definition at line 150 of file CEdgeCounter.h.

References m_name_to_edges_num.

◆ getAsString() [1/2]

void CEdgeCounter::getAsString ( std::string str_out) const

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

Definition at line 227 of file CEdgeCounter.cpp.

References getLoopClosureEdges(), getTotalNumOfEdges(), m_name_to_edges_num, and m_unique_edges.

Here is the call graph for this function:

◆ getAsString() [2/2]

std::string CEdgeCounter::getAsString ( ) const

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

Definition at line 253 of file CEdgeCounter.cpp.

Referenced by dumpToConsole().

Here is the caller graph for this function:

◆ getLoopClosureEdges()

int CEdgeCounter::getLoopClosureEdges ( ) const

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

Definition at line 62 of file CEdgeCounter.cpp.

References m_num_loop_closures.

Referenced by getAsString().

Here is the caller graph for this function:

◆ getNumForEdgeType() [1/2]

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

Return the number of edges for the specified type.

Exceptions
std::exceptionIf edge is not found
See also
getTotalNumOfEdges

Definition at line 85 of file CEdgeCounter.cpp.

References m_name_to_edges_num, and THROW_EXCEPTION.

◆ getNumForEdgeType() [2/2]

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

Return the number of edges for the specified type.

Exceptions
std::exceptionIf edge is not found
See also
getTotalNumOfEdges

Definition at line 99 of file CEdgeCounter.cpp.

References m_name_to_edges_num, and THROW_EXCEPTION.

◆ getTotalNumOfEdges() [1/2]

int CEdgeCounter::getTotalNumOfEdges ( ) const

Return the total amount of registered edges.

See also
getNumForEdgeType, getLoopClosureEdges

Definition at line 63 of file CEdgeCounter.cpp.

References getTotalNumOfEdges(), and mrpt::math::sum().

Referenced by getAsString(), getTotalNumOfEdges(), setRemovedEdges(), and updateTextMessages().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTotalNumOfEdges() [2/2]

void CEdgeCounter::getTotalNumOfEdges ( int *  total_num_edges) const

Return the total amount of registered edges.

See also
getNumForEdgeType, getLoopClosureEdges

Definition at line 71 of file CEdgeCounter.cpp.

References ASSERT_, m_name_to_edges_num, and mrpt::math::sum().

Here is the call graph for this function:

◆ initCEdgeCounter()

void CEdgeCounter::initCEdgeCounter ( )
private

Initialization method to be called from the various Constructors.

Definition at line 18 of file CEdgeCounter.cpp.

References clearAllEdges(), m_display_loop_closures, m_display_total_edges, m_has_read_textmessage_params, m_offset_y_loop_closures, m_offset_y_total_edges, m_text_index_loop_closures, m_text_index_total_edges, m_unique_edges, m_win, and m_win_manager.

Referenced by CEdgeCounter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setEdgesManually()

void CEdgeCounter::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

Definition at line 113 of file CEdgeCounter.cpp.

References m_has_read_textmessage_params, m_name_to_edges_num, m_win_manager, THROW_EXCEPTION, and updateTextMessages().

Here is the call graph for this function:

◆ setLoopClosureEdgesManually()

void CEdgeCounter::setLoopClosureEdgesManually ( int  num_loop_closures)

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

Definition at line 57 of file CEdgeCounter.cpp.

References m_num_loop_closures.

◆ setRemovedEdges()

void CEdgeCounter::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.

Definition at line 52 of file CEdgeCounter.cpp.

References getTotalNumOfEdges(), and m_unique_edges.

Here is the call graph for this function:

◆ setTextMessageParams() [1/2]

void CEdgeCounter::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.

Exceptions
std::exceptionIf a name in the provided std::map doesn't already exist

Definition at line 263 of file CEdgeCounter.cpp.

References ASSERT_EQUAL_, ASSERTMSG_, m_has_read_textmessage_params, m_name_to_edges_num, m_name_to_offset_y, m_name_to_text_index, m_win_manager, and THROW_EXCEPTION.

Referenced by setTextMessageParams().

Here is the caller graph for this function:

◆ setTextMessageParams() [2/2]

void CEdgeCounter::setTextMessageParams ( const std::map< std::string, double > &  name_to_offset_y,
const std::map< std::string, int > &  name_to_text_index,
const double &  offset_y_total_edges,
const int &  text_index_total_edges,
const double &  offset_y_loop_closures,
const 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.

Definition at line 301 of file CEdgeCounter.cpp.

References m_display_loop_closures, m_display_total_edges, m_offset_y_loop_closures, m_offset_y_total_edges, m_text_index_loop_closures, m_text_index_total_edges, and setTextMessageParams().

Here is the call graph for this function:

◆ setWindowManagerPtr()

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

Provide the instance with a CWindowManager.

Definition at line 39 of file CEdgeCounter.cpp.

References ASSERT_, m_win, m_win_manager, MRPT_END, MRPT_START, and mrpt::graphslam::CWindowManager::win.

◆ updateTextMessages()

void CEdgeCounter::updateTextMessages ( ) const
private

Member Data Documentation

◆ m_display_loop_closures

bool mrpt::graphslam::detail::CEdgeCounter::m_display_loop_closures
private

◆ m_display_total_edges

bool mrpt::graphslam::detail::CEdgeCounter::m_display_total_edges
private

◆ m_has_read_textmessage_params

bool mrpt::graphslam::detail::CEdgeCounter::m_has_read_textmessage_params
private

◆ m_name_to_edges_num

std::map<std::string, int> mrpt::graphslam::detail::CEdgeCounter::m_name_to_edges_num
private

Map edge name <=> num of edges.

Tracking number of edges

Definition at line 167 of file CEdgeCounter.h.

Referenced by addEdge(), addEdgeType(), begin(), clearAllEdges(), end(), getAsString(), getNumForEdgeType(), getTotalNumOfEdges(), setEdgesManually(), setTextMessageParams(), and updateTextMessages().

◆ m_name_to_offset_y

std::map<std::string, double> mrpt::graphslam::detail::CEdgeCounter::m_name_to_offset_y
private

Definition at line 172 of file CEdgeCounter.h.

Referenced by clearAllEdges(), setTextMessageParams(), and updateTextMessages().

◆ m_name_to_text_index

std::map<std::string, int> mrpt::graphslam::detail::CEdgeCounter::m_name_to_text_index
private

Definition at line 173 of file CEdgeCounter.h.

Referenced by clearAllEdges(), setTextMessageParams(), and updateTextMessages().

◆ m_num_loop_closures

int mrpt::graphslam::detail::CEdgeCounter::m_num_loop_closures
private

◆ m_offset_y_loop_closures

int mrpt::graphslam::detail::CEdgeCounter::m_offset_y_loop_closures
private

Definition at line 180 of file CEdgeCounter.h.

Referenced by initCEdgeCounter(), setTextMessageParams(), and updateTextMessages().

◆ m_offset_y_total_edges

int mrpt::graphslam::detail::CEdgeCounter::m_offset_y_total_edges
private

Definition at line 180 of file CEdgeCounter.h.

Referenced by initCEdgeCounter(), setTextMessageParams(), and updateTextMessages().

◆ m_text_index_loop_closures

int mrpt::graphslam::detail::CEdgeCounter::m_text_index_loop_closures
private

Definition at line 181 of file CEdgeCounter.h.

Referenced by initCEdgeCounter(), setTextMessageParams(), and updateTextMessages().

◆ m_text_index_total_edges

int mrpt::graphslam::detail::CEdgeCounter::m_text_index_total_edges
private

Definition at line 181 of file CEdgeCounter.h.

Referenced by initCEdgeCounter(), setTextMessageParams(), and updateTextMessages().

◆ m_unique_edges

int mrpt::graphslam::detail::CEdgeCounter::m_unique_edges
private

Definition at line 169 of file CEdgeCounter.h.

Referenced by getAsString(), initCEdgeCounter(), and setRemovedEdges().

◆ m_win

mrpt::gui::CDisplayWindow3D* mrpt::graphslam::detail::CEdgeCounter::m_win
private

Definition at line 160 of file CEdgeCounter.h.

Referenced by initCEdgeCounter(), setWindowManagerPtr(), and updateTextMessages().

◆ m_win_manager

mrpt::graphslam::CWindowManager* mrpt::graphslam::detail::CEdgeCounter::m_win_manager
private



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019