Belle II Software development
RelationArray::ReplaceMap< MapType > Class Template Reference

Struct to replace indices based on a map-like container. More...

#include <RelationArray.h>

Public Member Functions

 ReplaceMap (MapType &replace)
 Set reference to used replacement map.
 
consolidation_type operator() (index_type old) const
 Take old index and return the new index.
 

Private Attributes

MapType & m_replace
 Reference of the used replacement map.
 

Detailed Description

template<class MapType = std::map<index_type, consolidation_type>>
class Belle2::RelationArray::ReplaceMap< MapType >

Struct to replace indices based on a map-like container.

Will keep old index if no replacement can be found

See also
consolidate

Definition at line 104 of file RelationArray.h.

Constructor & Destructor Documentation

◆ ReplaceMap()

ReplaceMap ( MapType &  replace)
inlineexplicit

Set reference to used replacement map.

Definition at line 108 of file RelationArray.h.

108: m_replace(replace) {}
MapType & m_replace
Reference of the used replacement map.

Member Function Documentation

◆ operator()()

consolidation_type operator() ( index_type  old) const
inline

Take old index and return the new index.

Definition at line 111 of file RelationArray.h.

112 {
113 typename MapType::const_iterator iter = m_replace.find(old);
114 if (iter != m_replace.end()) {
115 return iter->second;
116 }
117 return std::make_pair(old, false);
118 }

Member Data Documentation

◆ m_replace

MapType& m_replace
private

Reference of the used replacement map.

Definition at line 123 of file RelationArray.h.


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