LCOV - code coverage report
Current view: top level - imageanalysis/ImageAnalysis - PixelValueManipulatorData.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 14 25 56.0 %
Date: 2024-11-06 17:42:47 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include <imageanalysis/ImageAnalysis/PixelValueManipulatorData.h>
       2             : 
       3             : #include <casacore/casa/BasicSL/String.h>
       4             : #include <casacore/casa/Exceptions/Error.h>
       5             : 
       6             : using namespace casacore;
       7             : namespace casa {
       8          20 : PixelValueManipulatorData::SpectralType PixelValueManipulatorData::spectralType(
       9             :         const String& specString
      10             : ) {
      11             : 
      12          20 :         String spec = specString;
      13          20 :         spec.downcase();
      14          20 :         static const String def = "default";
      15          20 :         static const String optical = "optical velocity";
      16          20 :         static const String radio = "radio velocity";
      17          20 :         static const String wave = "wavelength";
      18          20 :         static const String air = "air wavelength";
      19          20 :         static const String rel = "relativistic velocity";
      20          20 :         static const String beta = "beta";
      21          20 :         ThrowIf (
      22             :                 spec == "r",
      23             :                 "Ambiguous, could be either radio or relativistic"
      24             :         );
      25          20 :         if (spec.empty() || def.startsWith(spec)) {
      26          20 :                 return DEFAULT;
      27             :         }
      28           0 :         else if (optical.startsWith(spec)) {
      29           0 :                 return OPTICAL_VELOCITY;
      30             :         }
      31           0 :         else if (radio.startsWith(spec)) {
      32           0 :                 return RADIO_VELOCITY;
      33             :         }
      34           0 :         else if (rel.startsWith(spec) || beta.startsWith(spec)) {
      35           0 :                 return RELATIVISTIC;
      36             :         }
      37           0 :         else if (wave.startsWith(spec)) {
      38           0 :                 return WAVELENGTH;
      39             :         }
      40           0 :         else if (air.startsWith(spec)) {
      41           0 :                 return AIR_WAVELENGTH;
      42             :         }
      43             :         else {
      44           0 :                 ThrowCc(specString + "does not identify a spectral type");
      45             :         }
      46          20 : }
      47             : 
      48             : }

Generated by: LCOV version 1.16