CMS 3D CMS Logo

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 
26 
27 namespace l1t{
28 
29  class LUT{
30  public:
31  enum ReadCodes {
33  };
34 
36 
37  explicit LUT(std::istream& stream) :
38  data_()
39  {
40  read(stream);
41  }
42 
43 
44  ~LUT(){}
45 
46  int data(unsigned int address)const{return (address&addressMask_)<data_.size() ? dataMask_ & data_[addressMask_&address] : 0;}
47  int read(std::istream& stream);
48  void write(std::ostream& stream)const;
49 
50  unsigned int nrBitsAddress()const{return nrBitsAddress_;}
51  unsigned int nrBitsData()const{return nrBitsData_;}
52  //following the convention of vector::size()
54  bool empty()const{return data_.empty();}
55 
56  private:
57 
58  int readHeader_(std::istream&);
59 
60  unsigned int nrBitsAddress_; //technically redundant with addressMask
61  unsigned int nrBitsData_;//technically redundant with dataMask
62  unsigned int addressMask_;
63  unsigned int dataMask_;
64 
65  std::vector<int> data_;
67  };
68 
69 }
70 
71 #endif
std::vector< int > data_
Definition: LUT.h:65
void write(std::ostream &stream) const
Definition: LUT.cc:67
bool empty() const
Definition: LUT.h:54
unsigned int maxSize() const
Definition: LUT.h:53
delete x;
Definition: CaloConfig.h:22
LUT(std::istream &stream)
Definition: LUT.h:37
unsigned int nrBitsData_
Definition: LUT.h:61
int read(std::istream &stream)
Definition: LUT.cc:11
~LUT()
Definition: LUT.h:44
unsigned int nrBitsData() const
Definition: LUT.h:51
LUT()
Definition: LUT.h:35
unsigned int addressMask_
Definition: LUT.h:62
ReadCodes
Definition: LUT.h:31
unsigned int nrBitsAddress() const
Definition: LUT.h:50
Definition: LUT.h:29
int readHeader_(std::istream &)
Definition: LUT.cc:75
#define COND_SERIALIZABLE
Definition: Serializable.h:38
int data(unsigned int address) const
Definition: LUT.h:46
unsigned int nrBitsAddress_
Definition: LUT.h:60
unsigned int dataMask_
Definition: LUT.h:63