otsdaq_components  v2_04_01
FirmwareSequence.h
1 #ifndef _ots_FirmwareSequence_h
2 #define _ots_FirmwareSequence_h
3 
4 #include <vector>
5 
6 namespace ots
7 {
8 template<typename T>
10 {
11  public:
12  typedef std::vector<std::pair<T, std::vector<T> > > Sequence; // It is a vector of
13  // pairs of addresses
14  // and data to send to
15  // the Firmware
16  typedef typename Sequence::iterator iterator;
17  typedef typename Sequence::const_iterator const_iterator;
18 
19  FirmwareSequence(void) { ; }
20  virtual ~FirmwareSequence(void) { ; }
21 
22  // Getters
23  const Sequence& getSequence(void) const { return theSequence_; }
24 
25  inline void pushBack(std::pair<T, std::vector<T> > entry)
26  {
27  theSequence_.push_back(entry);
28  }
29  inline void pushBack(T address, const std::vector<T>& data)
30  {
31  theSequence_.push_back(std::pair<T, std::vector<T> >(address, data));
32  }
33  inline void pushBack(T address, const T& data)
34  {
35  theSequence_.push_back(
36  std::pair<T, std::vector<T> >(address, std::vector<T>(1, data)));
37  }
38  void clear(void) { theSequence_.clear(); }
39 
40  iterator begin(void) { return theSequence_.begin(); }
41  iterator end(void) { return theSequence_.end(); }
42 
43  const const_iterator begin(void) const { return theSequence_.begin(); }
44  const const_iterator end(void) const { return theSequence_.end(); }
45 
46  private:
47  Sequence theSequence_;
48 };
49 }
50 
51 #endif