Belle II Software  release-08-01-10
Board.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 TRGBoard_FLAG_
10 #define TRGBoard_FLAG_
11 
12 #include <string>
13 #include <vector>
14 
15 namespace Belle2 {
21  class TRGClock;
22  class TRGChannel;
23 
25  class TRGBoard {
26 
27  public:
28 
30  TRGBoard(const std::string& name,
31  const TRGClock& systemClock,
32  const TRGClock& dataClock,
33  const TRGClock& userClockInput,
34  const TRGClock& userClockOutput);
35 
37  virtual ~TRGBoard();
38 
39  public:// Selectors.
40 
42  const std::string& name(void) const;
43 
45  const TRGClock& clockSystem(void) const;
46 
48  const TRGClock& clockData(void) const;
49 
51  const TRGClock& clockUserInput(void) const;
52 
54  const TRGClock& clockUserOutput(void) const;
55 
57  unsigned nInput(void) const;
58 
60  const TRGChannel* input(unsigned i) const;
61 
63  unsigned nOutput(void) const;
64 
66  TRGChannel* output(unsigned i) const;
67 
70  void dump(const std::string& message = "",
71  const std::string& pre = "") const;
72 
73  public:// Modifiers
74 
76  void appendInput(const TRGChannel*);
77 
79  void appendOutput(TRGChannel*);
80 
81  private:
82 
84  const std::string _name;
85 
88 
91 
94 
97 
99  std::vector<const TRGChannel*> _inputChannels;
100 
102  std::vector<TRGChannel*> _outputChannels;
103  };
104 
105 //-----------------------------------------------------------------------------
106 
107  inline
108  const std::string&
109  TRGBoard::name(void) const
110  {
111  return _name;
112  }
113 
114  inline
115  const TRGClock&
117  {
118  return * _clockSystem;
119  }
120 
121  inline
122  const TRGClock&
124  {
125  return * _clockData;
126  }
127 
128  inline
129  const TRGClock&
131  {
132  return * _clockUserInput;
133  }
134 
135  inline
136  const TRGClock&
138  {
139  return * _clockUserOutput;
140  }
141 
142  inline
143  void
145  {
146  _inputChannels.push_back(a);
147  }
148 
149  inline
150  void
152  {
153  _outputChannels.push_back(a);
154  }
155 
156  inline
157  const TRGChannel*
158  TRGBoard::input(unsigned a) const
159  {
160  return _inputChannels[a];
161  }
162 
163  inline
164  TRGChannel*
165  TRGBoard::output(unsigned a) const
166  {
167  return _outputChannels[a];
168  }
169 
170  inline
171  unsigned
172  TRGBoard::nInput(void) const
173  {
174  return _inputChannels.size();
175  }
176 
177 
178  inline
179  unsigned
180  TRGBoard::nOutput(void) const
181  {
182  return _outputChannels.size();
183  }
184 
185 
187 } // namespace Belle2
188 
189 #endif /* TRGBoard_FLAG_ */
A class to represent a trigger board.
Definition: Board.h:25
const TRGClock * _clockData
Data clock.
Definition: Board.h:90
const TRGClock * _clockUserInput
User clock.
Definition: Board.h:93
const std::string _name
Name of a board.
Definition: Board.h:84
std::vector< const TRGChannel * > _inputChannels
Input Aurora channel.
Definition: Board.h:99
const TRGClock * _clockSystem
System clock.
Definition: Board.h:87
std::vector< TRGChannel * > _outputChannels
Output Aurora channel.
Definition: Board.h:102
const TRGClock * _clockUserOutput
User clock.
Definition: Board.h:96
A class to represent a serial link between trigger hardware modules.
Definition: Channel.h:24
A class to represent a digitized signal. Unit is nano second.
Definition: Clock.h:38
const TRGClock & clockUserOutput(void) const
returns Aurora user clock for output.
Definition: Board.h:137
const TRGChannel * input(unsigned i) const
returns input channel i.
Definition: Board.h:158
void appendInput(const TRGChannel *)
appends an input Aurora channel.
Definition: Board.h:144
const TRGClock & clockUserInput(void) const
returns Aurora user clock for input.
Definition: Board.h:130
const TRGClock & clockData(void) const
returns data clock.
Definition: Board.h:123
virtual ~TRGBoard()
Destructor.
Definition: Board.cc:37
const std::string & name(void) const
returns name.
Definition: Board.h:109
unsigned nInput(void) const
returns input channels.
Definition: Board.h:172
TRGBoard(const std::string &name, const TRGClock &systemClock, const TRGClock &dataClock, const TRGClock &userClockInput, const TRGClock &userClockOutput)
Constructor.
Definition: Board.cc:22
void appendOutput(TRGChannel *)
appends an output Aurora channel.
Definition: Board.h:151
const TRGClock & clockSystem(void) const
returns system clock.
Definition: Board.h:116
unsigned nOutput(void) const
returns output channels.
Definition: Board.h:180
TRGChannel * output(unsigned i) const
returns output channel i.
Definition: Board.h:165
void dump(const std::string &message="", const std::string &pre="") const
dumps contents.
Definition: Board.cc:42
Abstract base class for different kinds of events.