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 {
32  SUCCESS = 0,
38  };
39 
41 
42  explicit LUT(std::istream& stream) : data_() { read(stream); }
43 
44  ~LUT() {}
45 
46  int data(unsigned int address) const {
47  return (address & addressMask_) < data_.size() ? dataMask_ & data_[addressMask_ & address] : 0;
48  }
49  int read(std::istream& stream);
50  void write(std::ostream& stream) const;
51 
52  unsigned int nrBitsAddress() const { return nrBitsAddress_; }
53  unsigned int nrBitsData() const { return nrBitsData_; }
54  //following the convention of vector::size()
55  unsigned int maxSize() const {
57  }
58  bool empty() const { return data_.empty(); }
59 
60  private:
61  int readHeader_(std::istream&);
62 
63  unsigned int nrBitsAddress_; //technically redundant with addressMask
64  unsigned int nrBitsData_; //technically redundant with dataMask
65  unsigned int addressMask_;
66  unsigned int dataMask_;
67 
68  std::vector<int> data_;
70  };
71 
72 } // namespace l1t
73 
74 #endif
std::vector< int > data_
Definition: LUT.h:68
unsigned int maxSize() const
Definition: LUT.h:55
unsigned int nrBitsAddress() const
Definition: LUT.h:52
unsigned int nrBitsData() const
Definition: LUT.h:53
delete x;
Definition: CaloConfig.h:22
bool empty() const
Definition: LUT.h:58
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
LUT(std::istream &stream)
Definition: LUT.h:42
unsigned int nrBitsData_
Definition: LUT.h:64
int read(std::istream &stream)
Definition: LUT.cc:11
~LUT()
Definition: LUT.h:44
LUT()
Definition: LUT.h:40
int data(unsigned int address) const
Definition: LUT.h:46
unsigned int addressMask_
Definition: LUT.h:65
ReadCodes
Definition: LUT.h:31
Definition: LUT.h:29
int readHeader_(std::istream &)
Definition: LUT.cc:72
#define COND_SERIALIZABLE
Definition: Serializable.h:39
unsigned int nrBitsAddress_
Definition: LUT.h:63
void write(std::ostream &stream) const
Definition: LUT.cc:65
unsigned int dataMask_
Definition: LUT.h:66