Belle II Software  release-08-01-10
FixedSizeNamedFloatTuple< ANames > Class Template Reference

Generic class that contains a fixed number of named float values. More...

#include <FixedSizeNamedFloatTuple.h>

Inheritance diagram for FixedSizeNamedFloatTuple< ANames >:
Collaboration diagram for FixedSizeNamedFloatTuple< ANames >:

Public Member Functions

size_t size () const final
 Getter for number of floating point values represented by this class.
 
int getNameIndex (const char *name) const final
 Getter for the index from a name. More...
 
std::string getName (int iValue) const final
 Getter for the ith name.
 
template<int I>
void set (Float_t value)
 Setter for the ith values. Static index version.
 
void set (int iValue, Float_t value) final
 Setter for the ith value.
 
void set (const char *name, Float_t value)
 Setter for the value with the given name.
 
template<int I>
Float_t get () const
 Getter for the ith value. Static index version.
 
Float_t get (int iValue) const final
 Getter for the ith value.
 
Float_t get (const char *name) const
 Getter for the value with the given name.
 
template<int I>
Float_t & var ()
 Reference getter for the ith value. Static index version.
 
Float_t & operator[] (int iValue) final
 Reference getter for the ith value.
 
Float_t & operator[] (const char *name)
 Reference getter for the value with the given name.
 
virtual MayBePtr< Float_t > find (std::string name)
 Getter for a pointer to the value with the given name. More...
 
std::map< std::string, Float_t > getNamedValues (std::string prefix="") const
 Getter for a map of all name and value pairs in this tuple.
 
std::vector< Named< Float_t * > > getNamedVariables (std::string prefix="")
 Getter for named references to the variables in this tuple.
 

Public Attributes

Float_t m_values [nVars] = {}
 Memory for nVars floating point values.
 

Static Protected Member Functions

constexpr static int named (const char *name)
 Static getter for the index from the name. More...
 

Static Private Attributes

static const size_t nVars = ANames::nVars
 Number of floating point values represented by this class.
 

Detailed Description

template<class ANames>
class Belle2::TrackFindingCDC::FixedSizeNamedFloatTuple< ANames >

Generic class that contains a fixed number of named float values.

This object template provides the memory and the names of the float values.

Template Parameters
ANamesClass with two contained parameters:
  • nVars : Number of parts that will be peeled from the complex object.
  • names : Array of names which contain the nVars names of the float values.

Definition at line 98 of file FixedSizeNamedFloatTuple.h.

Member Function Documentation

◆ find()

virtual MayBePtr<Float_t> find ( std::string  name)
inlinevirtualinherited

Getter for a pointer to the value with the given name.

Return nullptr if not found.

Definition at line 71 of file NamedFloatTuple.h.

72  {
73  size_t nameindex = getNameIndex(name.c_str());
74  return (nameindex < size()) ? &(operator[](nameindex)) : nullptr;
75  }
virtual int getNameIndex(const char *name) const =0
Getter for the index from a name.
virtual Float_t & operator[](int iValue)=0
Reference getter for the value of the ith part.
virtual size_t size() const =0
Getter for the number of parts.

◆ getNameIndex()

int getNameIndex ( const char *  name) const
inlinefinalvirtual

Getter for the index from a name.

Looks through the associated names and returns the right index if found. Returns size() (one after the last element) if not found.

Parameters
nameName of the sought part
Returns
Index of the name, nParts if not found.

Implements NamedFloatTuple.

Definition at line 135 of file FixedSizeNamedFloatTuple.h.

136  {
137  return named(name);
138  }
constexpr static int named(const char *name)
Static getter for the index from the name.

◆ named()

constexpr static int named ( const char *  name)
inlinestaticconstexprprotected

Static getter for the index from the name.

Looks through the associated names and returns the right index if found Returns nVars (one after the last element) if not found.

Short hand named spells nice in implementation code.

Parameters
nameThe sough name.
Returns
Index of the name, nVars if not found.

Definition at line 115 of file FixedSizeNamedFloatTuple.h.


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