NAGASH 0.9.8
Next Generation Analysis System
Loading...
Searching...
No Matches
Public Member Functions | List of all members
NAGASH::MapTool Class Reference

Helper functions for std::map. More...

#include "NAGASH/MapTool.h"

Inheritance diagram for NAGASH::MapTool:
NAGASH::Tool

Public Member Functions

 MapTool (std::shared_ptr< MSGTool > MSG)
 Constructor.
 
unsigned int EditDistance (const std::string &s1, const std::string &s2) const
 Calculate the edit distance between two strings.
 
unsigned int EditDistance (const TString &s1, const TString &s2) const
 Calculate the edit distance between two strings.
 
template<typename T >
std::map< std::string, T >::iterator FindMostSimilar (std::map< std::string, T > &mymap, const std::string &key)
 Find value to the most similar key in a map.
 
template<typename T >
std::map< TString, T >::iterator FindMostSimilar (std::map< TString, T > &mymap, const TString &key)
 Find value to the most similar key in a map.
 
template<typename T1 , typename T2 >
std::vector< T1 > GetListOfKeys (const std::map< T1, T2 > &inputmap) const
 Get the vector of keys in a map.
 
template<typename T1 , typename T2 >
std::vector< T2 > GetListOfValues (const std::map< T1, T2 > &inputmap) const
 Get the vector of values in a map.
 

Additional Inherited Members

- Protected Member Functions inherited from NAGASH::Tool
 Tool ()=delete
 
 Tool (const Tool &tool)=delete
 
 Tool (std::shared_ptr< MSGTool > MSG)
 Constructor.
 
 Tool (Tool &&tool)=delete
 
virtual ~Tool ()=default
 
std::shared_ptr< MSGToolMSGUser ()
 return the MSGTool inside.
 
Tooloperator= (const Tool &tool)=delete
 
Tooloperator= (Tool &&tool)=delete
 

Detailed Description

Helper functions for std::map.

Definition at line 16 of file MapTool.h.

Constructor & Destructor Documentation

◆ MapTool()

NAGASH::MapTool::MapTool ( std::shared_ptr< MSGTool MSG)
inline

Constructor.

Definition at line 20 of file MapTool.h.

Member Function Documentation

◆ EditDistance() [1/2]

unsigned int MapTool::EditDistance ( const std::string &  s1,
const std::string &  s2 
) const

Calculate the edit distance between two strings.

Definition at line 29 of file MapTool.cxx.

◆ EditDistance() [2/2]

unsigned int MapTool::EditDistance ( const TString &  s1,
const TString &  s2 
) const

Calculate the edit distance between two strings.

Definition at line 11 of file MapTool.cxx.

◆ FindMostSimilar() [1/2]

template<typename T >
std::map< std::string, T >::iterator NAGASH::MapTool::FindMostSimilar ( std::map< std::string, T > &  mymap,
const std::string &  key 
)
inline

Find value to the most similar key in a map.

Template Parameters
Ttype of the value of the map.
Parameters
mymapthe input map.
keythe key to be searched.
Returns
if the key exists in the map, return the iterator pointing to the key, otherwise return value to the most similar key in the map. The similarity is calculated by the EditDistance function.

Definition at line 91 of file MapTool.h.

◆ FindMostSimilar() [2/2]

template<typename T >
std::map< TString, T >::iterator NAGASH::MapTool::FindMostSimilar ( std::map< TString, T > &  mymap,
const TString &  key 
)
inline

Find value to the most similar key in a map.

Template Parameters
Ttype of the value of the map.
Parameters
mymapthe input map.
keythe key to be searched.
Returns
if the key exists in the map, return the iterator pointing to the key, otherwise return value to the most similar key in the map. The similarity is calculated by the EditDistance function.

Definition at line 43 of file MapTool.h.

◆ GetListOfKeys()

template<typename T1 , typename T2 >
std::vector< T1 > NAGASH::MapTool::GetListOfKeys ( const std::map< T1, T2 > &  inputmap) const
inline

Get the vector of keys in a map.

Definition at line 135 of file MapTool.h.

◆ GetListOfValues()

template<typename T1 , typename T2 >
std::vector< T2 > NAGASH::MapTool::GetListOfValues ( const std::map< T1, T2 > &  inputmap) const
inline

Get the vector of values in a map.

Definition at line 145 of file MapTool.h.


The documentation for this class was generated from the following files: