65 int64_t nArray,
size_t numberOfPeriods,
size_t numberOfChannels,
66 std::vector<specnum_t> monitorSpectra) {
68 return std::find(std::begin(monitorSpectra), std::end(monitorSpectra),
index) != std::end(monitorSpectra);
76 struct HandleWhenElementIsMonitor {
79 if (previousValue - startValue > 0) {
80 auto numberOfSpectra = previousValue - startValue;
82 DataBlock dataBlock(numberOfPeriods, numberOfSpectra, numberOfChannels);
89 DataBlock dataBlock(numberOfPeriods, 1, numberOfChannels);
99 struct HandleWhenElementMadeAJump {
102 auto numberOfSpectra = previousValue - startValue + 1;
103 DataBlock dataBlock(
static_cast<int>(numberOfPeriods), numberOfSpectra, numberOfChannels);
110 HandleWhenElementIsMonitor handleWhenElementIsMonitor;
111 HandleWhenElementMadeAJump handleWhenElementMadeAJump;
113 auto startValue = indexContainer[0];
114 auto previousValue = startValue;
115 for (int64_t arrayIndex = 1; arrayIndex < nArray; ++arrayIndex) {
120 if (isMonitor(previousValue)) {
121 handleWhenElementIsMonitor(dataBlockComposite, numberOfPeriods, numberOfChannels, previousValue, startValue);
122 startValue = indexContainer[arrayIndex];
123 }
else if ((indexContainer[arrayIndex] - previousValue) != 1) {
126 handleWhenElementMadeAJump(dataBlockComposite, numberOfPeriods, numberOfChannels, previousValue, startValue);
127 startValue = indexContainer[arrayIndex];
131 previousValue = indexContainer[arrayIndex];
135 if (isMonitor(previousValue)) {
136 handleWhenElementIsMonitor(dataBlockComposite, numberOfPeriods, numberOfChannels, previousValue, startValue);
138 handleWhenElementMadeAJump(dataBlockComposite, numberOfPeriods, numberOfChannels, previousValue, startValue);
void DLLExport populateDataBlockCompositeWithContainer(DataBlockComposite &dataBlockComposite, T &indexContainer, int64_t nArray, size_t numberOfPeriods, size_t numberOfChannels, std::vector< specnum_t > monitorSpectra)
Populates a DataBlockComposite with DataBlocks which are extracted from a indexable collection (array...
constexpr wide_integer< Bits, Signed > operator+(const wide_integer< Bits, Signed > &lhs) noexcept(is_same< Signed, unsigned >::value)