NanoSliceWriter.hh
Go to the documentation of this file.
1 #ifndef dune_artdaq_Overlays_NanoSliceWriter_hh
2 #define dune_artdaq_Overlays_NanoSliceWriter_hh
3 
5 
6 namespace dune {
7  class NanoSliceWriter;
8 }
9 
11 
12 public:
13 
14  // This constructor creates an empty NanoSlice which can be filled
15  // with the appropriate data
16  NanoSliceWriter(uint8_t* address, uint32_t max_size_bytes,
17  uint16_t channel_number = 0);
18 
19  // Sets the channel number for this NanoSlice.
20  void setChannelNumber(uint16_t channel);
21 
22  // Adds the specified data sample NanoSlice. Returns true
23  // if it was successfully added, false if not (for example, if the
24  // additional sample would overflow the maximum size of the
25  // NanoSlice).
26  bool addSample(uint16_t value);
27 
28  // Finalizes the NanoSlice. This takes care of updating the
29  // NanoSlice so that all internal pointers and data are consistent
30  // with the data that has been added. No more samples can be added
31  // once the NanoSlice has been finalized.
32  // This method returns the number of bytes that were reclaimed
33  // when the maximum size for this NanoSlice was reduced to match
34  // its actual current size.
35  int32_t finalize();
36 
37 protected:
38 
39  // returns a pointer to the header
40  Header * header_();
41 
42  // returns a pointer to the first sample value
43  uint16_t * data_();
44 
45  uint32_t max_size_bytes_;
46 };
47 
48 #endif /* dune_artdaq_Overlays_NanoSliceWriter_hh */
NanoSliceWriter(uint8_t *address, uint32_t max_size_bytes, uint16_t channel_number=0)
uint8_t channel
Definition: CRTFragment.hh:201
void setChannelNumber(uint16_t channel)
bool addSample(uint16_t value)