MilliSlice.cc
Go to the documentation of this file.
2 
3 dune::MilliSlice::MilliSlice(uint8_t* address) : buffer_(address)
4 {
5 }
6 
8 {
9  return header_()->millislice_size;
10 }
11 
13 {
14  return header_()->microslice_count;
15 }
16 
17 std::unique_ptr<dune::MicroSlice> dune::MilliSlice::microSlice(uint32_t index) const
18 {
19  std::unique_ptr<MicroSlice> mslice_ptr;
20  if (index < microSliceCount()) {
21  uint8_t* ms_ptr = data_(index);
22  mslice_ptr.reset(new MicroSlice(ms_ptr));
23  }
24  return mslice_ptr;
25 }
26 
28 {
29  return reinterpret_cast<Header const*>(buffer_);
30 }
31 
32 uint8_t* dune::MilliSlice::data_(int index) const
33 {
34  uint8_t* ms_ptr = buffer_ + sizeof(Header);
35  for (int idx = 0; idx < index; ++idx) {
36  MicroSlice tmp_ms(ms_ptr);
37  ms_ptr += tmp_ms.size();
38  }
39  return ms_ptr;
40 }
std::unique_ptr< MicroSlice > microSlice(uint32_t index) const
Definition: MilliSlice.cc:17
MilliSlice(uint8_t *address)
Definition: MilliSlice.cc:3
Header::microslice_count_t microSliceCount() const
Definition: MilliSlice.cc:12
Header::microslice_size_t size() const
Definition: MicroSlice.cc:7
Header const * header_() const
Definition: MilliSlice.cc:27
uint8_t * buffer_
Definition: MilliSlice.hh:56
uint8_t * data_(int index) const
Definition: MilliSlice.cc:32
Header::millislice_size_t size() const
Definition: MilliSlice.cc:7