Belle II Software development
WithWeight< T > Class Template Reference

A mixin class to attach a weight to an object. More...

#include <WithWeight.h>

Inheritance diagram for WithWeight< T >:

Public Member Functions

 WithWeight (const T &t)
 Also forward the copy constructor form the base class object.
 
 WithWeight (const T &t, Weight weight)
 Constructor which may also initialise the weight to a desired value.
 
bool operator< (const WithWeight< T > &other) const
 Comparison operator establishing an ordering considering the pointer first and the weight second.
 
Weight getWeight () const
 Getter for the weight.
 
void setWeight (Weight weight)
 Setter for the weight of the object.
 
Weight & weight ()
 Mutable getter for the weight.
 

Private Types

using Super = ScalarToClass< T >
 Type of the base class.
 

Private Attributes

Weight m_weight = 0
 Memory for the weight.
 

Detailed Description

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

A mixin class to attach a weight to an object.

Definition at line 24 of file WithWeight.h.

Member Typedef Documentation

◆ Super

using Super = ScalarToClass<T>
private

Type of the base class.

Definition at line 28 of file WithWeight.h.

Constructor & Destructor Documentation

◆ WithWeight() [1/2]

WithWeight ( const T &  t)
inlineexplicit

Also forward the copy constructor form the base class object.

Definition at line 35 of file WithWeight.h.

36 : Super(t)
37 {
38 }
ScalarToClass< T > Super
Type of the base class.
Definition: WithWeight.h:28

◆ WithWeight() [2/2]

WithWeight ( const T &  t,
Weight  weight 
)
inline

Constructor which may also initialise the weight to a desired value.

Definition at line 41 of file WithWeight.h.

42 : Super(t)
44 {
45 }
Weight & weight()
Mutable getter for the weight.
Definition: WithWeight.h:70
Weight m_weight
Memory for the weight.
Definition: WithWeight.h:77

Member Function Documentation

◆ getWeight()

Weight getWeight ( ) const
inline

Getter for the weight.

Definition at line 58 of file WithWeight.h.

59 {
60 return m_weight;
61 }

◆ operator<()

bool operator< ( const WithWeight< T > &  other) const
inline

Comparison operator establishing an ordering considering the pointer first and the weight second.

Definition at line 48 of file WithWeight.h.

49 {
50 // cppcheck-suppress constVariable
51 const T& t(*this);
52 // cppcheck-suppress constVariable
53 const T& otherT(other);
54 return t < otherT or (not(otherT < t) and getWeight() < other.getWeight());
55 }
Weight getWeight() const
Getter for the weight.
Definition: WithWeight.h:58

◆ setWeight()

void setWeight ( Weight  weight)
inline

Setter for the weight of the object.

Definition at line 64 of file WithWeight.h.

65 {
67 }

◆ weight()

Weight & weight ( )
inline

Mutable getter for the weight.

Definition at line 70 of file WithWeight.h.

71 {
72 return m_weight;
73 }

Member Data Documentation

◆ m_weight

Weight m_weight = 0
private

Memory for the weight.

Definition at line 77 of file WithWeight.h.


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