LCOV - code coverage report
Current view: top level - alma/Enumerations - CCalibrationDevice.cc (source / functions) Hit Total Coverage
Test: ctest_coverage.info Lines: 37 86 43.0 %
Date: 2023-11-06 10:06:49 Functions: 4 12 33.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 CCalibrationDevice.cpp
      34             :  */
      35             : #include <sstream>
      36             : #include <alma/Enumerations/CCalibrationDevice.h>
      37             : #include <string>
      38             : using namespace std;
      39             : 
      40           0 : int CCalibrationDevice::version() {
      41           0 :         return CalibrationDeviceMod::version;
      42             :         }
      43             :         
      44           0 : string CCalibrationDevice::revision () {
      45           0 :         return CalibrationDeviceMod::revision;
      46             : }
      47             : 
      48           0 : unsigned int CCalibrationDevice::size() {
      49           0 :         return 7;
      50             :         }
      51             :         
      52             :         
      53             : const std::string& CCalibrationDevice::sAMBIENT_LOAD = "AMBIENT_LOAD";
      54             :         
      55             : const std::string& CCalibrationDevice::sCOLD_LOAD = "COLD_LOAD";
      56             :         
      57             : const std::string& CCalibrationDevice::sHOT_LOAD = "HOT_LOAD";
      58             :         
      59             : const std::string& CCalibrationDevice::sNOISE_TUBE_LOAD = "NOISE_TUBE_LOAD";
      60             :         
      61             : const std::string& CCalibrationDevice::sQUARTER_WAVE_PLATE = "QUARTER_WAVE_PLATE";
      62             :         
      63             : const std::string& CCalibrationDevice::sSOLAR_FILTER = "SOLAR_FILTER";
      64             :         
      65             : const std::string& CCalibrationDevice::sNONE = "NONE";
      66             :         
      67         167 : const std::vector<std::string> CCalibrationDevice::names() {
      68         167 :     std::vector<std::string> enumSet;
      69             :     
      70         167 :     enumSet.insert(enumSet.end(), CCalibrationDevice::sAMBIENT_LOAD);
      71             :     
      72         167 :     enumSet.insert(enumSet.end(), CCalibrationDevice::sCOLD_LOAD);
      73             :     
      74         167 :     enumSet.insert(enumSet.end(), CCalibrationDevice::sHOT_LOAD);
      75             :     
      76         167 :     enumSet.insert(enumSet.end(), CCalibrationDevice::sNOISE_TUBE_LOAD);
      77             :     
      78         167 :     enumSet.insert(enumSet.end(), CCalibrationDevice::sQUARTER_WAVE_PLATE);
      79             :     
      80         167 :     enumSet.insert(enumSet.end(), CCalibrationDevice::sSOLAR_FILTER);
      81             :     
      82         167 :     enumSet.insert(enumSet.end(), CCalibrationDevice::sNONE);
      83             :         
      84         167 :     return enumSet;
      85             : }
      86             : 
      87       40096 : std::string CCalibrationDevice::name(const CalibrationDeviceMod::CalibrationDevice& f) {
      88       40096 :     switch (f) {
      89             :     
      90       19128 :     case CalibrationDeviceMod::AMBIENT_LOAD:
      91       19128 :       return CCalibrationDevice::sAMBIENT_LOAD;
      92             :     
      93           0 :     case CalibrationDeviceMod::COLD_LOAD:
      94           0 :       return CCalibrationDevice::sCOLD_LOAD;
      95             :     
      96       19128 :     case CalibrationDeviceMod::HOT_LOAD:
      97       19128 :       return CCalibrationDevice::sHOT_LOAD;
      98             :     
      99        1824 :     case CalibrationDeviceMod::NOISE_TUBE_LOAD:
     100        1824 :       return CCalibrationDevice::sNOISE_TUBE_LOAD;
     101             :     
     102           0 :     case CalibrationDeviceMod::QUARTER_WAVE_PLATE:
     103           0 :       return CCalibrationDevice::sQUARTER_WAVE_PLATE;
     104             :     
     105           0 :     case CalibrationDeviceMod::SOLAR_FILTER:
     106           0 :       return CCalibrationDevice::sSOLAR_FILTER;
     107             :     
     108          16 :     case CalibrationDeviceMod::NONE:
     109          16 :       return CCalibrationDevice::sNONE;
     110             :         
     111             :     }
     112             :     // Impossible siutation but....who knows with C++ enums
     113           0 :     throw badInt((int) f);
     114             : }
     115             : 
     116       55175 : CalibrationDeviceMod::CalibrationDevice CCalibrationDevice::newCalibrationDevice(const std::string& name) {
     117             :                 
     118       55175 :     if (name == CCalibrationDevice::sAMBIENT_LOAD) {
     119       26719 :         return CalibrationDeviceMod::AMBIENT_LOAD;
     120             :     }
     121             :         
     122       28456 :     if (name == CCalibrationDevice::sCOLD_LOAD) {
     123           0 :         return CalibrationDeviceMod::COLD_LOAD;
     124             :     }
     125             :         
     126       28456 :     if (name == CCalibrationDevice::sHOT_LOAD) {
     127       26552 :         return CalibrationDeviceMod::HOT_LOAD;
     128             :     }
     129             :         
     130        1904 :     if (name == CCalibrationDevice::sNOISE_TUBE_LOAD) {
     131        1832 :         return CalibrationDeviceMod::NOISE_TUBE_LOAD;
     132             :     }
     133             :         
     134          72 :     if (name == CCalibrationDevice::sQUARTER_WAVE_PLATE) {
     135           0 :         return CalibrationDeviceMod::QUARTER_WAVE_PLATE;
     136             :     }
     137             :         
     138          72 :     if (name == CCalibrationDevice::sSOLAR_FILTER) {
     139           8 :         return CalibrationDeviceMod::SOLAR_FILTER;
     140             :     }
     141             :         
     142          64 :     if (name == CCalibrationDevice::sNONE) {
     143          64 :         return CalibrationDeviceMod::NONE;
     144             :     }
     145             :     
     146           0 :     throw badString(name);
     147             : }
     148             : 
     149           0 : CalibrationDeviceMod::CalibrationDevice CCalibrationDevice::literal(const std::string& name) {
     150             :                 
     151           0 :     if (name == CCalibrationDevice::sAMBIENT_LOAD) {
     152           0 :         return CalibrationDeviceMod::AMBIENT_LOAD;
     153             :     }
     154             :         
     155           0 :     if (name == CCalibrationDevice::sCOLD_LOAD) {
     156           0 :         return CalibrationDeviceMod::COLD_LOAD;
     157             :     }
     158             :         
     159           0 :     if (name == CCalibrationDevice::sHOT_LOAD) {
     160           0 :         return CalibrationDeviceMod::HOT_LOAD;
     161             :     }
     162             :         
     163           0 :     if (name == CCalibrationDevice::sNOISE_TUBE_LOAD) {
     164           0 :         return CalibrationDeviceMod::NOISE_TUBE_LOAD;
     165             :     }
     166             :         
     167           0 :     if (name == CCalibrationDevice::sQUARTER_WAVE_PLATE) {
     168           0 :         return CalibrationDeviceMod::QUARTER_WAVE_PLATE;
     169             :     }
     170             :         
     171           0 :     if (name == CCalibrationDevice::sSOLAR_FILTER) {
     172           0 :         return CalibrationDeviceMod::SOLAR_FILTER;
     173             :     }
     174             :         
     175           0 :     if (name == CCalibrationDevice::sNONE) {
     176           0 :         return CalibrationDeviceMod::NONE;
     177             :     }
     178             :     
     179           0 :     throw badString(name);
     180             : }
     181             : 
     182         167 : CalibrationDeviceMod::CalibrationDevice CCalibrationDevice::from_int(unsigned int i) {
     183         334 :         vector<string> names_ = names();
     184         167 :         if (i >= names_.size()) throw badInt(i);
     185         334 :         return newCalibrationDevice(names_.at(i));
     186             : }
     187             : 
     188           0 : string CCalibrationDevice::badString(const string& name) {
     189           0 :         return "'"+name+"' does not correspond to any literal in the enumeration 'CalibrationDevice'.";
     190             : }
     191             : 
     192           0 : string CCalibrationDevice::badInt(unsigned int i) {
     193           0 :         ostringstream oss ;
     194           0 :         oss << "'" << i << "' is out of range for the enumeration 'CalibrationDevice'.";
     195           0 :         return oss.str();
     196             : }
     197             : 
     198             : namespace CalibrationDeviceMod {
     199           0 :         std::ostream & operator << ( std::ostream & out, const CalibrationDevice& value) {
     200           0 :                 out << CCalibrationDevice::name(value);
     201           0 :                 return out;
     202             :         }
     203             : 
     204           0 :         std::istream & operator >> ( std::istream & in , CalibrationDevice& value ) {
     205           0 :                 in.clear();
     206           0 :                 string s ; 
     207           0 :                 in >> s;
     208             :                 try {
     209           0 :                 value = CCalibrationDevice::literal(s);
     210             :                 }
     211           0 :                 catch (string & m) {
     212           0 :                 in.setstate(ios::failbit);
     213             :                 }
     214           0 :                 return in;
     215             :         }
     216             : }
     217             : 

Generated by: LCOV version 1.16