LCOV - code coverage report
Current view: top level - nrao/VLA - VLAEnum.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 17 64 26.6 %
Date: 2024-12-11 20:54:31 Functions: 2 2 100.0 %

          Line data    Source code
       1             : //# VLAEnum.cc:
       2             : //# Copyright (C) 1999,2003
       3             : //# Associated Universities, Inc. Washington DC, USA.
       4             : //#
       5             : //# This library is free software; you can redistribute it and/or modify it
       6             : //# under the terms of the GNU Library General Public License as published by
       7             : //# the Free Software Foundation; either version 2 of the License, or (at your
       8             : //# option) any later version.
       9             : //#
      10             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      11             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      13             : //# License for more details.
      14             : //#
      15             : //# You should have received a copy of the GNU Library General Public License
      16             : //# along with this library; if not, write to the Free Software Foundation,
      17             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      18             : //#
      19             : //# Correspondence concerning AIPS++ should be addressed as follows:
      20             : //#        Internet email: casa-feedback@nrao.edu.
      21             : //#        Postal address: AIPS++ Project Office
      22             : //#                        National Radio Astronomy Observatory
      23             : //#                        520 Edgemont Road
      24             : //#                        Charlottesville, VA 22903-2475 USA
      25             : //#
      26             : //# $Id$
      27             : 
      28             : #include <nrao/VLA/VLAEnum.h>
      29             : #include <casacore/casa/BasicSL/String.h>
      30             : 
      31      150186 : String VLAEnum::name(VLAEnum::CorrMode modeEnum) {
      32      150186 :   switch (modeEnum) {
      33      130908 :   case VLAEnum::CONTINUUM: 
      34      130908 :     return " ";
      35       19278 :   case VLAEnum::A: 
      36       19278 :     return "1A";
      37           0 :   case VLAEnum::B: 
      38           0 :     return "1B";
      39           0 :   case VLAEnum::C: 
      40           0 :     return "1C";
      41           0 :   case VLAEnum::D: 
      42           0 :     return "1D";
      43           0 :   case VLAEnum::AB: 
      44           0 :     return "2AB";
      45           0 :   case VLAEnum::AC: 
      46           0 :     return "2AC";
      47           0 :   case VLAEnum::AD: 
      48           0 :     return "2AD";
      49           0 :   case VLAEnum::BC: 
      50           0 :     return "2BC";
      51           0 :   case VLAEnum::BD: 
      52           0 :     return "2BD";
      53           0 :   case VLAEnum::CD: 
      54           0 :     return "2CD";
      55           0 :   case VLAEnum::ABCD: 
      56           0 :     return "4";
      57           0 :   case VLAEnum::PA: 
      58           0 :     return "PA";
      59           0 :   case VLAEnum::PB: 
      60           0 :     return "PB";
      61           0 :   case VLAEnum::OLDA: 
      62           0 :     return "2A";
      63           0 :   case VLAEnum::OLDB: 
      64           0 :     return "2B";
      65           0 :   case VLAEnum::OLDC: 
      66           0 :     return "2C";
      67           0 :   case VLAEnum::OLDD: 
      68           0 :     return "2D";
      69           0 :   default:
      70           0 :     return "Unknown correlator mode";
      71             :   };
      72             : }
      73             : 
      74      127916 : VLAEnum::CorrMode VLAEnum::corrMode(const String& modeString) {
      75      127916 :   String canonicalCase(modeString);
      76      127916 :   canonicalCase.upcase();
      77             :   VLAEnum::CorrMode m;
      78      145616 :   for (uInt i = 0; i < NUMBER_MODES; i++) {
      79      145616 :     m = VLAEnum::CorrMode(i);
      80      145616 :     if (canonicalCase.matches(VLAEnum::name(m))) {
      81      127916 :             switch(m) {
      82           0 :                case VLAEnum::OLDA:
      83           0 :                     m = VLAEnum::AD;
      84           0 :                     break;
      85           0 :                case VLAEnum::OLDB:
      86           0 :                     m = VLAEnum::BD;
      87           0 :                     break;
      88           0 :                case VLAEnum::OLDC:
      89           0 :                     m = VLAEnum::CD;
      90           0 :                     break;
      91           0 :                case VLAEnum::OLDD:
      92           0 :                     m = VLAEnum::AD;
      93           0 :                     break;
      94      127916 :                default :
      95      127916 :                     break;
      96             :             }
      97      127916 :       return m;
      98             :     }
      99             :   }
     100           0 :   return VLAEnum::UNKNOWN_MODE;
     101      127916 : }
     102             : 
     103             : // Local Variables: 
     104             : // compile-command: "gmake VLAEnum"
     105             : // End: 

Generated by: LCOV version 1.16