Belle II Software  release-08-01-10
SignalVector.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 
9 #ifndef TRGSignalVector_FLAG_
10 #define TRGSignalVector_FLAG_
11 
12 #include <vector>
13 
14 namespace Belle2 {
20  class TRGSignal;
21  class TRGState;
22  class TRGClock;
23 
26  class TRGSignalVector : public std::vector<TRGSignal> {
27 
28  public:
29 
31 // TRGSignalVector(const TRGClock & = Belle2_GDL::GDLSystemClock);
32 
34  TRGSignalVector(const std::string& name,
35 // const TRGClock & = Belle2_GDL::GDLSystemClock,
36  const TRGClock&,
37  unsigned size = 0);
38 
40  explicit TRGSignalVector(const TRGSignalVector&);
41 
43  explicit TRGSignalVector(const TRGSignal&);
44 
46  virtual ~TRGSignalVector();
47 
48  public:// Selectors
49 
51  const std::string& name(void) const;
52 
54  const std::string& name(const std::string& newName);
55 
57  const TRGClock& clock(void) const;
58 
60  bool active(void) const;
61 
63  bool active(int clockPosition) const;
64 
66  std::vector<int> stateChanges(void) const;
67 
69  TRGState state(int clockPosition) const;
70 
73  void dump(const std::string& message = "",
74  const std::string& pre = "") const;
75 
76  public:// Modifiers
77 
79  const TRGSignalVector& set(const TRGState&, int clockPosition);
80 
81  public:// Operators
82 
84  const TRGClock& clock(const TRGClock&);
85 
88 
91 
93  bool operator==(const TRGSignalVector&) const;
94 
96  bool operator!=(const TRGSignalVector&) const;
97 
98  private:
99 
101  std::string _name;
102 
104  const TRGClock* _clock;
105  };
106 
107 //-----------------------------------------------------------------------------
108 
109  inline
110  const std::string&
112  {
113  return _name;
114  }
115 
116  inline
117  const std::string&
118  TRGSignalVector::name(const std::string& newName)
119  {
120  return _name = newName;
121  }
122 
123  inline
124  const TRGClock&
126  {
127  return * _clock;
128  }
129 
130  inline
131  bool
133  {
134  return (! operator==(a));
135  }
136 
138 } // namespace Belle2
139 
140 #endif /* TRGSignalVector_FLAG_ */
A class to represent a digitized signal. Unit is nano second.
Definition: Clock.h:38
A class to represent a bundle of digitized signals.
Definition: SignalVector.h:26
const TRGClock * _clock
Clock.
Definition: SignalVector.h:104
std::string _name
Name.
Definition: SignalVector.h:101
A class to represent a digitized signal. Unit is nano second.
Definition: Signal.h:23
A class to represent a state of multi bits.
Definition: State.h:24
const TRGSignalVector & set(const TRGState &, int clockPosition)
sets state at given clock.
TRGState state(int clockPosition) const
returns state at given clock position.
TRGSignalVector & operator+=(const TRGSignal &)
appends TRGSignal.
Definition: SignalVector.cc:96
const TRGClock & clock(void) const
returns clock.
Definition: SignalVector.h:125
const std::string & name(void) const
returns name.
Definition: SignalVector.h:111
std::vector< int > stateChanges(void) const
returns a list of clock position of state change.
virtual ~TRGSignalVector()
Destructor.
Definition: SignalVector.cc:59
bool operator==(const TRGSignalVector &) const
compare two TRGSignalVectors.
bool operator!=(const TRGSignalVector &) const
compare two TRGSignalVectors.
Definition: SignalVector.h:132
bool active(void) const
returns true if there is a signal.
TRGSignalVector(const std::string &name, const TRGClock &, unsigned size=0)
Default constructor.
Definition: SignalVector.cc:29
void dump(const std::string &message="", const std::string &pre="") const
dumps contents.
Definition: SignalVector.cc:64
Abstract base class for different kinds of events.