LCOV - code coverage report
Current view: top level - alma/Enumerations - CCalibrationSet.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 12 98 12.2 %
Date: 2024-12-11 20:54:31 Functions: 1 12 8.3 %

          Line data    Source code
       1             : 
       2             : /*
       3             :  * ALMA - Atacama Large Millimeter Array
       4             :  * (c) European Southern Observatory, 2002
       5             :  * (c) Associated Universities Inc., 2002
       6             :  * Copyright by ESO (in the framework of the ALMA collaboration),
       7             :  * Copyright by AUI (in the framework of the ALMA collaboration),
       8             :  * All rights reserved.
       9             :  * 
      10             :  * This library is free software; you can redistribute it and/or
      11             :  * modify it under the terms of the GNU Lesser General Public
      12             :  * License as published by the Free software Foundation; either
      13             :  * version 2.1 of the License, or (at your option) any later version.
      14             :  * 
      15             :  * This library is distributed in the hope that it will be useful,
      16             :  * but WITHOUT ANY WARRANTY, without even the implied warranty of
      17             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      18             :  * Lesser General Public License for more details.
      19             :  * 
      20             :  * You should have received a copy of the GNU Lesser General Public
      21             :  * License along with this library; if not, write to the Free Software
      22             :  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
      23             :  * MA 02111-1307  USA
      24             :  * 
      25             :  * /////////////////////////////////////////////////////////////////
      26             :  * // WARNING!  DO NOT MODIFY THIS FILE!                          //
      27             :  * //  ---------------------------------------------------------  //
      28             :  * // | This is generated code!  Do not modify this file.       | //
      29             :  * // | Any changes will be lost when the file is re-generated. | //
      30             :  * //  ---------------------------------------------------------  //
      31             :  * /////////////////////////////////////////////////////////////////
      32             :  *
      33             :  * File CCalibrationSet.cpp
      34             :  */
      35             : #include <sstream>
      36             : #include <alma/Enumerations/CCalibrationSet.h>
      37             : #include <string>
      38             : using namespace std;
      39             : 
      40           0 : int CCalibrationSet::version() {
      41           0 :         return CalibrationSetMod::version;
      42             :         }
      43             :         
      44           0 : string CCalibrationSet::revision () {
      45           0 :         return CalibrationSetMod::revision;
      46             : }
      47             : 
      48           0 : unsigned int CCalibrationSet::size() {
      49           0 :         return 8;
      50             :         }
      51             :         
      52             :         
      53             : const std::string& CCalibrationSet::sNONE = "NONE";
      54             :         
      55             : const std::string& CCalibrationSet::sAMPLI_CURVE = "AMPLI_CURVE";
      56             :         
      57             : const std::string& CCalibrationSet::sANTENNA_POSITIONS = "ANTENNA_POSITIONS";
      58             :         
      59             : const std::string& CCalibrationSet::sPHASE_CURVE = "PHASE_CURVE";
      60             :         
      61             : const std::string& CCalibrationSet::sPOINTING_MODEL = "POINTING_MODEL";
      62             :         
      63             : const std::string& CCalibrationSet::sACCUMULATE = "ACCUMULATE";
      64             :         
      65             : const std::string& CCalibrationSet::sTEST = "TEST";
      66             :         
      67             : const std::string& CCalibrationSet::sUNSPECIFIED = "UNSPECIFIED";
      68             :         
      69           0 : const std::vector<std::string> CCalibrationSet::names() {
      70           0 :     std::vector<std::string> enumSet;
      71             :     
      72           0 :     enumSet.insert(enumSet.end(), CCalibrationSet::sNONE);
      73             :     
      74           0 :     enumSet.insert(enumSet.end(), CCalibrationSet::sAMPLI_CURVE);
      75             :     
      76           0 :     enumSet.insert(enumSet.end(), CCalibrationSet::sANTENNA_POSITIONS);
      77             :     
      78           0 :     enumSet.insert(enumSet.end(), CCalibrationSet::sPHASE_CURVE);
      79             :     
      80           0 :     enumSet.insert(enumSet.end(), CCalibrationSet::sPOINTING_MODEL);
      81             :     
      82           0 :     enumSet.insert(enumSet.end(), CCalibrationSet::sACCUMULATE);
      83             :     
      84           0 :     enumSet.insert(enumSet.end(), CCalibrationSet::sTEST);
      85             :     
      86           0 :     enumSet.insert(enumSet.end(), CCalibrationSet::sUNSPECIFIED);
      87             :         
      88           0 :     return enumSet;
      89           0 : }
      90             : 
      91           0 : std::string CCalibrationSet::name(const CalibrationSetMod::CalibrationSet& f) {
      92           0 :     switch (f) {
      93             :     
      94           0 :     case CalibrationSetMod::NONE:
      95           0 :       return CCalibrationSet::sNONE;
      96             :     
      97           0 :     case CalibrationSetMod::AMPLI_CURVE:
      98           0 :       return CCalibrationSet::sAMPLI_CURVE;
      99             :     
     100           0 :     case CalibrationSetMod::ANTENNA_POSITIONS:
     101           0 :       return CCalibrationSet::sANTENNA_POSITIONS;
     102             :     
     103           0 :     case CalibrationSetMod::PHASE_CURVE:
     104           0 :       return CCalibrationSet::sPHASE_CURVE;
     105             :     
     106           0 :     case CalibrationSetMod::POINTING_MODEL:
     107           0 :       return CCalibrationSet::sPOINTING_MODEL;
     108             :     
     109           0 :     case CalibrationSetMod::ACCUMULATE:
     110           0 :       return CCalibrationSet::sACCUMULATE;
     111             :     
     112           0 :     case CalibrationSetMod::TEST:
     113           0 :       return CCalibrationSet::sTEST;
     114             :     
     115           0 :     case CalibrationSetMod::UNSPECIFIED:
     116           0 :       return CCalibrationSet::sUNSPECIFIED;
     117             :         
     118             :     }
     119             :     // Impossible siutation but....who knows with C++ enums
     120           0 :     throw badInt((int) f);
     121             : }
     122             : 
     123        2551 : CalibrationSetMod::CalibrationSet CCalibrationSet::newCalibrationSet(const std::string& name) {
     124             :                 
     125        2551 :     if (name == CCalibrationSet::sNONE) {
     126        1738 :         return CalibrationSetMod::NONE;
     127             :     }
     128             :         
     129         813 :     if (name == CCalibrationSet::sAMPLI_CURVE) {
     130           0 :         return CalibrationSetMod::AMPLI_CURVE;
     131             :     }
     132             :         
     133         813 :     if (name == CCalibrationSet::sANTENNA_POSITIONS) {
     134           0 :         return CalibrationSetMod::ANTENNA_POSITIONS;
     135             :     }
     136             :         
     137         813 :     if (name == CCalibrationSet::sPHASE_CURVE) {
     138         189 :         return CalibrationSetMod::PHASE_CURVE;
     139             :     }
     140             :         
     141         624 :     if (name == CCalibrationSet::sPOINTING_MODEL) {
     142           0 :         return CalibrationSetMod::POINTING_MODEL;
     143             :     }
     144             :         
     145         624 :     if (name == CCalibrationSet::sACCUMULATE) {
     146           0 :         return CalibrationSetMod::ACCUMULATE;
     147             :     }
     148             :         
     149         624 :     if (name == CCalibrationSet::sTEST) {
     150           0 :         return CalibrationSetMod::TEST;
     151             :     }
     152             :         
     153         624 :     if (name == CCalibrationSet::sUNSPECIFIED) {
     154         624 :         return CalibrationSetMod::UNSPECIFIED;
     155             :     }
     156             :     
     157           0 :     throw badString(name);
     158             : }
     159             : 
     160           0 : CalibrationSetMod::CalibrationSet CCalibrationSet::literal(const std::string& name) {
     161             :                 
     162           0 :     if (name == CCalibrationSet::sNONE) {
     163           0 :         return CalibrationSetMod::NONE;
     164             :     }
     165             :         
     166           0 :     if (name == CCalibrationSet::sAMPLI_CURVE) {
     167           0 :         return CalibrationSetMod::AMPLI_CURVE;
     168             :     }
     169             :         
     170           0 :     if (name == CCalibrationSet::sANTENNA_POSITIONS) {
     171           0 :         return CalibrationSetMod::ANTENNA_POSITIONS;
     172             :     }
     173             :         
     174           0 :     if (name == CCalibrationSet::sPHASE_CURVE) {
     175           0 :         return CalibrationSetMod::PHASE_CURVE;
     176             :     }
     177             :         
     178           0 :     if (name == CCalibrationSet::sPOINTING_MODEL) {
     179           0 :         return CalibrationSetMod::POINTING_MODEL;
     180             :     }
     181             :         
     182           0 :     if (name == CCalibrationSet::sACCUMULATE) {
     183           0 :         return CalibrationSetMod::ACCUMULATE;
     184             :     }
     185             :         
     186           0 :     if (name == CCalibrationSet::sTEST) {
     187           0 :         return CalibrationSetMod::TEST;
     188             :     }
     189             :         
     190           0 :     if (name == CCalibrationSet::sUNSPECIFIED) {
     191           0 :         return CalibrationSetMod::UNSPECIFIED;
     192             :     }
     193             :     
     194           0 :     throw badString(name);
     195             : }
     196             : 
     197           0 : CalibrationSetMod::CalibrationSet CCalibrationSet::from_int(unsigned int i) {
     198           0 :         vector<string> names_ = names();
     199           0 :         if (i >= names_.size()) throw badInt(i);
     200           0 :         return newCalibrationSet(names_.at(i));
     201           0 : }
     202             : 
     203           0 : string CCalibrationSet::badString(const string& name) {
     204           0 :         return "'"+name+"' does not correspond to any literal in the enumeration 'CalibrationSet'.";
     205             : }
     206             : 
     207           0 : string CCalibrationSet::badInt(unsigned int i) {
     208           0 :         ostringstream oss ;
     209           0 :         oss << "'" << i << "' is out of range for the enumeration 'CalibrationSet'.";
     210           0 :         return oss.str();
     211           0 : }
     212             : 
     213             : namespace CalibrationSetMod {
     214           0 :         std::ostream & operator << ( std::ostream & out, const CalibrationSet& value) {
     215           0 :                 out << CCalibrationSet::name(value);
     216           0 :                 return out;
     217             :         }
     218             : 
     219           0 :         std::istream & operator >> ( std::istream & in , CalibrationSet& value ) {
     220           0 :                 in.clear();
     221           0 :                 string s ; 
     222           0 :                 in >> s;
     223             :                 try {
     224           0 :                 value = CCalibrationSet::literal(s);
     225             :                 }
     226           0 :                 catch (string & m) {
     227           0 :                 in.setstate(ios::failbit);
     228           0 :                 }
     229           0 :                 return in;
     230           0 :         }
     231             : }
     232             : 

Generated by: LCOV version 1.16