Belle II Software  release-08-01-10
SignalBundle.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 TRGSignalBundle_FLAG_
10 #define TRGSignalBundle_FLAG_
11 
12 #include <vector>
13 #include "trg/trg/Clock.h"
14 
15 namespace Belle2 {
21  class TRGSignal;
22  class TRGSignalVector;
23  class TRGState;
24 
26  class TRGSignalBundle : public std::vector<TRGSignalVector*> {
27 
28  public:
29 
31 // TRGSignalBundle(const TRGClock & = Belle2_GDL::GDLSystemClock);
32  explicit TRGSignalBundle(const TRGClock&);
33 
35  TRGSignalBundle(const std::string& name,
36 // const TRGClock & = Belle2_GDL::GDLSystemClock);
37  const TRGClock&);
38 
40  TRGSignalBundle(const std::string& name,
41  const TRGClock& clock,
42  const TRGSignalBundle& input,
43  const unsigned outputBitSize,
44  TRGState(* packer)(const TRGState&));
45 
47  TRGSignalBundle(const std::string& name,
48  const TRGClock& clock,
49  const TRGSignalBundle& input,
50  const unsigned outputBitSize,
51  const unsigned registerBitSize,
52  TRGState(* packer)(const TRGState& in,
53  TRGState& registers,
54  bool& logicStillActive));
55 
57  virtual ~TRGSignalBundle();
58 
59  public:// Selectors
60 
62  const std::string& name(void) const;
63 
65  const std::string& name(const std::string& newName);
66 
68  const TRGClock& clock(void) const;
69 
71  bool active(void) const;
72 
74  std::vector<int> stateChanges(void) const;
75 
77  TRGState state(int clockPosition) const;
78 
80  TRGSignal ored(void) const;
81 
84  void dump(const std::string& message = "",
85  const std::string& pre = "") const;
86 
88  void dumpCOE(const std::string& fileName = "",
89  int start = 0,
90  int stop = 0) const;
91 
92  public:// Operators
93 
95  const TRGClock& clock(const TRGClock&);
96 
98  void readCOE(const std::string& fileName = "");
99 
100  private:
101 
103  std::string _name;
104 
106  const TRGClock* _clock;
107  };
108 
109 //-----------------------------------------------------------------------------
110 
111  inline
112  const std::string&
114  {
115  return _name;
116  }
117 
118  inline
119  const std::string&
120  TRGSignalBundle::name(const std::string& newName)
121  {
122  return _name = newName;
123  }
124 
125  inline
126  const TRGClock&
128  {
129  return * _clock;
130  }
131 
133 } // namespace Belle2
134 
135 #endif /* TRGSignalBundle_FLAG_ */
A class to represent a digitized signal. Unit is nano second.
Definition: Clock.h:38
A class to represent a bundle of SignalVectors.
Definition: SignalBundle.h:26
void readCOE(const std::string &fileName="")
reads data from a file.
const TRGClock * _clock
Clock.
Definition: SignalBundle.h:106
std::string _name
Name.
Definition: SignalBundle.h:103
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
virtual ~TRGSignalBundle()
Destructor.
TRGState state(int clockPosition) const
returns state at given clock position.
const TRGClock & clock(void) const
returns clock.
Definition: SignalBundle.h:127
const std::string & name(void) const
returns name.
Definition: SignalBundle.h:113
std::vector< int > stateChanges(void) const
returns a list of clock position of state change.
TRGSignalBundle(const TRGClock &)
Default constructor.
Definition: SignalBundle.cc:32
TRGSignal ored(void) const
returns signal of all ORed.
bool active(void) const
returns true if there is a signal.
void dumpCOE(const std::string &fileName="", int start=0, int stop=0) const
makes coe output.
void dump(const std::string &message="", const std::string &pre="") const
dumps contents.
Abstract base class for different kinds of events.