Belle II Software  release-08-01-10
WithSharedMark.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 #include <tracking/trackFindingCDC/utilities/Scalar.h>
11 
12 namespace Belle2 {
17  namespace TrackFindingCDC {
18 
20  template<class T>
21  class WithSharedMark : public ScalarToClass<T> {
22  private:
24  using Super = ScalarToClass<T>;
25 
26  public:
28  WithSharedMark(const T& obj, bool* isMarked)
29  : Super(obj)
31  {
32  }
33 
35  bool isMarked() const
36  {
37  return *m_isMarked;
38  }
39 
41  void mark(bool mark = true)
42  {
43  *m_isMarked = mark;
44  }
45 
47  void unmark()
48  {
49  *m_isMarked = false;
50  }
51 
52  private:
54  bool* m_isMarked;
55  };
56  }
58 }
Mixin class to attach a mark that is shared among many instances.
WithSharedMark(const T &obj, bool *isMarked)
Mixin class Wraps an object including r the mark is provided from a shared position.
ScalarToClass< T > Super
Base class of the mixin.
bool * m_isMarked
Reference to the shared marks.
bool isMarked() const
Check if the object has been marked.
void mark(bool mark=true)
Mark this object.
void unmark()
Unmark this object.
Abstract base class for different kinds of events.