test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LUT.h
Go to the documentation of this file.
1 
16 //
17 
18 #ifndef CondFormats_L1TObjects_LUT_h
19 #define CondFormats_L1TObjects_LUT_h
20 
21 #include <iostream>
22 #include <vector>
23 #include <limits>
24 
25 namespace l1t{
26 
27  class LUT{
28  public:
29  enum ReadCodes {
31  };
32 
33  LUT():data_(){}
34 
35  explicit LUT(std::istream& stream) :
36  data_()
37  {
38  read(stream);
39  }
40 
41 
42  ~LUT(){}
43 
44  int data(unsigned int address)const{return (address&addressMask_)<data_.size() ? dataMask_ & data_[addressMask_&address] : 0;}
45  int read(std::istream& stream);
46  void write(std::ostream& stream)const;
47 
48  unsigned int nrBitsAddress()const{return nrBitsAddress_;}
49  unsigned int nrBitsData()const{return nrBitsData_;}
50  //following the convention of vector::size()
52  bool empty()const{return data_.empty();}
53 
54  private:
55 
56  int readHeader_(std::istream&);
57 
58  unsigned int nrBitsAddress_; //technically redundant with addressMask
59  unsigned int nrBitsData_;//technically redundant with dataMask
60  unsigned int addressMask_;
61  unsigned int dataMask_;
62 
63  std::vector<int> data_;
64  };
65 
66 }
67 
68 #endif
std::vector< int > data_
Definition: LUT.h:63
void write(std::ostream &stream) const
Definition: LUT.cc:86
bool empty() const
Definition: LUT.h:52
unsigned int maxSize() const
Definition: LUT.h:51
LUT(std::istream &stream)
Definition: LUT.h:35
unsigned int nrBitsData_
Definition: LUT.h:59
int read(std::istream &stream)
Definition: LUT.cc:35
~LUT()
Definition: LUT.h:42
unsigned int nrBitsData() const
Definition: LUT.h:49
LUT()
Definition: LUT.h:33
unsigned int addressMask_
Definition: LUT.h:60
ReadCodes
Definition: LUT.h:29
unsigned int nrBitsAddress() const
Definition: LUT.h:48
Definition: LUT.h:27
int readHeader_(std::istream &)
Definition: LUT.cc:94
int data(unsigned int address) const
Definition: LUT.h:44
unsigned int nrBitsAddress_
Definition: LUT.h:58
unsigned int dataMask_
Definition: LUT.h:61