CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Block.h
Go to the documentation of this file.
1 #ifndef Block_h
2 #define Block_h
3 
4 namespace l1t {
5  typedef uint32_t BlockId;
6 
7  class BlockHeader {
8  public:
9  BlockHeader(unsigned int id, unsigned int size) : data_(((id & ID_mask) << ID_shift) | ((size & size_mask) << size_shift)) {};
10  BlockHeader(const uint32_t *data) : data_(data[0]) {};
11 
12  bool operator<(const BlockHeader& o) const { return getID() < o.getID(); };
13 
14  inline unsigned int getID() const { return (data_ >> ID_shift) & ID_mask; };
15  inline unsigned int getSize() const { return (data_ >> size_shift) & size_mask; };
16 
17  inline uint32_t raw() const { return data_; };
18 
19  private:
20  static const unsigned int ID_shift = 24;
21  static const unsigned int ID_mask = 0xff;
22  static const unsigned int size_shift = 16;
23  static const unsigned int size_mask = 0xff;
24 
25  uint32_t data_;
26  };
27 
28  class Block {
29  public:
30  Block(const BlockHeader& h, const uint32_t * payload_start, const uint32_t * payload_end) : header_(h), payload_(payload_start, payload_end) {};
31  Block(unsigned int id, const std::vector<uint32_t>& payload) : header_(id, payload.size()), payload_(payload) {};
32 
33  bool operator<(const Block& o) const { return header() < o.header(); };
34 
35  inline unsigned int getSize() const { return payload_.size() + 1; };
36 
37  BlockHeader header() const { return header_; };
38  std::vector<uint32_t> payload() const { return payload_; };
39 
40  private:
42  std::vector<uint32_t> payload_;
43  };
44 
45  typedef std::vector<Block> Blocks;
46 }
47 
48 #endif
BlockHeader(unsigned int id, unsigned int size)
Definition: Block.h:9
std::vector< uint32_t > payload_
Definition: Block.h:42
Block(const BlockHeader &h, const uint32_t *payload_start, const uint32_t *payload_end)
Definition: Block.h:30
unsigned int getID() const
Definition: Block.h:14
BlockHeader header() const
Definition: Block.h:37
static const unsigned int ID_shift
Definition: Block.h:20
std::vector< uint32_t > payload() const
Definition: Block.h:38
static const unsigned int ID_mask
Definition: Block.h:21
BlockHeader(const uint32_t *data)
Definition: Block.h:10
uint32_t BlockId
Definition: Block.h:5
std::vector< Block > Blocks
Definition: Block.h:45
BlockHeader header_
Definition: Block.h:38
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
static const unsigned int size_mask
Definition: Block.h:23
Block(unsigned int id, const std::vector< uint32_t > &payload)
Definition: Block.h:31
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool operator<(const BlockHeader &o) const
Definition: Block.h:12
unsigned int getSize() const
Definition: Block.h:15
uint32_t raw() const
Definition: Block.h:17
static const unsigned int size_shift
Definition: Block.h:22
uint32_t data_
Definition: Block.h:25
unsigned int getSize() const
Definition: Block.h:35
tuple size
Write out results.
bool operator<(const Block &o) const
Definition: Block.h:33