otsdaq_components  v2_04_01
ROCDACs.h
1 #ifndef _ots_ROCDACs_h_
2 #define _ots_ROCDACs_h_
3 
4 #include <map>
5 #include <string>
6 #include <utility>
7 
8 namespace ots
9 {
10 typedef std::map<std::string, std::pair<unsigned int, unsigned int> > DACList;
11 
12 class ROCDACs
13 {
14  public:
15  ROCDACs(void) { ; }
16  virtual ~ROCDACs(void) { ; }
17  void clear(void) { theDACList_.clear(); }
18 
19  // Setters
20  // void setDAC(std::string name, std::pair<unsigned int, unsigned int> aDAC)
21  // {theDACList_[name] = std::make_pair(aDAC.first,aDAC.second);} void
22  // setDAC(std::string name, unsigned int address, unsigned int value)
23  // {theDACList_[name].first = address; theDACList_[name].second = value;}
24  void setDAC(std::string name, unsigned int address, unsigned int value)
25  {
26  theDACList_[name] = std::pair<unsigned int, unsigned int>(address, value);
27  }
28 
29  // Getters
30  const std::pair<unsigned int, unsigned int>& getDAC(std::string name) const
31  {
32  return theDACList_.find(name)->second;
33  }
34  unsigned int getDACAddress(std::string name) const
35  {
36  return theDACList_.find(name)->second.first;
37  }
38  unsigned int getDACValue(std::string name) const
39  {
40  return theDACList_.find(name)->second.second;
41  }
42  const DACList getDACList(void) const { return theDACList_; }
43 
44  protected:
45  DACList theDACList_;
46 };
47 }
48 #endif