LCOV - code coverage report
Current view: top level - elsa/core/Descriptors - DescriptorUtils.h (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 3 3 100.0 %
Date: 2024-05-16 04:22:26 Functions: 7 7 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "DataDescriptor.h"
       4             : 
       5             : namespace elsa
       6             : {
       7             :     /**
       8             :      * @brief Finds the descriptor with the same number of coefficients as the descriptors in
       9             :      * the list that retains as much information as possible
      10             :      *
      11             :      * @param[in] descriptorList a vector of plain pointers to DataDescriptor
      12             :      *
      13             :      * @return std::unique_ptr<DataDescriptor> the best common descriptor
      14             :      *
      15             :      * @throw InvalidArgumentError if the vector is empty or the descriptors in the vector
      16             :      * don't all have the same size
      17             :      *
      18             :      * If all descriptors are equal, a clone of the first descriptor in the list is returned.
      19             :      * If all descriptors have a common base descriptor, that data descriptor is returned.
      20             :      * If the base descriptors only differ in spacing, the base descriptor with a uniform
      21             :      * spacing of 1 is returned.
      22             :      * Otherwise, the linearized descriptor with a spacing of 1 is returned.
      23             :      */
      24             :     std::unique_ptr<DataDescriptor>
      25             :         bestCommon(const std::vector<const DataDescriptor*>& descriptorList);
      26             : 
      27             :     /// convenience overload for invoking bestCommon() with a number of const DataDescriptor&
      28             :     template <
      29             :         typename... DescriptorType,
      30             :         typename = std::enable_if_t<(std::is_base_of_v<DataDescriptor, DescriptorType> && ...)>>
      31             :     std::unique_ptr<DataDescriptor> bestCommon(const DescriptorType&... descriptors)
      32         164 :     {
      33         164 :         return bestCommon(std::vector{static_cast<const DataDescriptor*>(&descriptors)...});
      34         164 :     }
      35             : } // namespace elsa

Generated by: LCOV version 1.14