Select Git revision
work_table.h
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
work_table.h 5.40 KiB
// SPDX-License-Identifier: LGPL-3.0-only
#ifndef RADLER_WORK_TABLE_H_
#define RADLER_WORK_TABLE_H_
#include "work_table_entry.h"
#include <functional>
#include <memory>
#include <vector>
namespace radler {
/**
* The WorkTable contains WorkTableEntry's and groups entries
* that have the same squaredDeconvolutionIndex.
*/
class WorkTable {
public:
using Entries = std::vector<std::unique_ptr<WorkTableEntry>>;
using Group = std::vector<const WorkTableEntry*>;
/**
* Iterator-like class which (only) supports a range-based loop over entries.
*
* Dereferencing this class yields a reference to the actual object instead
* of a reference to the pointer for the object.
*/
class EntryIteratorLite {
using BaseIterator = Entries::const_iterator;
public:
explicit EntryIteratorLite(BaseIterator base_iterator)
: base_iterator_(base_iterator) {}
EntryIteratorLite(const EntryIteratorLite&) = default;
EntryIteratorLite(EntryIteratorLite&&) = default;
EntryIteratorLite& operator=(const EntryIteratorLite&) = default;
EntryIteratorLite& operator=(EntryIteratorLite&&) = default;
const WorkTableEntry& operator*() const { return **base_iterator_; }
EntryIteratorLite& operator++() {
++base_iterator_;
return *this;
}
bool operator!=(const EntryIteratorLite& other) const {
return base_iterator_ != other.base_iterator_;
}
bool operator==(const EntryIteratorLite& other) const {
return base_iterator_ == other.base_iterator_;
}
private:
BaseIterator base_iterator_;
};
/**
* @brief Constructs a new WorkTable object.
*
* @param n_original_groups The number of original channel groups. When adding
* entries, their original channel index must be less than the number of
* original groups. If the value is zero, one group is used.
* @param n_deconvolution_groups The number of deconvolution groups.
* A deconvolution group consist of one or more channel groups, which are then
* joinedly deconvolved.
* If the value is zero, or larger than the number of original groups,
* all channels are deconvolved separately.
* @param channel_index_offset The index of the first channel in the caller.
*/
explicit WorkTable(std::size_t n_original_groups,
std::size_t n_deconvolution_groups,