CMS 3D CMS Logo

MP7PacketReader.h
Go to the documentation of this file.
1 /*
2  * File: MP7PacketReader.h
3  * Author: ale
4  *
5  * Created on August 22, 2014, 6:26 PM
6  */
7 
8 #ifndef EventFilter_L1TRawToDigi_MP7PacketReader_h
9 #define EventFilter_L1TRawToDigi_MP7PacketReader_h
10 
12 
13 typedef std::pair<uint32_t, uint32_t> PacketRange;
14 
15 class Packet {
16 public:
17  typedef std::map<uint32_t, std::vector<uint32_t> > LinkMap;
18 
19  size_t size() const { return last_ - first_ + 1; }
20  uint32_t first_;
21  uint32_t last_;
23 };
24 
25 class PacketData {
26 public:
27  const std::string& name() const { return name_; }
28 
29  typedef std::vector<Packet>::const_iterator const_iterator;
30 
31  const_iterator begin() const { return packets_.begin(); }
32 
33  const_iterator end() const { return packets_.end(); }
34 
35  size_t size() const { return packets_.size(); }
36 
37 private:
39  std::vector<Packet> packets_;
40 
41  friend class MP7PacketReader;
42 };
43 
45 public:
46  typedef std::vector<PacketData>::const_iterator const_iterator;
47 
48  MP7PacketReader(const std::string& path, uint32_t striphdr = 0, uint32_t stripftr = 0, uint32_t ikey = 0);
49 
50  // MP7PacketReader( MP7FileReader rdr, uint32_t striphdr = 0, uint32_t stripftr = 0);
51 
52  virtual ~MP7PacketReader();
53 
54  bool valid() const { return reader_.valid(); }
55 
56  const PacketData& get(size_t i) { return buffers_.at(i); }
57 
58  const_iterator begin() const { return buffers_.begin(); }
59 
60  const_iterator end() const { return buffers_.end(); }
61 
62  size_t size() const { return buffers_.size(); }
63 
64 private:
65  void load();
66  static std::vector<PacketRange> findPackets(std::vector<uint64_t> data);
67 
68  std::vector<PacketData> buffers_;
70  uint32_t header_;
71  uint32_t footer_;
72  uint32_t ikey_;
73 };
74 
75 #endif /* TMTREADER_H */
MP7PacketReader::findPackets
static std::vector< PacketRange > findPackets(std::vector< uint64_t > data)
Definition: MP7PacketReader.cc:79
mps_fire.i
i
Definition: mps_fire.py:428
MP7PacketReader::get
const PacketData & get(size_t i)
Definition: MP7PacketReader.h:56
MP7PacketReader::const_iterator
std::vector< PacketData >::const_iterator const_iterator
Definition: MP7PacketReader.h:46
MP7PacketReader
Definition: MP7PacketReader.h:44
PacketData::const_iterator
std::vector< Packet >::const_iterator const_iterator
Definition: MP7PacketReader.h:29
MP7PacketReader::reader_
MP7FileReader reader_
Definition: MP7PacketReader.h:69
PacketRange
std::pair< uint32_t, uint32_t > PacketRange
Definition: MP7PacketReader.h:13
MP7PacketReader::~MP7PacketReader
virtual ~MP7PacketReader()
Definition: MP7PacketReader.cc:26
PacketData
Definition: MP7PacketReader.h:25
Packet::size
size_t size() const
Definition: MP7PacketReader.h:19
MP7PacketReader::buffers_
std::vector< PacketData > buffers_
Definition: MP7PacketReader.h:68
MP7PacketReader::size
size_t size() const
Definition: MP7PacketReader.h:62
PacketData::end
const_iterator end() const
Definition: MP7PacketReader.h:33
MP7FileReader::valid
bool valid() const
reader status. valid() == 1 indicates that data was successfully read from file
Definition: MP7FileReader.h:53
Packet::LinkMap
std::map< uint32_t, std::vector< uint32_t > > LinkMap
Definition: MP7PacketReader.h:17
MP7FileReader
Definition: MP7FileReader.h:43
Packet::last_
uint32_t last_
Definition: MP7PacketReader.h:21
PacketData::begin
const_iterator begin() const
Definition: MP7PacketReader.h:31
MP7PacketReader::load
void load()
Definition: MP7PacketReader.cc:28
MP7PacketReader::header_
uint32_t header_
Definition: MP7PacketReader.h:70
Packet::links_
LinkMap links_
Definition: MP7PacketReader.h:22
Packet::first_
uint32_t first_
Definition: MP7PacketReader.h:20
MP7FileReader.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MP7PacketReader::ikey_
uint32_t ikey_
Definition: MP7PacketReader.h:72
Packet
Definition: MP7PacketReader.h:15
MP7PacketReader::MP7PacketReader
MP7PacketReader(const std::string &path, uint32_t striphdr=0, uint32_t stripftr=0, uint32_t ikey=0)
Definition: MP7PacketReader.cc:8
PacketData::packets_
std::vector< Packet > packets_
Definition: MP7PacketReader.h:39
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
PacketData::name
const std::string & name() const
Definition: MP7PacketReader.h:27
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
MP7PacketReader::footer_
uint32_t footer_
Definition: MP7PacketReader.h:71
PacketData::name_
std::string name_
Definition: MP7PacketReader.h:38
MP7PacketReader::end
const_iterator end() const
Definition: MP7PacketReader.h:60
PacketData::size
size_t size() const
Definition: MP7PacketReader.h:35
MP7PacketReader::valid
bool valid() const
Definition: MP7PacketReader.h:54
MP7PacketReader::begin
const_iterator begin() const
Definition: MP7PacketReader.h:58