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_;
22  LinkMap links_;
23 };
24 
25 class PacketData {
26 public:
27 
28  const std::string& name() const { return name_;}
29 
30  typedef std::vector<Packet>::const_iterator const_iterator;
31 
32  const_iterator begin() const { return packets_.begin(); }
33 
34  const_iterator end() const { return packets_.end(); }
35 
36  size_t size() const { return packets_.size(); }
37 
38 private:
39 
41  std::vector<Packet> packets_;
42 
43  friend class MP7PacketReader;
44 };
45 
47 public:
48  typedef std::vector<PacketData>::const_iterator const_iterator;
49 
50  MP7PacketReader( const std::string& path, uint32_t striphdr = 0, uint32_t stripftr = 0, uint32_t ikey = 0);
51 
52  // MP7PacketReader( MP7FileReader rdr, uint32_t striphdr = 0, uint32_t stripftr = 0);
53 
54  virtual ~MP7PacketReader();
55 
56  bool valid() const { return reader_.valid(); }
57 
58  const PacketData& get( size_t i ) { return buffers_.at(i); }
59 
60  const_iterator begin() const { return buffers_.begin(); }
61 
62  const_iterator end() const { return buffers_.end(); }
63 
64  size_t size() const { return buffers_.size(); }
65 
66 private:
67 
68  void load();
69  static std::vector<PacketRange> findPackets( std::vector<uint64_t> data );
70 
71  std::vector< PacketData > buffers_;
73  uint32_t header_;
74  uint32_t footer_;
75  uint32_t ikey_;
76 };
77 
78 #endif /* TMTREADER_H */
79 
const_iterator begin() const
LinkMap links_
size_t size() const
std::string name_
uint32_t last_
MP7FileReader reader_
std::vector< Packet > packets_
std::vector< PacketData > buffers_
const_iterator end() const
std::vector< PacketData >::const_iterator const_iterator
size_t size() const
std::pair< uint32_t, uint32_t > PacketRange
bool valid() const
const std::string & name() const
const_iterator begin() const
uint32_t first_
def load(fileName)
Definition: svgfig.py:546
std::map< uint32_t, std::vector< uint32_t > > LinkMap
std::vector< Packet >::const_iterator const_iterator
const_iterator end() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
size_t size() const