NanoSlice.hh
Go to the documentation of this file.
1 #ifndef dune_artdaq_Overlays_NanoSlice_hh
2 #define dune_artdaq_Overlays_NanoSlice_hh
3 
4 #include <stdint.h>
5 
6 namespace dune {
7  class NanoSlice;
8 }
9 
11 
12 public:
13 
14  struct Header {
15  typedef uint32_t data_t;
16 
17  typedef uint16_t version_t;
18  typedef uint16_t nanoslice_size_t;
19  typedef uint16_t channel_number_t;
20  typedef uint16_t sample_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 : 16;
26  data_t nanoslice_size : 16; // total size, data & header
27  data_t channel_number : 16;
28  data_t sample_count : 16;
29  };
30 
31  // This constructor accepts a memory buffer that contains an existing
32  // nanoSlice and allows the the data inside it to be accessed
33  NanoSlice(uint8_t* address);
34 
35  // Returns the size of the NanoSlice
37 
38  // Returns the channel number for the NanoSlice
40 
41  // Returns the number of samples in this NanoSlice
43 
44  // Fetches the value for the requested sample. Returns true if
45  // the requested value was found, false if not.
46  bool sampleValue(uint32_t index, uint16_t& value) const;
47 
48 protected:
49 
50  // returns a pointer to the header
51  Header const* header_() const;
52 
53  // returns a pointer to the first sample value
54  uint16_t const* data_() const;
55 
56  uint8_t* buffer_;
57 };
58 
59 #endif /* dune_artdaq_Overlays_NanoSlice_hh */
NanoSlice(uint8_t *address)
Definition: NanoSlice.cc:3
uint16_t const * data_() const
Definition: NanoSlice.cc:32
bool sampleValue(uint32_t index, uint16_t &value) const
Definition: NanoSlice.cc:20
Header::sample_count_t sampleCount() const
Definition: NanoSlice.cc:15
uint8_t * buffer_
Definition: NanoSlice.hh:56
Header::nanoslice_size_t size() const
Definition: NanoSlice.cc:5
Header::channel_number_t channelNumber() const
Definition: NanoSlice.cc:10
Header const * header_() const
Definition: NanoSlice.cc:27