MicroSlice.hh
Go to the documentation of this file.
1 #ifndef dune_artdaq_Overlays_MicroSlice_hh
2 #define dune_artdaq_Overlays_MicroSlice_hh
3 
5 #include <memory>
6 
7 namespace dune {
8  class MicroSlice;
9 }
10 
12 
13 public:
14 
15  struct Header {
16  typedef uint32_t data_t;
17 
18  typedef uint8_t version_t;
19  typedef uint32_t microslice_size_t;
20  typedef uint32_t nanoslice_count_t;
21 
22  // this structure is deliberately incomplete - it should be
23  // improved to match what we want for the DUNE 35t detector
24 
25  data_t version : 8;
26  data_t microslice_size : 24; // total size, data & header
27 
28  data_t nanoslice_count : 32;
29  };
30 
31  // This constructor accepts a memory buffer that contains an existing
32  // MicroSlice and allows the the data inside it to be accessed
33  MicroSlice(uint8_t* address);
34 
35  // Returns the size of the MicroSlice
37 
38  // Returns the number of NanoSlices in this MicroSlice
40 
41  // Returns the requested NanoSlice if the requested slice was found,
42  // otherwise returns an empty pointer
43  std::unique_ptr<NanoSlice> nanoSlice(uint32_t index) const;
44 
45 protected:
46 
47  // returns a pointer to the header
48  Header const* header_() const;
49 
50  // returns a pointer to the requested NanoSlice
51  uint8_t* data_(uint32_t index) const;
52 
53  uint8_t* buffer_;
54 };
55 
56 #endif /* dune_artdaq_Overlays_MicroSlice_hh */
uint8_t * data_(uint32_t index) const
Definition: MicroSlice.cc:32
uint8_t * buffer_
Definition: MicroSlice.hh:53
MicroSlice(uint8_t *address)
Definition: MicroSlice.cc:3
Header::nanoslice_count_t nanoSliceCount() const
Definition: MicroSlice.cc:12
Header::microslice_size_t size() const
Definition: MicroSlice.cc:7
Header const * header_() const
Definition: MicroSlice.cc:27
std::unique_ptr< NanoSlice > nanoSlice(uint32_t index) const
Definition: MicroSlice.cc:17