Belle II Software development
CycleMapping< T > Class Template Reference

Realizing a mapping from a pool of values to be cycled from the index. More...

#include <Mapping.h>

Inheritance diagram for CycleMapping< T >:
Mapping< T >

Public Member Functions

 CycleMapping (const std::vector< std::string > &values)
 Constructor receiving the values to be cycled.
 
std::string map (int index, T &t) override
 Return a value from the cycle value according to the given index.
 
std::string info () override
 Informal string summarizing the translation from the object to the attribute value.
 

Private Attributes

std::vector< std::string > m_values
 Memory for the attribute values to be cycled.
 

Detailed Description

template<class T>
class Belle2::TrackFindingCDC::CycleMapping< T >

Realizing a mapping from a pool of values to be cycled from the index.

Definition at line 73 of file Mapping.h.

Constructor & Destructor Documentation

◆ CycleMapping()

CycleMapping ( const std::vector< std::string > &  values)
inlineexplicit

Constructor receiving the values to be cycled.

Definition at line 77 of file Mapping.h.

78 : m_values(values)
79 {
80 }
std::vector< std::string > m_values
Memory for the attribute values to be cycled.
Definition: Mapping.h:97

Member Function Documentation

◆ info()

std::string info ( )
inlineoverridevirtual

Informal string summarizing the translation from the object to the attribute value.

Reimplemented from Mapping< T >.

Definition at line 90 of file Mapping.h.

91 {
92 return "Cycle through " + bracketed(join(", ", m_values)) + "\n";
93 }

◆ map()

std::string map ( int  index,
T &  t 
)
inlineoverridevirtual

Return a value from the cycle value according to the given index.

Reimplemented from Mapping< T >.

Definition at line 83 of file Mapping.h.

84 {
85 assert(index >= 0);
86 return m_values[index % m_values.size()];
87 }

Member Data Documentation

◆ m_values

std::vector<std::string> m_values
private

Memory for the attribute values to be cycled.

Definition at line 97 of file Mapping.h.


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