LCOV - code coverage report
Current view: top level - alma/Enumerations - CCalibrationDevice.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 91 0.0 %
Date: 2024-10-12 00:35:29 Functions: 0 12 0.0 %

          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           0 : const std::vector<std::string> CCalibrationDevice::names() {
      68           0 :     std::vector<std::string> enumSet;
      69             :     
      70           0 :     enumSet.insert(enumSet.end(), CCalibrationDevice::sAMBIENT_LOAD);
      71             :     
      72           0 :     enumSet.insert(enumSet.end(), CCalibrationDevice::sCOLD_LOAD);
      73             :     
      74           0 :     enumSet.insert(enumSet.end(), CCalibrationDevice::sHOT_LOAD);
      75             :     
      76           0 :     enumSet.insert(enumSet.end(), CCalibrationDevice::sNOISE_TUBE_LOAD);
      77             :     
      78           0 :     enumSet.insert(enumSet.end(), CCalibrationDevice::sQUARTER_WAVE_PLATE);
      79             :     
      80           0 :     enumSet.insert(enumSet.end(), CCalibrationDevice::sSOLAR_FILTER);
      81             :     
      82           0 :     enumSet.insert(enumSet.end(), CCalibrationDevice::sNONE);
      83             :         
      84           0 :     return enumSet;
      85           0 : }
      86             : 
      87           0 : std::string CCalibrationDevice::name(const CalibrationDeviceMod::CalibrationDevice& f) {
      88           0 :     switch (f) {
      89             :     
      90           0 :     case CalibrationDeviceMod::AMBIENT_LOAD:
      91           0 :       return CCalibrationDevice::sAMBIENT_LOAD;
      92             :     
      93           0 :     case CalibrationDeviceMod::COLD_LOAD:
      94           0 :       return CCalibrationDevice::sCOLD_LOAD;
      95             :     
      96           0 :     case CalibrationDeviceMod::HOT_LOAD:
      97           0 :       return CCalibrationDevice::sHOT_LOAD;
      98             :     
      99           0 :     case CalibrationDeviceMod::NOISE_TUBE_LOAD:
     100           0 :       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           0 :     case CalibrationDeviceMod::NONE:
     109           0 :       return CCalibrationDevice::sNONE;
     110             :         
     111             :     }
     112             :     // Impossible siutation but....who knows with C++ enums
     113           0 :     throw badInt((int) f);
     114             : }
     115             : 
     116           0 : CalibrationDeviceMod::CalibrationDevice CCalibrationDevice::newCalibrationDevice(const std::string& name) {
     117             :                 
     118           0 :     if (name == CCalibrationDevice::sAMBIENT_LOAD) {
     119           0 :         return CalibrationDeviceMod::AMBIENT_LOAD;
     120             :     }
     121             :         
     122           0 :     if (name == CCalibrationDevice::sCOLD_LOAD) {
     123           0 :         return CalibrationDeviceMod::COLD_LOAD;
     124             :     }
     125             :         
     126           0 :     if (name == CCalibrationDevice::sHOT_LOAD) {
     127           0 :         return CalibrationDeviceMod::HOT_LOAD;
     128             :     }
     129             :         
     130           0 :     if (name == CCalibrationDevice::sNOISE_TUBE_LOAD) {
     131           0 :         return CalibrationDeviceMod::NOISE_TUBE_LOAD;
     132             :     }
     133             :         
     134           0 :     if (name == CCalibrationDevice::sQUARTER_WAVE_PLATE) {
     135           0 :         return CalibrationDeviceMod::QUARTER_WAVE_PLATE;
     136             :     }
     137             :         
     138           0 :     if (name == CCalibrationDevice::sSOLAR_FILTER) {
     139           0 :         return CalibrationDeviceMod::SOLAR_FILTER;
     140             :     }
     141             :         
     142           0 :     if (name == CCalibrationDevice::sNONE) {
     143           0 :         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           0 : CalibrationDeviceMod::CalibrationDevice CCalibrationDevice::from_int(unsigned int i) {
     183           0 :         vector<string> names_ = names();
     184           0 :         if (i >= names_.size()) throw badInt(i);
     185           0 :         return newCalibrationDevice(names_.at(i));
     186           0 : }
     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           0 : }
     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           0 :                 }
     214           0 :                 return in;
     215           0 :         }
     216             : }
     217             : 

Generated by: LCOV version 1.16