Line data Source code
1 : #pragma once 2 : 3 : #include "elsaDefines.h" 4 : #include "Cloneable.h" 5 : #include "DataDescriptor.h" 6 : 7 : namespace elsa 8 : { 9 : 10 : /** 11 : * @brief Abstract class defining the interface of all block descriptors. 12 : * 13 : * @author Matthias Wieczorek - initial code 14 : * @author David Frank - rewrite 15 : * @author Tobias Lasser - rewrite, modularization, modernization 16 : * @author Nikola Dinev - rework into abstract class 17 : * 18 : * A block descriptor provides metadata about a signal that is stored in memory (typically a 19 : * DataContainer). This signal can be n-dimensional, and will be stored in memory in a 20 : * linearized fashion in blocks. The blocks can be used to support various operations (like 21 : * blocked operators or ordered subsets), however, the blocks have to lie in memory one after 22 : * the other (i.e. no stride is supported). 23 : */ 24 : class BlockDescriptor : public DataDescriptor 25 : { 26 : public: 27 : /// default destructor 28 72862 : ~BlockDescriptor() override = default; 29 : 30 : /// return the number of blocks 31 : virtual index_t getNumberOfBlocks() const = 0; 32 : 33 : /// return the DataDescriptor of the i-th block 34 : virtual const DataDescriptor& getDescriptorOfBlock(index_t i) const = 0; 35 : 36 : /// return the offset to access the data of the i-th block 37 : virtual index_t getOffsetOfBlock(index_t i) const = 0; 38 : 39 : protected: 40 : /// used by derived classes to initialize the DataDescriptor base 41 2369 : BlockDescriptor(DataDescriptor&& base) : DataDescriptor{std::move(base)} {} 42 : 43 : /// used by derived classes to initialize the DataDescriptor base 44 34947 : BlockDescriptor(const DataDescriptor& base) : DataDescriptor{base} {} 45 : }; 46 : } // namespace elsa