LCOV - code coverage report
Current view: top level - alma/Enumerations - CCalDataOrigin.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 15 105 14.3 %
Date: 2024-10-04 16:51:10 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 CCalDataOrigin.cpp
      34             :  */
      35             : #include <sstream>
      36             : #include <alma/Enumerations/CCalDataOrigin.h>
      37             : #include <string>
      38             : using namespace std;
      39             : 
      40           0 : int CCalDataOrigin::version() {
      41           0 :         return CalDataOriginMod::version;
      42             :         }
      43             :         
      44           0 : string CCalDataOrigin::revision () {
      45           0 :         return CalDataOriginMod::revision;
      46             : }
      47             : 
      48           0 : unsigned int CCalDataOrigin::size() {
      49           0 :         return 9;
      50             :         }
      51             :         
      52             :         
      53             : const std::string& CCalDataOrigin::sTOTAL_POWER = "TOTAL_POWER";
      54             :         
      55             : const std::string& CCalDataOrigin::sWVR = "WVR";
      56             :         
      57             : const std::string& CCalDataOrigin::sCHANNEL_AVERAGE_AUTO = "CHANNEL_AVERAGE_AUTO";
      58             :         
      59             : const std::string& CCalDataOrigin::sCHANNEL_AVERAGE_CROSS = "CHANNEL_AVERAGE_CROSS";
      60             :         
      61             : const std::string& CCalDataOrigin::sFULL_RESOLUTION_AUTO = "FULL_RESOLUTION_AUTO";
      62             :         
      63             : const std::string& CCalDataOrigin::sFULL_RESOLUTION_CROSS = "FULL_RESOLUTION_CROSS";
      64             :         
      65             : const std::string& CCalDataOrigin::sOPTICAL_POINTING = "OPTICAL_POINTING";
      66             :         
      67             : const std::string& CCalDataOrigin::sHOLOGRAPHY = "HOLOGRAPHY";
      68             :         
      69             : const std::string& CCalDataOrigin::sNONE = "NONE";
      70             :         
      71           0 : const std::vector<std::string> CCalDataOrigin::names() {
      72           0 :     std::vector<std::string> enumSet;
      73             :     
      74           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sTOTAL_POWER);
      75             :     
      76           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sWVR);
      77             :     
      78           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sCHANNEL_AVERAGE_AUTO);
      79             :     
      80           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sCHANNEL_AVERAGE_CROSS);
      81             :     
      82           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sFULL_RESOLUTION_AUTO);
      83             :     
      84           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sFULL_RESOLUTION_CROSS);
      85             :     
      86           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sOPTICAL_POINTING);
      87             :     
      88           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sHOLOGRAPHY);
      89             :     
      90           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sNONE);
      91             :         
      92           0 :     return enumSet;
      93           0 : }
      94             : 
      95           0 : std::string CCalDataOrigin::name(const CalDataOriginMod::CalDataOrigin& f) {
      96           0 :     switch (f) {
      97             :     
      98           0 :     case CalDataOriginMod::TOTAL_POWER:
      99           0 :       return CCalDataOrigin::sTOTAL_POWER;
     100             :     
     101           0 :     case CalDataOriginMod::WVR:
     102           0 :       return CCalDataOrigin::sWVR;
     103             :     
     104           0 :     case CalDataOriginMod::CHANNEL_AVERAGE_AUTO:
     105           0 :       return CCalDataOrigin::sCHANNEL_AVERAGE_AUTO;
     106             :     
     107           0 :     case CalDataOriginMod::CHANNEL_AVERAGE_CROSS:
     108           0 :       return CCalDataOrigin::sCHANNEL_AVERAGE_CROSS;
     109             :     
     110           0 :     case CalDataOriginMod::FULL_RESOLUTION_AUTO:
     111           0 :       return CCalDataOrigin::sFULL_RESOLUTION_AUTO;
     112             :     
     113           0 :     case CalDataOriginMod::FULL_RESOLUTION_CROSS:
     114           0 :       return CCalDataOrigin::sFULL_RESOLUTION_CROSS;
     115             :     
     116           0 :     case CalDataOriginMod::OPTICAL_POINTING:
     117           0 :       return CCalDataOrigin::sOPTICAL_POINTING;
     118             :     
     119           0 :     case CalDataOriginMod::HOLOGRAPHY:
     120           0 :       return CCalDataOrigin::sHOLOGRAPHY;
     121             :     
     122           0 :     case CalDataOriginMod::NONE:
     123           0 :       return CCalDataOrigin::sNONE;
     124             :         
     125             :     }
     126             :     // Impossible siutation but....who knows with C++ enums
     127           0 :     throw badInt((int) f);
     128             : }
     129             : 
     130         127 : CalDataOriginMod::CalDataOrigin CCalDataOrigin::newCalDataOrigin(const std::string& name) {
     131             :                 
     132         127 :     if (name == CCalDataOrigin::sTOTAL_POWER) {
     133           0 :         return CalDataOriginMod::TOTAL_POWER;
     134             :     }
     135             :         
     136         127 :     if (name == CCalDataOrigin::sWVR) {
     137          41 :         return CalDataOriginMod::WVR;
     138             :     }
     139             :         
     140          86 :     if (name == CCalDataOrigin::sCHANNEL_AVERAGE_AUTO) {
     141           0 :         return CalDataOriginMod::CHANNEL_AVERAGE_AUTO;
     142             :     }
     143             :         
     144          86 :     if (name == CCalDataOrigin::sCHANNEL_AVERAGE_CROSS) {
     145          23 :         return CalDataOriginMod::CHANNEL_AVERAGE_CROSS;
     146             :     }
     147             :         
     148          63 :     if (name == CCalDataOrigin::sFULL_RESOLUTION_AUTO) {
     149          14 :         return CalDataOriginMod::FULL_RESOLUTION_AUTO;
     150             :     }
     151             :         
     152          49 :     if (name == CCalDataOrigin::sFULL_RESOLUTION_CROSS) {
     153           8 :         return CalDataOriginMod::FULL_RESOLUTION_CROSS;
     154             :     }
     155             :         
     156          41 :     if (name == CCalDataOrigin::sOPTICAL_POINTING) {
     157           0 :         return CalDataOriginMod::OPTICAL_POINTING;
     158             :     }
     159             :         
     160          41 :     if (name == CCalDataOrigin::sHOLOGRAPHY) {
     161           0 :         return CalDataOriginMod::HOLOGRAPHY;
     162             :     }
     163             :         
     164          41 :     if (name == CCalDataOrigin::sNONE) {
     165          41 :         return CalDataOriginMod::NONE;
     166             :     }
     167             :     
     168           0 :     throw badString(name);
     169             : }
     170             : 
     171           0 : CalDataOriginMod::CalDataOrigin CCalDataOrigin::literal(const std::string& name) {
     172             :                 
     173           0 :     if (name == CCalDataOrigin::sTOTAL_POWER) {
     174           0 :         return CalDataOriginMod::TOTAL_POWER;
     175             :     }
     176             :         
     177           0 :     if (name == CCalDataOrigin::sWVR) {
     178           0 :         return CalDataOriginMod::WVR;
     179             :     }
     180             :         
     181           0 :     if (name == CCalDataOrigin::sCHANNEL_AVERAGE_AUTO) {
     182           0 :         return CalDataOriginMod::CHANNEL_AVERAGE_AUTO;
     183             :     }
     184             :         
     185           0 :     if (name == CCalDataOrigin::sCHANNEL_AVERAGE_CROSS) {
     186           0 :         return CalDataOriginMod::CHANNEL_AVERAGE_CROSS;
     187             :     }
     188             :         
     189           0 :     if (name == CCalDataOrigin::sFULL_RESOLUTION_AUTO) {
     190           0 :         return CalDataOriginMod::FULL_RESOLUTION_AUTO;
     191             :     }
     192             :         
     193           0 :     if (name == CCalDataOrigin::sFULL_RESOLUTION_CROSS) {
     194           0 :         return CalDataOriginMod::FULL_RESOLUTION_CROSS;
     195             :     }
     196             :         
     197           0 :     if (name == CCalDataOrigin::sOPTICAL_POINTING) {
     198           0 :         return CalDataOriginMod::OPTICAL_POINTING;
     199             :     }
     200             :         
     201           0 :     if (name == CCalDataOrigin::sHOLOGRAPHY) {
     202           0 :         return CalDataOriginMod::HOLOGRAPHY;
     203             :     }
     204             :         
     205           0 :     if (name == CCalDataOrigin::sNONE) {
     206           0 :         return CalDataOriginMod::NONE;
     207             :     }
     208             :     
     209           0 :     throw badString(name);
     210             : }
     211             : 
     212           0 : CalDataOriginMod::CalDataOrigin CCalDataOrigin::from_int(unsigned int i) {
     213           0 :         vector<string> names_ = names();
     214           0 :         if (i >= names_.size()) throw badInt(i);
     215           0 :         return newCalDataOrigin(names_.at(i));
     216           0 : }
     217             : 
     218           0 : string CCalDataOrigin::badString(const string& name) {
     219           0 :         return "'"+name+"' does not correspond to any literal in the enumeration 'CalDataOrigin'.";
     220             : }
     221             : 
     222           0 : string CCalDataOrigin::badInt(unsigned int i) {
     223           0 :         ostringstream oss ;
     224           0 :         oss << "'" << i << "' is out of range for the enumeration 'CalDataOrigin'.";
     225           0 :         return oss.str();
     226           0 : }
     227             : 
     228             : namespace CalDataOriginMod {
     229           0 :         std::ostream & operator << ( std::ostream & out, const CalDataOrigin& value) {
     230           0 :                 out << CCalDataOrigin::name(value);
     231           0 :                 return out;
     232             :         }
     233             : 
     234           0 :         std::istream & operator >> ( std::istream & in , CalDataOrigin& value ) {
     235           0 :                 in.clear();
     236           0 :                 string s ; 
     237           0 :                 in >> s;
     238             :                 try {
     239           0 :                 value = CCalDataOrigin::literal(s);
     240             :                 }
     241           0 :                 catch (string & m) {
     242           0 :                 in.setstate(ios::failbit);
     243           0 :                 }
     244           0 :                 return in;
     245           0 :         }
     246             : }
     247             : 

Generated by: LCOV version 1.16