Scope
DaqChunk.h
1 #pragma once
2 
3 #include "../ScopeDefines.h"
4 
5 namespace scope {
6 
9 class DaqChunk {
10 
11 protected:
13  const uint32_t area;
14 
16  const uint32_t nchannels;
17 
19  uint32_t perchannel;
20 
21 public:
23  typedef std::vector<uint16_t>::iterator iterator;
24 
26  std::vector<uint16_t> data;
27 
29  std::vector<iterator> lastmapped;
30 
34  DaqChunk(const uint32_t& _perchannel, const uint32_t& _nchannels, const uint32_t& _area);
35 
37  virtual ~DaqChunk() { };
38 
42  virtual void Downsample(const uint32_t& _factor);
43 
45  virtual void Scale(const double& _factor);
46 
49  uint32_t Area() const { return area; }
50  uint32_t NChannels() const { return nchannels; }
51  uint32_t PerChannel() const { return perchannel; }
52  iterator GetLastMapped(const uint32_t& _channel) const { return lastmapped[_channel]; }
57  void SetLastMapped(const uint32_t& _channel, const iterator& _last) { lastmapped[_channel] = _last; }
59 };
60 
62 typedef std::shared_ptr<DaqChunk> DaqChunkPtr;
64 typedef std::vector<DaqChunkPtr> DaqAreaChunks;
66 typedef std::shared_ptr<DaqAreaChunks> DaqAreaChunksPtr;
67 
68 }
std::vector< iterator > lastmapped
Iterators to positions that was last mapped.
Definition: DaqChunk.h:29
std::vector< uint16_t >::iterator iterator
Iterator over the data vector.
Definition: DaqChunk.h:23
uint32_t perchannel
Number of samples per channel.
Definition: DaqChunk.h:19
const uint32_t area
Area of the DaqChunk.
Definition: DaqChunk.h:13
std::vector< uint16_t > data
The data vector.
Definition: DaqChunk.h:26
A DaqChunk contains data from all channels sequentially.
Definition: DaqChunk.h:9
DaqChunk(const uint32_t &_perchannel, const uint32_t &_nchannels, const uint32_t &_area)
Definition: DaqChunk.cpp:7
virtual void Downsample(const uint32_t &_factor)
Downsamples by averaging _factor samples.
Definition: DaqChunk.cpp:19
virtual ~DaqChunk()
Virtual destructor here, to be prepared for derived classes.
Definition: DaqChunk.h:37
virtual void Scale(const double &_factor)
Multiplies every sample by _factor.
Definition: DaqChunk.cpp:46
const uint32_t nchannels
Number of channels in that area/DaqChunk.
Definition: DaqChunk.h:16